This is an inventory of what the tests in this tree actually did. A passing unit test is not a samtools comparison. Where samtools did not run, the cell says not run.
Checked on 2026-11-30 with Elixir 1.18.4, OTP 28, and samtools 1.25 (htslib 1.25) on aarch64-apple-darwin25.2.0.
Works in the tests that ran
- Open a local path or an in-memory binary.
BAM.info/1returns version, sort order, references, read groups, programs, and comments, and a counting source showed it does not pread the next BGZF member when the header occupies the first member. - Stream alignments lazily.
Enum.take/2closes the source. Strict mode raises%BAM.Error{}on a shortblock_size. Permissive mode yields{:ok, record}and then{:error, %BAM.Error{}}. - Decode and encode the alignment core, read name, CIGAR, packed sequence, qualities, and auxiliary tags of types
A c C s S i I f Z H B. Float tags keep their raw bytes. A record split across two BGZF members is reassembled. - Filter a stream by reference name and by flag bits.
- Parse and format SAM text, including an unknown
@COline.BAM.SAM.region/1converts samtools region strings. - Write BGZF, including the 28-byte terminator.
samtools quickcheck -vexited 0 on a file this library wrote, andsamtools viewmatched the records field by field (name, flag, reference, 1-based position, MAPQ, CIGAR, sequence, quality). - Write and read BAI and CSI. Region queries for
chr1:1-4,chr1:5-5,chr1:11-12, andchr2returned the same query names assamtools viewon a samtools-produced BAM and on a BAM this library wrote. - Reject a BAI query when the reference length is
2^29 + 1. Reject an unsorted index input. Reject a headerl_textabove the configured cap. Reject a bad CRC, a truncated member, a gzip member withoutBC, and aBSIZEthat does not frame the member. mix bam.inspectprints the header summary and does not print alignment sequences.
The synthetic fixture is test/fixtures/tiny.bam. Provenance is in test/fixtures/PROVENANCE.md.
Not implemented
- CRAM, including CRAM indexes.
- Object storage, HTTP, and any source other than a local file or a memory binary.
- The long-CIGAR
CGtag.n_cigar_opis a 16-bit field. Records that need more than 65,535 operations are rejected. - Duplicate reference names in one dictionary. They are not yet an error.
- A shared BGZF package. The codec stays in
BAM.BGZF. - Parallel BGZF decompression. Members are independent, and no bench in this tree showed that a NIF or a worker pool was required.
- The rest of the samtools command surface:
mpileup,flagstat,markdup,calmd, CRAM conversion, and so on. The oracle usedview,index, andquickcheckonly. - CSI for a reference that does not fit BAI is implemented. Stretching BAI past
2^29is intentionally rejected.
Samtools
| Check | Result |
|---|---|
samtools 1.25 present | Run |
samtools view versus BAM.stream/2 on a samtools BAM | Run, fields matched |
samtools view REGION versus BAM.read/3 on interval edges | Run, query names matched |
samtools quickcheck on a BAM this library wrote | Run, exit 0 |
samtools view on that BAM | Run, fields matched |
If a future machine has no samtools binary, test/bam/samtools_test.exs skips and test/bam/fixture_test.exs prints not run for the quickcheck. That skip is not a pass. Update this table when that happens.
Release
This tree has no git tag. Tutorial drafts are unpublished. See docs/release-checklist.md.