Is There An Elegant Way To Extract Only The Properly-Paired Reads In A Sam/Bam File?
1
0
Entering edit mode
11.0 years ago
KCC ★ 4.1k

I know I should be filtering for the following tags: 99,163,83,147 and I know that samtools would work to get all the pairs. For example: samtools view -F 0x99 -b in.bam I was wondering if there was a more elegant way to do this than running samtools four times to filter for each tag. It also occured to me, I would probably have to sort the bam files afterward to ensure that the pairs were in the same order, which means I have to run the sort function 4 times as well.

I would appreciate knowing if there was a better way to do this.

paired-end samtools • 4.4k views
ADD COMMENT
8
Entering edit mode
11.0 years ago

The single command should work for all the flags you are looking for: samtools view -f 0x2 -b input.bam > output.bam

ADD COMMENT

Login before adding your answer.

Traffic: 1352 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