karyoploteR icon indicating copy to clipboard operation
karyoploteR copied to clipboard

Change y-axis values

Open pailloufat-stack opened this issue 1 year ago • 0 comments

Hello,

Thanks for your very useful tool. I use the kpPlotDensity function to get a coverage graph.

I would like to set up the y-axis values from the lowest coverage to the highest. The lowest is necessarly 0 because I work on the whole human genome and some regions are not covered (I checked with bedtools bamcoverage)

kp <- plotKaryotype(genome="hg38", chromosomes = "chr10")
kpPlotBAMDensity(kp, data="my_sorted.bam")
kpAxis(kp, ymax=kp$latest.plot$computed.values$max.density)`

I got this kind of plot. I can't spot the "0" coverage regions. Is it because the histogram is chuncked in multiple sections with the parameter window.size=1e6 ? And so, these regions are hidden by the covered regions?

karyoploteR-1

I reduced window.size to 100,000 but I still don't see the "0" coverage :

karyoploteR-chr10-1

Even if I use the kpPlotBAMCoverage() fuction. I cannot export the graph as pdf for the entire chromosome even if the kpPlotBAMCoverage() works :

(...)
> dev.off()
Error in dev.off() :
  'Calloc' could not allocate memory (2125547770 of 1 bytes)

So, I show you with a portion of the chr1 , where there is some portions without coverage (confirmed with bedtools bamcoverage) and I can spot the no covered regions :

kp <- plotKaryotype(genome = "hg38", chromosomes = "chr1", zoom=toGRanges("chr1:250000:350000"))
kpAddBaseNumbers(kp, tick.dist = 20000, add.units = TRUE)
kp <- kpPlotBAMCoverage(kp, data="/home/vipailler/Nanopore-Genoscope/aln_AA.sorted.bam", window.size = 10000)
kpAxis(kp, ymax=kp$latest.plot$computed.values$max.coverage)

karyoploteR-1

So, I suppose I can't spot the not covered regions because of the chromosome size?

Any help?

pailloufat-stack avatar Feb 28 '23 17:02 pailloufat-stack