Question: Filtering out of both read pairs from BAM file if any of the two align within interval
0
gravatar for volatic
19 months ago by
volatic0
volatic0 wrote:

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 • 563 views
ADD COMMENTlink modified 19 months ago by Pierre Lindenbaum131k • written 19 months ago by volatic0
0
gravatar for Pierre Lindenbaum
19 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum131k wrote:

using samjdk: http://lindenb.github.io/jvarkit/SamJdk.html

ADD COMMENTlink written 19 months ago by Pierre Lindenbaum131k
0
gravatar for Pierre Lindenbaum
19 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum131k wrote:

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

see also Extract reads within given region, and their mates ; How to extract reads in a specific region from a BAM file and also their mates mapped elsewhere ? ;

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

ADD COMMENTlink written 19 months ago by Pierre Lindenbaum131k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1496 users visited in the last hour