9 weeks ago by
You should be able to do that with karyoploteR.
If you want a full genome view of the coverage, I'd recommend you to plot a binned version of the coverage instead of a per base value since you won't have enough pixels in your image for that kind of resolution anyway. With karyoploteR I'd use the
kpPlotBAMDensity function, that will take a BAM file directly. compute the read density with the window sizes you specify (defaults to 1 megabase windows), so 3000 data points for a human genome, and plot them on the karyotype. For example, to plot the coverage in a full genome with default 1Mb windows you can do something like
kp <- plotKaryotype(genome="hg38")
and that's it. It will take a while (that'a lot of data to process) but it will do it sequentially and never load the whole dataset into memory, so eventually it will end and generate an image like this:
You can also restrict the plot to a single chromosome or zoom in to a small region in the genome. or add other data onto it. You can find more information in the karyoploteR tutorial although
kpPlotBAMDensity is still missing from it.