> Also is there a way to only consider reads that fall fully within the
> features to contribute coverage? IntersectBed seems close (with -f 1)
> but it counts the number of BED features that overlap each BAM read,
> not the other way around, when using option -
If I understand correctly, you could combine intersectBed and coverageBed as follows:
intersectBed -abam reads.bam -b target.bed -f 1.0 -bed | coverageBed -a stdin -b target.bed
This will only pass to coverageBed those alignments that are 100% within the targets. Consequently, the coverage will be computed on the targets solely from said reads. Is this what you wanted?
Best,
Aaron
I believe that the htseq package (http://www-huber.embl.de/users/anders/HTSeq/doc/count.html#count) will handle this by setting the appropriate "intersection-strict" value.
I will think more about this and consider modifying the tools to address this.
I assume you need this to avoid double-counting for a specific enrichment statistic???
Aaron