org.biojava.bio.dp.onehead
Class SingleDP

java.lang.Object
  extended by org.biojava.bio.dp.DP
      extended by org.biojava.bio.dp.onehead.SingleDP
All Implemented Interfaces:
Serializable

public class SingleDP
extends DP
implements Serializable

An implementation of DP that aligns a single sequence against a single model.

Author:
Matthew Pocock, Thomas Down, Samiul Hasan, Lukas Kall
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.biojava.bio.dp.DP
DP.ReverseIterator
 
Field Summary
protected  HashMap emissionsNull
           
protected  HashMap emissionsOdds
           
protected  HashMap emissionsProb
           
 
Constructor Summary
SingleDP(MarkovModel model)
           
 
Method Summary
protected  void backward_initialize(DPCursor dpCursor, ScoreType scoreType)
           
protected  void backward_recurse(DPCursor dpCursor, ScoreType scoreType)
           
protected  double backward_termination(DPCursor dpCursor, ScoreType scoreType)
           
protected  double backward(DPCursor dpCursor, ScoreType scoreType)
           
 double backward(SymbolList[] seq, ScoreType scoreType)
           
 DPMatrix backwardMatrix(SymbolList[] seq, DPMatrix matrix, ScoreType scoreType)
           
 DPMatrix backwardMatrix(SymbolList[] seq, ScoreType scoreType)
           
protected  void forward_initialize(DPCursor dpCursor, ScoreType scoreType)
           
protected  double forward(DPCursor dpCursor, ScoreType scoreType)
           
 double forward(SymbolList[] seq, ScoreType scoreType)
           
 DPMatrix forwardMatrix(SymbolList[] seq, DPMatrix matrix, ScoreType scoreType)
           
 DPMatrix forwardMatrix(SymbolList[] seq, ScoreType scoreType)
           
 double[] getEmission(Symbol sym, ScoreType scoreType)
          This method is public for the benefit of training algorithms, and in the future we should look at a better way of exposing the emissions cache.
 void update()
           
 StatePath viterbi(SymbolList[] symList, ScoreType scoreType)
           
 
Methods inherited from class org.biojava.bio.dp.DP
backwardTransitions, backwardTransitionScores, flatView, forwardsBackwards, forwardTransitions, forwardTransitionScores, generate, getBackwardTransitions, getBackwardTransitionScores, getDotStatesIndex, getForwardTransitions, getForwardTransitionScores, getModel, getStates, lockModel, scoreWeightMatrix, scoreWeightMatrix, setModel, stateList, unlockModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emissionsProb

protected final HashMap emissionsProb

emissionsOdds

protected final HashMap emissionsOdds

emissionsNull

protected final HashMap emissionsNull
Constructor Detail

SingleDP

public SingleDP(MarkovModel model)
         throws IllegalSymbolException,
                IllegalTransitionException,
                BioException
Throws:
IllegalSymbolException
IllegalTransitionException
BioException
Method Detail

update

public void update()
Overrides:
update in class DP

getEmission

public double[] getEmission(Symbol sym,
                            ScoreType scoreType)
                     throws IllegalSymbolException
This method is public for the benefit of training algorithms, and in the future we should look at a better way of exposing the emissions cache.

Throws:
IllegalSymbolException

forward

public double forward(SymbolList[] seq,
                      ScoreType scoreType)
               throws IllegalSymbolException,
                      IllegalAlphabetException,
                      IllegalSymbolException
Specified by:
forward in class DP
Throws:
IllegalSymbolException
IllegalAlphabetException

backward

public double backward(SymbolList[] seq,
                       ScoreType scoreType)
                throws IllegalSymbolException,
                       IllegalAlphabetException,
                       IllegalSymbolException
Specified by:
backward in class DP
Throws:
IllegalSymbolException
IllegalAlphabetException

forwardMatrix

public DPMatrix forwardMatrix(SymbolList[] seq,
                              ScoreType scoreType)
                       throws IllegalSymbolException,
                              IllegalAlphabetException,
                              IllegalSymbolException
Specified by:
forwardMatrix in class DP
Throws:
IllegalSymbolException
IllegalAlphabetException

backwardMatrix

public DPMatrix backwardMatrix(SymbolList[] seq,
                               ScoreType scoreType)
                        throws IllegalSymbolException,
                               IllegalAlphabetException,
                               IllegalSymbolException
Specified by:
backwardMatrix in class DP
Throws:
IllegalSymbolException
IllegalAlphabetException

forwardMatrix

public DPMatrix forwardMatrix(SymbolList[] seq,
                              DPMatrix matrix,
                              ScoreType scoreType)
                       throws IllegalArgumentException,
                              IllegalSymbolException,
                              IllegalAlphabetException,
                              IllegalSymbolException
Specified by:
forwardMatrix in class DP
Throws:
IllegalArgumentException
IllegalSymbolException
IllegalAlphabetException

backwardMatrix

public DPMatrix backwardMatrix(SymbolList[] seq,
                               DPMatrix matrix,
                               ScoreType scoreType)
                        throws IllegalArgumentException,
                               IllegalSymbolException,
                               IllegalAlphabetException,
                               IllegalSymbolException
Specified by:
backwardMatrix in class DP
Throws:
IllegalArgumentException
IllegalSymbolException
IllegalAlphabetException

forward

protected double forward(DPCursor dpCursor,
                         ScoreType scoreType)
                  throws IllegalSymbolException
Throws:
IllegalSymbolException

backward

protected double backward(DPCursor dpCursor,
                          ScoreType scoreType)
                   throws IllegalSymbolException
Throws:
IllegalSymbolException

forward_initialize

protected void forward_initialize(DPCursor dpCursor,
                                  ScoreType scoreType)
                           throws IllegalSymbolException
Throws:
IllegalSymbolException

backward_initialize

protected void backward_initialize(DPCursor dpCursor,
                                   ScoreType scoreType)
                            throws IllegalSymbolException
Throws:
IllegalSymbolException

backward_recurse

protected void backward_recurse(DPCursor dpCursor,
                                ScoreType scoreType)
                         throws IllegalSymbolException
Throws:
IllegalSymbolException

backward_termination

protected double backward_termination(DPCursor dpCursor,
                                      ScoreType scoreType)
                               throws IllegalSymbolException
Throws:
IllegalSymbolException

viterbi

public StatePath viterbi(SymbolList[] symList,
                         ScoreType scoreType)
                  throws IllegalSymbolException
Specified by:
viterbi in class DP
Throws:
IllegalSymbolException