---
title: "Hidden Markov models for sequence: profiles, states and decoding"
description: "A profile hidden Markov model represents a whole family by position-specific emission and transition probabilities rather than by one representative sequence. This topic covers how decoding assigns st"
canonical: https://lightmysky.com/learn/science/hidden-markov-models-for-sequence-profiles-states-and-decoding-mt_nk14IaZTcw
source: https://lightmysky.com/learn/science/hidden-markov-models-for-sequence-profiles-states-and-decoding-mt_nk14IaZTcw.md
retrieved: 2026-11-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Hidden Markov models for sequence: profiles, states and decoding

A profile hidden Markov model represents a whole family by position-specific emission and transition probabilities rather than by one representative sequence. This topic covers how decoding assigns states to a new sequence and what that assignment provides.

Subject: Science · Area: Genetics & Evolution · Ages 22 to 23
Page: https://lightmysky.com/learn/science/hidden-markov-models-for-sequence-profiles-states-and-decoding-mt_nk14IaZTcw

## Ready when they can

- Describe the match, insert and delete states of a profile model and what each one emits
- Explain what a single most probable path gives that per-position posteriors do not
- Explain how a well-trained profile can detect remote homologues missed by a single-sequence search

## Lesson: One model for a whole protein family

You have used substitution scores and gap penalties for pairwise alignment. A profile HMM models a protein family from a multiple alignment. It stores position-specific residue emission probabilities and transition probabilities between states. Conserved columns often favour a small set of residues. Variable columns can have broader, unequal probabilities. A match state need not emit the consensus residue.

**Example.** Match states emit residues aligned to consensus columns. Insert states emit extra residues, and a self-loop allows repeated insert emissions. Delete states skip consensus columns without emitting. For example, M1 emits A, I1 emits G then S, M2 emits T, D3 skips column 3, and M4 emits L. This path emits AGSTL.

*(drawing: M means match, I means insert and D means delete. Repeated I1 visits emit two extra residues.)*

The joint probability of a path and its emitted sequence is the product of its start probability, each transition probability, each emitted residue's probability and the end probability. Delete states have no emission factor. For a fixed sequence and model, Viterbi selects an allowed path maximising this product. It returns one alignment and state assignment, even when close alternatives leave some residues uncertain.

A residue's state posterior sums probability over all paths assigning that state to that residue, conditional on the sequence and model. It measures model-based support. For example, 85% support exceeds 55% support. Posterior decoding uses these marginal probabilities. Choosing each residue's most probable state independently need not obey transition rules. State posteriors are not probabilities of shared ancestry.

A best path can hide uncertainty. Several nearly tied paths may disagree about a residue's state. Use state posteriors to assess support at individual residues. A constrained decoding method can use posterior information while requiring an allowed path; independent marginal choices alone do not impose that requirement.

A well-trained profile combines family-specific residue distributions and gap patterns across positions. Weak agreement can accumulate and reveal a remote homologue missed by a search with one member. Training quality and search settings matter. Assess scores against a calibrated background model. A significant match supports a relationship; it does not prove ancestry or make every alignment position certain.

**Recap.** Profiles model family residue and gap patterns. Viterbi gives an allowed best path; posteriors describe state support under the model. Search matches still need significance checks.

*Original lesson, questions and flashcards about protein-family hidden Markov models, written for this learning dataset.*

## Practice

8 questions on this page, each with its working shown.

## Needs first

- [Alignment Scoring: Substitution Matrices, Gap Penalties and Significance](https://lightmysky.com/learn/science/alignment-scoring-substitution-matrices-gap-penalties-and-significance-mt_k--A8iF5SC)

## Optional connections

- [Joint, Marginal and Conditional Probability](https://lightmysky.com/learn/computing/joint-marginal-and-conditional-probability-mt__Rj-hOSMEw)
