Skip to content

feat: add recombination parameter estimator#464

Open
ivan-aksamentov wants to merge 3 commits into
masterfrom
feat/recombination-detection
Open

feat: add recombination parameter estimator#464
ivan-aksamentov wants to merge 3 commits into
masterfrom
feat/recombination-detection

Conversation

@ivan-aksamentov

@ivan-aksamentov ivan-aksamentov commented Jul 8, 2026

Copy link
Copy Markdown
Member
  • Sibling in nextclade: #1774

A dataset can freeze reviewed HMM parameter values as explicit pathogen.json overrides, so that the model a reviewer signed off on is not silently shifted by a later tree update. This PR adds the Python helper that computes them.

The script mirrors the Rust run-time estimator: it computes $\gamma$, $\mu_w$, $\mu_r$ from the reference tree using the same definitions (substitutions and insertions counted, deletions excluded, $\mu_r$ from inter-clade leaf distances). With --pathogen, the estimates are written into the file's recombination object in place; without it, they are printed to stdout for inspection. Parity is guarded by tests that transcribe the Rust unit-test fixtures as the oracle.

Work items

  • Implement scripts/recombination_params with tree-based estimation matching the Rust algorithm
  • Add parity tests against Rust oracle values, plus CLI smoke tests

Python mirror of the Rust estimator for freezing reviewed HMM parameters
into datasets. Computes gamma, muW, muR from the reference tree using the
same algorithm as the run-time estimator: substitutions and insertions
counted, deletions excluded, muR from inter-clade leaf distances.
Parity tests transcribe the Rust unit-test fixtures as the oracle.
CLI smoke tests verify the --pathogen write-back and stdout modes.
Mirror the Rust estimator change: count a branch mutation only when both its reference and query bases are present (non-gap), so neither insertions ("-10A", gap reference) nor deletions ("A15-", gap query) contribute to muW/muR. The decoder scores substitutions only, so calibrating against indels would inflate both rates on externally produced trees (augur/TreeTime) that carry insertion tokens.
@ivan-aksamentov
ivan-aksamentov had a problem deploying to refs/heads/feat/recombination-detection July 11, 2026 09:40 — with GitHub Actions Error
@ivan-aksamentov
ivan-aksamentov deployed to refs/pull/464/merge July 11, 2026 09:40 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant