ReadonlyidSequence identifier (required, but may be empty string in malformed data)
Optional ReadonlydescriptionOptional description/comment line
ReadonlysequenceThe actual sequence data
ReadonlylengthCached sequence length for performance
Optional ReadonlylineOriginal line number where this sequence started (for error reporting)
ReadonlyqualityReadonlyqualityReadonlyformatReadonlyflagSAM bitwise FLAG field (0-65535)
ReadonlyreferenceReference sequence name, or "*" if unmapped
Readonlyposition1-based leftmost mapping position, or 0 if unmapped
ReadonlymappingMapping quality (0-255, where 255 indicates unavailable)
ReadonlycigarCIGAR string, or "*" if unavailable
Alignment record from a BAM or SAM file.
Extends AbstractSequence so that alignment records flow through the operations pipeline (grep, filter, unique, translate, etc.) without conversion. Extends QualityScoreBearing so that quality-aware operations (trimming, filtering, binning) work on alignment records the same way they work on FASTQ records.
The alignment-specific fields represent a focused subset of the SAM/BAM specification — enough for common sequence-oriented workflows without trying to model the full spec. Fields like mate info (RNEXT, PNEXT, TLEN), optional tags, and BAM binary metadata are excluded from the initial implementation and can be added later.
The AbstractSequence fields are populated as:
id← QNAME (the read name)sequence← decoded sequence byteslength← sequence lengthdescription← undefined (SAM/BAM records don't have descriptions)