karyoploteR icon indicating copy to clipboard operation
karyoploteR copied to clipboard

Ploting gene density on my custom chromosomes

Open cell-c opened this issue 4 years ago • 1 comments

Hi,

Thank you for your excellent work. I am new in R. I met with difficulties when I used karyoploteR to plot gene density on chromosomes. Coud you provide some examples about ploting gene densitywith gene bed file and chromosome size file ?

Thank you for your help.

cell-c avatar Mar 02 '22 03:03 cell-c

Hi @cell-c

You should be able to find the code you need at the tutorial page (https://bernatgel.github.io/karyoploter_tutorial/). The idea is that you should combine the code to use a custom genome (https://bernatgel.github.io/karyoploter_tutorial//Tutorial/CustomGenomes/CustomGenomes.html) with the code to plot the density from a GRanges object at the Gene Density example (https://bernatgel.github.io/karyoploter_tutorial//Examples/GeneDensity/GeneDensity.html). The only missing piece for you would be how to use a bed file instead of a GRanges object and for that you can either use toGRanges as in

my.genes <- toGRanges("my.bed.file")

or simply use the path to your bed file in the kpPlotDensity call

kpPlotDensity(kp, "my.bed.file")

If you need more help or you encounter specific problems, just comment on this issue and I'll be happy to help.

Bernat

bernatgel avatar Mar 02 '22 09:03 bernatgel