This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Genome coverage within specified regions

Hi, I have a bed file containing the coordinates of certain regions of the genome. I want to get the genome coverage of these regions at each base position (i,e, similar to using -d option in bedtools genomecov).

example bed file

chr1 100 200 chr5 250 300

I want the output in the following manner:

chr1 100 "coverage at this position" chr1 101 "coverage" chr1 102 "coverage" . . . chr1 199 "coverage" chr1 200 "coverage" chr5 250 "coverage" chr5 251 "coverage" ...and so on

The genomecov of bedtools does this for the entire genome. Is there any way to get the coverage within the regions specified only?

bedtools genomecov coverage

1 answer

Mosdepth for the win (https://github.com/brentp/mosdepth ):

-b --by <bed|window> optional BED file or (integer) window-sizes.

Log in to answer this question.