One alignment in SAM field order.
pos and pnext are 1-based when present. A missing position is nil,
which SAM text prints as 0. A missing sequence or quality is nil, which
SAM text prints as *. Bases are not invented for a missing sequence.
tags keeps auxiliary fields. Integer, float, and string values are decoded.
A character is {:char, byte}. Hex (H) is {:hex, decoded_bytes} when the
text is valid hex, and {:raw, bytes} when it is not. An array is
{:array, subtype, values}.
Summary
Types
@type t() :: %CRAM.Alignment{ cigar: binary(), flag: non_neg_integer(), mapq: non_neg_integer() | nil, pnext: pos_integer() | nil, pos: pos_integer() | nil, qname: binary() | nil, qual: binary() | nil, rname: binary(), rnext: binary(), seq: binary() | nil, tags: [{binary(), tag_value()}], tlen: integer() }
One SAM-shaped record.
:qname— query name, ornilwhen the writer omitted it:flag— SAM flag bits:rname— reference name, or"*"when unmapped:pos— 1-based position, ornilwhen SAM would print0:mapq— mapping quality, ornilwhen it was not stored:cigar— CIGAR string, or"*":rnext— next reference name, or"*":pnext— 1-based next position, ornil:tlen— template length:seq— bases, ornilwhen SAM would print*:qual— quality bytes, ornilwhen SAM would print*:tags—{name, value}pairs. Names stay stringsiex> record = %CRAM.Alignment{qname: "read1", flag: 0, rname: "sq0", pos: 1, mapq: 60, cigar: "8M", rnext: "*", pnext: nil, tlen: 0, seq: "TTCACCCA", qual: "IIIIIIII", tags: [{"RG", "g1"}]} iex> {record.pos, record.tags} {1, [{"RG", "g1"}]}
@type tag_value() :: integer() | float() | binary() | {:char, binary()} | {:hex, binary()} | {:raw, binary()} | {:array, binary(), [integer() | float()]}
One decoded auxiliary value.
An integer, float, or string is the value itself. {:char, byte} is SAM
type A. {:hex, bytes} is type H after hex decoding. {:raw, bytes}
is type H whose text was not hex. {:array, subtype, values} is type B.