Algorithm::HMM(3pm)
β¨ NAME β¨
Algorithm::HMM β bestie, it's Perl bindings for a Hidden Markov Model library π no cap, that's the whole vibe. You write Perl, the HMM heavy lifting happens somewhere else, and you get to stay cute.
This one lives in the User Contributed Perl Documentation corner of your system, filed under Algorithm::HMM(3pm). Say hi when you see it π
π SYNOPSIS π
Okay so here's the whole lil routine, fr fr. Load a model, run a sequence through it, collect your hits, print your stats, save, reload. Iconic behaviour:
use Algorithm::HMM;
# Load a Hidden Markov Model.
my $hmm = new Algorithm::HMM(Model => 'sample.hmm');
# Run a sequence through the loaded model.
my $rep = $hmm->search("AAIELKBPOWELKQJPASDLKJIGE");
# Get all the global hits from the search.
my @ghits = $rep->global_hits();
# Get all the domain hits from the search.
my @dhits = $rep->domain_hits();
# Display information about the domain hits.
for (@dhits) {
print("pvalue = " . $_->pvalue . "\n");
print("evalue = " . $_->evalue . "\n");
print("score = " . $_->score . "\n");
}
# Save the model to a different file.
$hmm->save("sample.hmm.0");
# Load the saved model again.
$hmm->load("sample.hmm.1")
Let's break down the moments, because each one ate π :
use Algorithm::HMM;β pulls the module in, the opening act πΈmy $hmm = new Algorithm::HMM(Model => 'sample.hmm');β constructs a new object and loads a Hidden Markov Model from the file named by theModelargument, heresample.hmm.my $rep = $hmm->search("AAIELKBPOWELKQJPASDLKJIGE");β runs that sequence through the loaded model and hands you back a report object,$rep. The sequence string is passed straight in, exactly as written, letters and all π§my @ghits = $rep->global_hits();β grabs all the global hits from the search into@ghits.my @dhits = $rep->domain_hits();β grabs all the domain hits from the search into@dhits.for (@dhits) { ... }β loops over every domain hit, and each$_in there is a hit object you can interrogate for itspvalue,evalueandscoreπ$_->pvalueβ the p-value of that hit, printed aspvalue = <value>$_->evalueβ the e-value of that hit, printed asevalue = <value>$_->scoreβ the score of that hit, printed asscore = <value>(yes the spacing in the format string is exactly like that, we love consistency π)
$hmm->save("sample.hmm.0");β saves the model out to a different file, heresample.hmm.0.$hmm->load("sample.hmm.1")β loads a saved model again, here fromsample.hmm.1. Not me pointing out there's no semicolon at the end of that line in the synopsisβ¦ it's giving "copy it verbatim or fix it yourself" energy π iykyk
Heads up bestie: the synopsis is the official example, so the file names and the sequence string are reproduced character for character. If you're actually running this, you supply your own paths and your own sequence π
That's the whole page, short and sweet β this one is all synopsis, no OPTIONS section, no SEE ALSO, nothing hiding in the back. Take the vibes, keep the exact syntax, and go be the main character of your own sequence analysis ππ
Brought to you by perl v5.34.0, dated 2022-02-06 β mwah, thanks for reading, love u, bye ππ β¨
π¦ where this page comes from
- ubuntu jammy: psortb 3.0.6+dfsg-2build2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms