## dp
Class ViterbiAlign

    java.lang.Object
      dp.ViterbiAlign

    public class ViterbiAlign

extends Object

This demonstrates aligning a sequence to a model.

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.

Author:
  Matthew Pocock

Constructor Summary
`ViterbiAlign()`

Method Summary
`static void` `main(String[] args)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ViterbiAlign

    public ViterbiAlign()

Method Detail

### main

    public static void main(String[] args)
                     throws Exception

  Throws:
    `Exception`