How do I filter a BAM file for proper pairs WITHOUT samtools
3
0
Entering edit mode
2.5 years ago
hohoku • 0

I need to remove unpaired reads from my BAM file... and I'm looking for a non-samtools way of doing it. Suggestions?

alignment • 982 views
ADD COMMENT
1
Entering edit mode

May I ask you why samtools is not allowed?

ADD REPLY
0
Entering edit mode

We have some conflicts with samtools

ADD REPLY
1
Entering edit mode

That's incredibly unusual, it's likely you should just fix your environment then.

ADD REPLY
0
Entering edit mode

I would normally agree, but we have reasons for not using samtools in this instance

ADD REPLY
2
Entering edit mode
2.5 years ago

In deepTools:

alignmentSieve --samFlagInclude 2 -b input.bam -o output.bam

You can use multiple threads if you like. Of course this uses pysam, which uses htslib, which is part of samtools, but most tools will use something related to samtools somewhere...it's a standard tool after all.

ADD COMMENT
2
Entering edit mode
2.5 years ago

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

java -jar  dist/samjdk.jar -e 'return record.getProperPairFlag();' input.bam
ADD COMMENT
0
Entering edit mode
2.5 years ago
hohoku • 0

Thanks for the above responses, but we also found Sambamba which is pretty fast sambamba view -f bam -F "proper_pair" -o output.bam input.bam

ADD COMMENT

Login before adding your answer.

Traffic: 1054 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6