What is the correct way to get the total number of reads strictly contained in each interval in a GFF from a BAM file while enforcing strandedness? What I am looking for is very close to this intersectBed
feature:
-c For each entry in A, report the number of overlaps with B.
- Reports 0 for A entries that have no overlap with B.
- Overlaps restricted by -f and -r.
Except that I'd like the number of overlaps in A for each entry in B (i.e. the other way around). If I do:
intersectBed -abam mybam.bam -b mygff.gff -s -f 1 -wb
Then my understanding is that this will report the entry in B for each overlap with A. But I'd like each entry in B to be outputted exactly once, with the number of reads from A that are contained strictly within it. I'm not sure how to enforce strict containment here.
Is coverageBed
the solution to this? Or multicov
? I'm not sure how to enforce strict containment using coverageBed
- it's not clear to me if that's the default from the docs. Thanks.
Thanks, but I'd like to do this with
bedtools
if possible...No problem. Hopefully it helps someone else trying to do the same thing.