Filtering out of both read pairs from BAM file if any of the two align within interval
2
0
Entering edit mode
3.3 years ago
volatic • 0

Dear all,

I have a really basic question regarding how to filter out rRNA reads from my paired end RNA-seq data. Essentially I would like to filter out any read pair aligning within a bed file of rRNA coordinates, which I am doing using "bedtools intersect" with the -v flag. This works fine and I get rid of all reads aligning within this region, yet the issue lies in that if only one of the reads of a pair lies within this interval, then it only filters out the one that is within the interval and retains the other end.

Does anyone know of any tool that does either: a) removes both reads if at least one of them lies within an interval; or b) removes "orphan" reads for which its pair is not present in the bam file. Unfortunately, the FLAG field can't be used since the reads are actually properly paired at the time of aligning.

Thank you!

RNA-Seq • 1.2k views
0
Entering edit mode
0
Entering edit mode
3.3 years ago

2nd answer : I forgot I wrote samviewwithmate http://lindenb.github.io/jvarkit/SamViewWithMate.html

you would have to use bedtools complement to filter out the reads.