Difference between samtools "-f 9" and "-f 11"
1
0
Entering edit mode
7 months ago
Dylan • 0

So ran into an interesting outcome from samtools filtering. I'm attempting to select reads in which one member of the pair is mapped, but the other is not. After searching for the best filtering for that, most people seemed to indicate -f 11 was the correct choice for this. However, that includes "properly paired" which seems like something I don't want. Additionally when I used -f 11 I get nothing coming out. I decided to try -f 9 which removes the proper pairing component and that seemed to work for my needs.

Can anyone explain why the posts I've seen in the past suggest -f 11 and whether or not this has an internal contradiction which yields no reads?

samtools sam bam • 510 views
ADD COMMENT
0
Entering edit mode
7 months ago

9: read must be paired AND mate must be unmapped

11: read must be paired AND mapped in proper pair AND mate must be unmapped (which is weird, if it's in proper pair, read and its mate should be both mapped)

I'm attempting to select reads in which one member of the pair is mapped, but the other is not.

I think you want:

samtools view --expr 'flag.paired && ((flag.unmap && !flag.munmap) || (!flag.unmap && flag.munmap))'  in.bam
ADD COMMENT
0
Entering edit mode

(which is weird, if it's in proper pair, read and its mate should be both mapped)

So that was my thought as well, I think the code you listed essentially mirrors doing -f 9 and -f 5 together

ADD REPLY
0
Entering edit mode

It is very easy to make nonsensical flags (unfortunately a flaw of the SAM spec itself) ... not to mention the awkward constructs: a primary alignment is an alignment that is not secondary, not supplementary and not unmapped ...

ADD REPLY

Login before adding your answer.

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