Find count of reads in BAM file that fall within BED region

0

I have a set of BAM files from a bwa alignment, as well as a BED file of "target regions" I am interested in.

What I want to know is the count of the reads in the BAM file which overlap with any of the region in the BED file. Essentially, each read in the BAM will have an associated TRUE or FALSE denoting if it overlaps with any of the BED regions.

I can't seem to find the exact tool to use within bedtools, since bedtools multicov returns the total reads which overlap within each BED region, which ends up overcounting since an aligned BAM read can overlap with multiple BED regions.

bedtools intersect -a BAM -b BED -u technically gets me there, but in this case it generates a new bam file with only the reads in the BED regions, which I then have to count with samtools view -c. Since the BAM files are large, this is time-consuming and I was wondering if there is a faster way to do this.


bedtools


BAM


overlap


BED

• 54 views



Source link