6.8 years ago by
First, this is formally okay. The SAM specification says: "Bit 0x4 is the only reliable place to tell whether the segment is unmapped. If 0x4 is set, no
assumptions can be made about RNAME, POS, CIGAR, MAPQ, bits 0x2, 0x10 and 0x100
and the bit 0x20 of the next segment in the template."
In other words: if the "segment unmapped" bit is set, then the "read mapped in proper pair" bit doesn't mean anything anymore.
One scenario where this can happen, is if you align read pairs with BWA and one read maps to a chromosome end and goes over the end (e.g. circular chromosomes like chrM or bacterial genomes). That read is then set to unmapped by BWA, even though all the other flags are kept as they were and even the mapping positions are kept in the SAM output. See also Paired-End Sam Flag Mismatch During Filtering post.