statalign.base.hmm
Class Hmm

java.lang.Object
  extended by statalign.base.hmm.Hmm
Direct Known Subclasses:
Hmm2, HmmSilent

public abstract class Hmm
extends java.lang.Object

The abstract class of Hidden Markov Models.

Author:
novak

Field Summary
 double[] params
          HMM model parameters.
 
Constructor Summary
Hmm()
           
 
Method Summary
abstract  int[] getEmitPatt2State()
          Abstract function returning an array A that helps identify the state with some emission pattern.
abstract  int getEnd()
          Returns the index of the end state.
 double getLogStationaryProb(int length)
          Returns the logarithm of the stationary probability of generating a sequence of length characters under the HMM.
abstract  int getStart()
          Returns the index of the start state.
abstract  int[][] getStateEmit()
          Abstract function that specifies the emission of each state in the HMM in the form of an array A: A[s][i]=1 iff state i emits into sequence s (s=0 is the parent sequence; for pair-HMMs s=1 is the child sequence, for 3-seq HMMs s=1 is left and s=2 is right child).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

params

public double[] params
HMM model parameters. Implementing classes can use their own assignment and any number of parameters. In the case of the TKF92 model (HmmTkf92), values are: r, lambda and mu.

Constructor Detail

Hmm

public Hmm()
Method Detail

getStateEmit

public abstract int[][] getStateEmit()
Abstract function that specifies the emission of each state in the HMM in the form of an array A: A[s][i]=1 iff state i emits into sequence s (s=0 is the parent sequence; for pair-HMMs s=1 is the child sequence, for 3-seq HMMs s=1 is left and s=2 is right child). HMM implementations must override this and return their own emission patterns.

Returns:
array specifying emission patterns as described above

getEmitPatt2State

public abstract int[] getEmitPatt2State()
Abstract function returning an array A that helps identify the state with some emission pattern. The emission pattern is coded as a single integer: e.g. for a 3-seq HMM, emission into the parent sequence and right child only is coded as 101 binary, i.e. 4+1=5. Then, A[5] gives the index of the state with the above emission pattern. HMM implementations must override this and return an array corresponding to their own state - emission pattern assignment.

Returns:
array describing the emission pattern to state conversion

getStart

public abstract int getStart()
Returns the index of the start state.

Returns:
The index of the start state;

getEnd

public abstract int getEnd()
Returns the index of the end state.

Returns:
The index of the end state;

getLogStationaryProb

public double getLogStationaryProb(int length)
Returns the logarithm of the stationary probability of generating a sequence of length characters under the HMM.

Parameters:
length - The length of the sequence whose stationary probability is to be computed.
Returns:
The logarithm of the stationary probability under the HMM.