Graduate Course ProjectInteractive Web Demo

Gene Finding with Hidden Markov Model

A two-state hidden Markov model that labels every base of a DNA sequence as background or gene, decoded with the Viterbi algorithm.

My Contribution: I implemented the statistical model, sequence generator, and Viterbi decoder in log space.
PythonPythonNumPyDynamic ProgrammingHMM
Live Browser Simulation

Viterbi Decoder & State Sequence

Client-Side Engine
Try this: Adjust transition probability and observe the boundary sharpness of predicted gene regions.

Loading simulation engine...

Architecture verification: Runs client-side statistical models on synthetic genomic sequences.

Implementation Highlights

  • Two hidden states: uniform background vs. GC/AT-skewed gene emissions.
  • Viterbi dynamic programming running in log-space to prevent numerical underflow on long sequences.
  • Synthetic gene planter generator used to benchmark and verify decoding accuracy.

Algorithm & System Mechanics

  • Maintains the optimal log-probability of ending in each state for every sequence position.
  • Back-pointer table tracks maximum likelihood transitions, walked backwards to recover the state sequence.