samtools / hts-specs

Specifications of SAM/BAM and related high-throughput sequencing file formats
http://samtools.github.io/hts-specs/
644 stars 174 forks source link

cram: interpretation of "unmapped" flag in a pseudocode seems incorrect #749

Closed athos closed 4 weeks ago

athos commented 8 months ago

In the CRAM specification, Section 10.6 has the following pseudocode:

procedure DecodeRecord
  ...
  if (BF AND 4) != 0 then
    DecodeMappedRead
  else
    DecodeUnmappedRead
  end if
end procedure

I think (BF AND 4) != 0 in the code should be (BF AND 4) = 0, as the 0x04 bit of the BF flag means "unmapped". Or am I misunderstanding something?

jkbonfield commented 8 months ago

I think you're correct. The pseudocode was added later and while I tried to get it correct obviously, this is a mistake as BF is "BAM flags" and adheres to the same bit-fields used in SAM/BAM. Thanks for reporting it.

jkbonfield commented 4 weeks ago

On reviewing outstanding issues I noticed I'd completely forgotten about this one. My apologies.

Thanks for reporting it. There's now a PR to fix this problem which I'll merge once I've verified the build works (a formality I'm sure).