public class ViterbiAlign extends Object
Use: ViterbiAlign model.xml sequence.fa
The output will contain an alignment of each sequence in
sequence.fa to the HMM described in model.xml. The
states will be displayed as their single-character symbol.
A dynamic-programming object is created from an HMM with the instruction
DP dp = new DP(new FlatModel(model)). The object dp
can then be used for finding the Viterbi-Path, the forward and backward scores
and even generating sequences from the model. In this example, an alignment is
generated with StatePath statePath = dp.viterbi(seq). The
StatePath object contains the most probable state
path through the model, given that seq was emitted. It also
contains seq and the step-wise probability of each state. As it
is a StatePath (and not just an
Alignment) it also contains the total likelyhood of
the alignment: P(seq | model).
The program can easily be addapted to produce a fasta-format file containing the state sequence for each input sequence. This is a very convenient way to stoor the alignment for later. Alternatively, you could print out the full state name, rather than just its symbol. By editing the XML file, you can construct almost any single-head HMM and run it through ViterbiAlign to get a state-path. This is often a quick way to test things out.
Have fun.
| Constructor and Description |
|---|
ViterbiAlign() |