Repository navigation
feat(hmm): add profile hidden Markov models - #705
Open
SahilRajputdotexe wants to merge 1 commit into
Open
SahilRajputdotexe wants to merge 1 commit into
SahilRajputdotexe wants to merge 1 commit into
Conversation
Add bio::stats::hmm::profile, a Plan 7 style profile HMM built from a block of aligned rows. It provides Viterbi, forward/backward and maximum expected accuracy decoding, bit-score search, local alignment and scanning, Baum-Welch and Viterbi re-estimation, sampling, and a text form that round-trips.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
bio::stats::hmm::profile, a profile hidden Markov model with match, insert and delete states per position (the Plan 7 layout from Durbin et al. and Eddy 1998). The generic discrete and Gaussian models inbio::stats::hmmare untouched, and this one sits next to them as a submodule.A
ProfileHmmis built from equal-length aligned rows, where-marks a gap. Columns that hold a residue in at least half of the weighted rows become positions, and a pseudocount smooths the counts. It then offers Viterbi alignment, forward/backward and match posteriors, maximum expected accuracy decoding, null-corrected bit scores with a rankedsearch, local alignment andscan, Baum-Welch and Viterbi re-estimation, sampling, consensus and information content, a rectangularalign_alllayout, and a text form that round-trips.Hidden Markov models are one of the open items on the roadmap in #3.
There are unit tests next to each part (forward equals backward, posteriors in range, insert and delete runs, search ordering and ties, non-decreasing re-estimation traces, text round trip, error cases) and a doctest in the module docs. All of them pass on my fork's CI, and
cargo clippyis clean for the new files.The diff is large, about 2000 lines of code across 12 new files plus tests. I am happy to split it into smaller PRs, for example builder and Viterbi first, then forward/backward and decoding, then training and the rest, if that is easier to review.