org.biojava.bio.dp
Class DP

java.lang.Object
  |
  +--org.biojava.bio.dp.DP
Direct Known Subclasses:
PairwiseDP

public abstract class DP
extends java.lang.Object


Inner Class Summary
static class DP.ReverseIterator
           
 
Constructor Summary
DP(MarkovModel model)
           
 
Method Summary
abstract  double backward(SymbolList[] resList)
           
abstract  DPMatrix backwardMatrix(SymbolList[] resList)
           
abstract  DPMatrix backwardMatrix(SymbolList[] resList, DPMatrix matrix)
           
static int[][] backwardTransitions(MarkovModel model, State[] states)
           
static double[][] backwardTransitionScores(MarkovModel model, State[] states, int[][] transitions)
           
static MarkovModel flatView(MarkovModel model)
           
abstract  double forward(SymbolList[] resList)
           
abstract  DPMatrix forwardMatrix(SymbolList[] resList)
           
abstract  DPMatrix forwardMatrix(SymbolList[] resList, DPMatrix matrix)
           
 DPMatrix forwardsBackwards(SymbolList[] resList)
           
static int[][] forwardTransitions(MarkovModel model, State[] states)
           
static double[][] forwardTransitionScores(MarkovModel model, State[] states, int[][] transitions)
           
 StatePath generate(int length)
          Generates an alignment from a model.
 int[][] getBackwardTransitions()
           
 double[][] getBackwardTransitionScores()
           
 int getDotStatesIndex()
           
 int[][] getForwardTransitions()
           
 double[][] getForwardTransitionScores()
           
 MarkovModel getModel()
           
 State[] getStates()
           
 void lockModel()
           
static double scoreWeightMatrix(WeightMatrix matrix, SymbolList symList, int start)
          Scores the SymbolList from symbol start to symbol (start+columns) with a weight matrix.
static State[] stateList(MarkovModel mm)
           
 void unlockModel()
           
 void updateTransitions()
           
abstract  StatePath viterbi(SymbolList[] resList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DP

public DP(MarkovModel model)
   throws IllegalSymbolException,
          IllegalTransitionException,
          BioException
Method Detail

scoreWeightMatrix

public static double scoreWeightMatrix(WeightMatrix matrix,
                                       SymbolList symList,
                                       int start)
                                throws IllegalSymbolException
Scores the SymbolList from symbol start to symbol (start+columns) with a weight matrix.
Parameters:
matrix - the weight matrix used to evaluate the sequences
symList - the SymbolList to assess
start - the index of the first symbol in the window to evaluate
Returns:
the log probability or likelyhood of this weight matrix having generated symbols start to (start + columns) of symList

flatView

public static MarkovModel flatView(MarkovModel model)
                            throws IllegalAlphabetException,
                                   IllegalSymbolException

stateList

public static State[] stateList(MarkovModel mm)
                         throws IllegalSymbolException,
                                IllegalTransitionException,
                                BioException

forwardTransitions

public static int[][] forwardTransitions(MarkovModel model,
                                         State[] states)
                                  throws IllegalSymbolException

forwardTransitionScores

public static double[][] forwardTransitionScores(MarkovModel model,
                                                 State[] states,
                                                 int[][] transitions)
                                          throws IllegalSymbolException

backwardTransitions

public static int[][] backwardTransitions(MarkovModel model,
                                          State[] states)
                                   throws IllegalSymbolException

backwardTransitionScores

public static double[][] backwardTransitionScores(MarkovModel model,
                                                  State[] states,
                                                  int[][] transitions)
                                           throws IllegalSymbolException

getDotStatesIndex

public int getDotStatesIndex()

getModel

public MarkovModel getModel()

getStates

public State[] getStates()

getForwardTransitions

public int[][] getForwardTransitions()

getForwardTransitionScores

public double[][] getForwardTransitionScores()

getBackwardTransitions

public int[][] getBackwardTransitions()

getBackwardTransitionScores

public double[][] getBackwardTransitionScores()

lockModel

public void lockModel()

unlockModel

public void unlockModel()

updateTransitions

public void updateTransitions()

forward

public abstract double forward(SymbolList[] resList)
                        throws IllegalSymbolException,
                               IllegalAlphabetException,
                               IllegalTransitionException

backward

public abstract double backward(SymbolList[] resList)
                         throws IllegalSymbolException,
                                IllegalAlphabetException,
                                IllegalTransitionException

forwardMatrix

public abstract DPMatrix forwardMatrix(SymbolList[] resList)
                                throws IllegalSymbolException,
                                       IllegalAlphabetException,
                                       IllegalTransitionException

backwardMatrix

public abstract DPMatrix backwardMatrix(SymbolList[] resList)
                                 throws IllegalSymbolException,
                                        IllegalAlphabetException,
                                        IllegalTransitionException

forwardMatrix

public abstract DPMatrix forwardMatrix(SymbolList[] resList,
                                       DPMatrix matrix)
                                throws java.lang.IllegalArgumentException,
                                       IllegalSymbolException,
                                       IllegalAlphabetException,
                                       IllegalTransitionException

backwardMatrix

public abstract DPMatrix backwardMatrix(SymbolList[] resList,
                                        DPMatrix matrix)
                                 throws java.lang.IllegalArgumentException,
                                        IllegalSymbolException,
                                        IllegalAlphabetException,
                                        IllegalTransitionException

viterbi

public abstract StatePath viterbi(SymbolList[] resList)
                           throws IllegalSymbolException,
                                  java.lang.IllegalArgumentException,
                                  IllegalAlphabetException,
                                  IllegalTransitionException

forwardsBackwards

public DPMatrix forwardsBackwards(SymbolList[] resList)
                           throws BioException

generate

public StatePath generate(int length)
                   throws IllegalSymbolException,
                          BioException
Generates an alignment from a model.

If the length is set to -1 then the model length will be sampled using the model's transition to the end state. If the length is fixed using length, then the transitions to the end state are implicitly invoked.

Parameters:
length - the length of the sequence to generate
Returns:
a StatePath generated at random