Skip to content

v2.12.0: circular molecule mode + inference refactor

Choose a tag to compare

@mtcicero26 mtcicero26 released this 25 May 18:05
· 409 commits to main since this release

New features

--circular on fiberhmm-call

New flag for circular molecules (plasmids, organelles). FiberHMM 3x-tiles each read internally and projects HMM footprint/TF calls back to molecule coordinates so output ns/nl/as/al stay in [0, read_length). Wrapped MA annotations are split into two clipped pieces that share an AN:Z name so downstream consumers can re-stitch them.

Note: FiberBrowser support for visualizing circular annotations (wrapped features, AN/circId grouping) is coming in a near-term release.

--circular-groups on fiberhmm-extract

New flag emits BED12+5 rows whose final columns are circId / circPart / circParts / molStart / molLength. autoSQL gains a matching .circ.as variant so generated bigBeds advertise the schema.

Internal refactor

fiberhmm/inference/parallel.py shrunk from 2898 lines to 192 lines: a thin dispatcher that re-exports every previously-private symbol. The streaming pipeline, region pipeline, legacy pipeline, workers, mp context, tagging, fused stages, and read-filter logic now live in dedicated modules. All existing import paths continue to work.

Performance

  • Single-pass numba DAF and m6A context encoders, with vectorized fallback retained as equivalence oracles (5-12x speedup on encode).
  • Viterbi memory traffic reduced via rolling state scores.
  • Read-only HMM log-probabilities frozen for inference workers (~2x faster warm prediction).
  • Numba-backed footprint run scanner with numpy fallback.

Stability

  • Posterior writers, fused DAF reference handles, score-DB connections, stats BAM handles, extract worker BEDs, tagged-BAM BED helpers, HDF5 writers, and TSV writers all close cleanly on failure paths.
  • Streaming and fused workers now report per-read failure counts to the drain while still passing failed reads through unchanged.
  • Region-parallel temp directories are now per-run unique.

Bug fix

set_legacy_apply_tags now strips stale MA/AN/AQ when fiberhmm-apply runs over a BAM previously processed by fiberhmm-call/recall-tfs. Prior to this, a re-apply pass would leave spec tags pointing at superseded ns/nl coordinates.

Tests

427 correctness tests pass (was 297 at the start of the refactor), 26 benchmarks pass, ruff clean. New end-to-end coverage for --circular (streaming + region-parallel) and extract --circular-groups.