Skip to main content

Module likelihood

Module likelihood 

Source
Expand description

Module with phylogenetic likelihood under a substitution model Phylogenetic likelihood under a substitution model.

Felsenstein’s pruning algorithm over a tree and an Alignment, generalized across the rate categories of a GtrModel.

compute_log_likelihood returns just the tree’s log-likelihood — the Felsenstein up pass, no ancestral states. compute_marginal_asr reuses the same per-pattern pruning core (prune_pattern_category) and adds a pre-order down pass to reconstruct states and posteriors, so the two never drift. The TreeLikelihood trait exposes the likelihood-only path.

The joint (Viterbi) engine keeps its own recursion: it maximizes rather than sums over states (a different semiring), so it cannot share the marginal core.

Making pruning generic over RootedTree (rather than concrete in PhyloTree) is a deliberate non-goal here.

Re-exports§

pub use self::reconstruction::Reconstruction;

Modules§

profile
Likelihood profiles and scaling for numerical stability.
reconstruction
Result type carrying reconstructed states and the tree log-likelihood.

Traits§

TreeLikelihood
Log-likelihood of an alignment given a tree and a substitution model.

Functions§

compute_joint_asr
Implementation of Joint ASR logic (Viterbi).
compute_log_likelihood
Log-likelihood of an alignment given a tree and a substitution model.
compute_marginal_asr
Internal implementation of Marginal ASR logic.