org.biojava.bio.dp.onehead
Class SingleDP

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

public class SingleDP
extends DP
implements java.io.Serializable

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

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

Nested Class Summary
 
Nested classes inherited from class org.biojava.bio.dp.DP
DP.ReverseIterator
 
Constructor Summary
SingleDP(MarkovModel model)
           
 
Method Summary
 double backward(SymbolList[] seq, ScoreType scoreType)
           
 DPMatrix backwardMatrix(SymbolList[] seq, DPMatrix matrix, ScoreType scoreType)
           
 DPMatrix backwardMatrix(SymbolList[] seq, 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, stateList, unlockModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleDP

public SingleDP(MarkovModel model)
         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 java.lang.IllegalArgumentException,
                              IllegalSymbolException,
                              IllegalAlphabetException,
                              IllegalSymbolException
Specified by:
forwardMatrix in class DP
Throws:
java.lang.IllegalArgumentException
IllegalSymbolException
IllegalAlphabetException

backwardMatrix

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

viterbi

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