Skip to content

v2.10.0: fiberhmm-call --mode daf auto-detects MD tags (no encode step)

Choose a tag to compare

@mtcicero26 mtcicero26 released this 22 Apr 18:29
· 117 commits to main since this release

Highlights

fiberhmm-call --mode daf now works directly on raw DAF BAMs. The two-pass fiberhmm-daf-encode | fiberhmm-call pipeline collapses into one.

What changed

Per-read auto-detection in --mode daf. Priority:

  1. R/Y IUPAC codes in the stored sequence (from fiberhmm-daf-encode) — existing fast path, unchanged.
  2. MD tag on the aligned read — parsed on the fly, skips the encode step entirely.
  3. --reference REF.fa — new CLI flag, fallback when the BAM has neither R/Y nor MD.

First non-empty source wins per read.

Correctness

Output is byte-identical to the two-pass pipeline. Verified on a real 3,929-read consensus DAF BAM (Christy LaFlamme's dataset):

source same HMM call bytes as two-pass?
ns (nucleosomes) ✅ 0 / 3,929 diffs
nl (nuc lengths) ✅ 0 / 3,929 diffs
as (MSPs) ✅ 0 / 3,929 diffs
al (MSP lengths) ✅ 0 / 3,929 diffs
nq / aq (quality) ✅ 0 / 3,929 diffs
MA / AQ (spec tags) ✅ 0 / 3,929 diffs

And zero regression on R/Y-encoded BAMs: v2.9.6 vs v2.10.0 on the same pre-encoded BAM = 0 diffs.

New CLI

fiberhmm-call --mode daf --enzyme dddb --region-parallel \
    -i raw_aligned.bam -o recalled.bam                           # MD-tag path

fiberhmm-call --mode daf --enzyme dddb --region-parallel \
    -i raw_aligned.bam -o recalled.bam --reference ref.fa        # FASTA fallback

On startup, --mode daf does a fast-fail sniff: it checks the first 10 mapped reads for R/Y, MD, or --reference. If none are available, it errors out in under a second with a clear message instead of silently skipping every read.

Backward compatibility

  • fiberhmm-daf-encode stays available and unchanged. Still the right tool if you want R/Y IUPAC stamped into the stored sequence for R/Y-aware downstream tools.
  • R/Y-encoded BAMs continue through the existing fast path (zero cost for the new MD branch — it only fires when R/Y is absent).
  • No new dependencies.

Install

pip install --upgrade fiberhmm

Tests

289 passing. 4 new unit tests covering the MD-fallback branch, payload plumbing, fast-fail sniff, and byte-identity gate.