This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bedtools coverage double-counting

I am using bedtools coverage to calculate coverage at various regions, but I also want to know how many reads are overlapping any of the regions. Sometimes the regions are close, so the reads span more than one and those reads get counted twice. Is there any way to prevent that or maybe an alternate method that can do that?

bedtools

Have a look also at htseq-count, it has options to decide what to do with ambiguous overlaps. And also featureCounts (about which I have no experience though).

1 answer

You could use bedtools intersect with the -c flag to report the number of overlaps for each read, then change any values >1 to 1 and sum (or filter out the reads with zero overlap and count the number of unfiltered reads).

bedtools intersect -c seems a good strategy to first get reads overlapping one and only one feature (i.e. count = 1). Then you need covergeBed to actually count the (now unambiguous) reads in each feature.

Log in to answer this question.