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/1 returns 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/2 closes the source. Strict mode raises %BAM.Error{} on a short block_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 @CO line. BAM.SAM.region/1 converts samtools region strings.
  • Write BGZF, including the 28-byte terminator. samtools quickcheck -v exited 0 on a file this library wrote, and samtools view matched 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, and chr2 returned the same query names as samtools view on 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 header l_text above the configured cap. Reject a bad CRC, a truncated member, a gzip member without BC, and a BSIZE that does not frame the member.
  • mix bam.inspect prints 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 CG tag. n_cigar_op is 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 used view, index, and quickcheck only.
  • CSI for a reference that does not fit BAI is implemented. Stretching BAI past 2^29 is intentionally rejected.

Samtools

CheckResult
samtools 1.25 presentRun
samtools view versus BAM.stream/2 on a samtools BAMRun, fields matched
samtools view REGION versus BAM.read/3 on interval edgesRun, query names matched
samtools quickcheck on a BAM this library wroteRun, exit 0
samtools view on that BAMRun, 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.