This is a test version of Biostars. For the public version, visit https://www.biostars.org.
deepTools draw coverage for specific region

I am trying to plot coverage for CDS region using deeptools.

from the manual there is a flag --region, but it either takes a chromosome or region of chromosome

–region chr10 or –region chr10:456700:891000

Is there is a way to pass bed file to it like in –blackListFileName, -bl flag?

or I need to use something like:

samtools view -hL cds.bed alignment.bam > alignment_in_cds.sam

and then use plotCoverage normally?

alignment bam deeptools

1 answer

plotCoverage itself can't be made to use a BED file like you want. If you just want something like "% of signal in the CDS" then you can give a GTF file and your BAM file(s) to plotEnrichment, which will produce a histogram of "% alignments/feature" and (optionally) a table of the values.

If you really do want only the coverage distribution over the CDS then there's no way to do that directly with deepTools. One can prefilter the BAM file as you showed, but note that this will still create off-target bases that are flanking each CDS, so even then the results will only be approximate.

maybe I was not clear, I am talking about coverage not enrichment. So I want to draw the coverage for exones or CDS etc.. that is why I mentioned plotCoverage

normally I use

plotCoverage -b mybam.bam -o myoutput

and this will draw the coverage generally.

But If I am concerned only about some regions coverage (that is why I mentioned bed file), is there is a way to plot it?

There's not a way with deepTools. I had hoped you were more interested in signal enrichment, but if you really do want the coverage distribution then your only route (with deepTools) is to prefilter with samtools as you showed and ignore the fact that you'll still have off-target areas on each side of your CDS included.

Thanks a lot, you confirmed what I was thinking, If you please can you change this to an answer (or update yours)?!

I think this should be another question, but I would like it to be consistent with the post.

Is there a way to increase the scale of the "fraction of bases sampled" axis? in the example from documentation I could figure out that 5% of sample was covered 0 time; but what if there is more! can I control the scale to see it?

Not currently, it's just whatever matplotlib chooses, but you can save the values (--outRawCounts) and then do the plotting however you'd like in R.

Log in to answer this question.