I have two reads (paired end) in my bam file generated by bowtie2.
K00194:35:H7JHYBBXX:1:1101:10653:1349 77 * 0 0 * * 0 0 ACTGAATT JJJJJJJJ YT:Z:UP
K00194:35:H7JHYBBXX:1:1101:10653:1349 141 * 0 0 * * 0 0 GATTCGCC JJJJJJJJ YT:Z:UP
I am confused about the flag values. The first flag score (77) makes sense (0x1 = 1 = multiple segments, 0x4 = 4 = unmapped, 0x8 = 8 = next segment unmapped, 0x40 = 64 = first segment in template. The next score (141) I find confusing (0x1 = 1= multiple segments, 0x4 = 4 = unmapped, 0x8 = 8 = next segment unmapped, 0x80 = 128 = last segment in template). The confusion is the last two bits (0x8 and 0x80).
How can you have the next segment unmapped when you are the _last_ segment in the template? I would think that the value should be 133 instead?
That is how Picard defines flags and not strictly the SAM spec.