statalign.base.hmm
Class HmmTkf92

java.lang.Object
  extended by statalign.base.hmm.Hmm
      extended by statalign.base.hmm.Hmm2
          extended by statalign.base.hmm.HmmTkf92

public class HmmTkf92
extends Hmm2

This class implements a simplified version of the TKF92 pair-HMM.

Author:
novak

Field Summary
 
Fields inherited from class statalign.base.hmm.Hmm
params
 
Constructor Summary
HmmTkf92(double[] defParams)
          This constructor creates a TKF92 pair-HMM for the tree
 
Method Summary
 double[][] calcTransMatrix(double[][] transMatrix, double t)
           
 int[] getEmitPatt2State()
          Returns a conversion array from emission patterns (coded as integers) into state indices.
 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.
 int getStart()
          Returns the index of the start state.
 int[][] getStateEmit()
          Returns an array specifying the emission pattern of each state.
static void main(java.lang.String[] args)
          For testing purposes.
 double[][] preCalcTransMatrix(double[][] transMatrix, double t)
          Calculates a transition matrix given an edge length.
 double[][] preCalcTransMatrix(double[][] transMatrix, double t, double[] newParams)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HmmTkf92

public HmmTkf92(double[] defParams)
This constructor creates a TKF92 pair-HMM for the tree

Parameters:
defParams - The default parameters of the model. Currently it is r = 0.2, lambda = 0.009, mu = 0.011.
Method Detail

getStateEmit

public int[][] getStateEmit()
Returns an array specifying the emission pattern of each state. See class Hmm.

Specified by:
getStateEmit in class Hmm
Returns:
array specifying emission patterns as described above

getEmitPatt2State

public int[] getEmitPatt2State()
Returns a conversion array from emission patterns (coded as integers) into state indices. See class Hmm for details.

Specified by:
getEmitPatt2State in class Hmm
Returns:
array describing the emission pattern to state conversion

getStart

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

Specified by:
getStart in class Hmm
Returns:
The index of the start state;

getEnd

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

Specified by:
getEnd in class Hmm
Returns:
The index of the end state;

preCalcTransMatrix

public double[][] preCalcTransMatrix(double[][] transMatrix,
                                     double t)
Calculates a transition matrix given an edge length. See the abstract class Hmm2 for details.

Specified by:
preCalcTransMatrix in class Hmm2
Parameters:
transMatrix - If null, the function allocates memory for the return matrix If not, this is used for storing the matrix. For speeding-up purposes, note that allocating memory is time-consuming. In this way we need to allocate memory when asked.
t - The edge length parameter.
Returns:
The calculated transition matrix.

preCalcTransMatrix

public double[][] preCalcTransMatrix(double[][] transMatrix,
                                     double t,
                                     double[] newParams)
Specified by:
preCalcTransMatrix in class Hmm2
Parameters:
transMatrix - If null, the function allocates memory for the return matrix If not, this is used for storing the matrix. For speeding-up purposes, note that allocating memory is time-consuming. In this way we need to allocate memory when asked.
t - The edge length parameter.
newParams - A set of temporary parameters to be used for this particular instance
Returns:
The calculated transition matrix.

calcTransMatrix

public double[][] calcTransMatrix(double[][] transMatrix,
                                  double t)

getLogStationaryProb

public double getLogStationaryProb(int length)
Description copied from class: Hmm
Returns the logarithm of the stationary probability of generating a sequence of length characters under the HMM.

Overrides:
getLogStationaryProb in class 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.

main

public static void main(java.lang.String[] args)
For testing purposes.

Parameters:
args - No argument is used.