Repository navigation
v2.7.0: fiberhmm-call fused apply + recall-tfs
⚠️ Reverse-strand MM/ML parsing bug — UPGRADE TO v2.9.0
Versions 2.6 – 2.8.2 had a parser bug that shifted m6A/m5C modification positions on reverse-aligned reads (~24 bp median), causing ns/nl/as/al/MA/AQ tags to be wrong on reverse reads. Forward reads unaffected. DAF with IUPAC (R/Y) encoding unaffected.
Upgrade: pip install --upgrade fiberhmm (v2.9.0+). See v2.9.0 release notes for details.
New tool: `fiberhmm-call`
Runs the 2-state HMM (nucleosome/MSP calls) AND the LLR Kadane scan (TF calls) in a single Python process with one worker pool per read. Eliminates the apply→recall pipe serialization that was the dominant cost for short-read DAF data.
Benchmark (Mac, /tmp, same test BAMs)
| Streaming pipeline (apply | recall) | `fiberhmm-call` (fused) | Speedup | |
|---|---|---|---|
| Hia5 PacBio (-c 4 io=16) | 249 r/s | 518 r/s | 2.1× |
| DddB DAF (-c 8 io=16) | 958 r/s | 8455 r/s | 8.8× |
DddB gains are ~9× because per-read compute is small relative to pipe overhead. Hia5 gains are ~2× — Viterbi on 20 kb reads still dominates, but removing the pipe pays for itself.
What the tool does
- Slim IPC: main process builds per-read payload (seq + raw MM/ML bytes), workers parse + encode + HMM + TF scan in one call
- Reuses the encoded observation array across apply and recall (no double-encode)
- Output BAM has both legacy (`ns/nl/as/al`) and spec (`MA/AQ` with TF calls) tags
- Preserves coordinate sort order (drops straight into `samtools index` with no sort pass)
Usage
```bash
Hia5 PacBio
fiberhmm-call -i aligned.bam -o out.bam --enzyme hia5 --seq pacbio -c 8
DddB DAF with custom TF threshold
fiberhmm-call -i aligned.bam -o out.bam --enzyme dddb --min-llr 6.0 -c 8
Stream to fire (only one pipe now)
fiberhmm-call -i in.bam -o - --enzyme hia5 --seq pacbio | ft fire - out.bam
```
Correctness validation
Per-read tag equivalence tested vs. `fiberhmm-apply | fiberhmm-recall-tfs`: 1190 / 1226 non-trivial reads have byte-identical tags. The 36-read difference is an edge case where the streaming recall-tfs pass-through emits an MA tag from a pre-existing ns tag in the input BAM when MM/ML extraction fails — does not affect raw production BAMs with no pre-tags.
What didn't make it
FIRE scoring fusion via `pyft`: investigated and pyft only exposes read/tag extraction, not the FIRE scoring kernel. `ft fire` stays as a subprocess (one pipe), which is fine since fire is Rust-fast (~900 r/s).
Install
```bash
pip install --upgrade fiberhmm
```
🤖 Generated with Claude Code