Package org.biojava.bio.dp.onehead
Class SingleDP
- java.lang.Object
-
- org.biojava.bio.dp.DP
-
- 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
Fields Modifier and Type Field Description protected HashMap
emissionsNull
protected HashMap
emissionsOdds
protected HashMap
emissionsProb
-
Constructor Summary
Constructors Constructor Description SingleDP(MarkovModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
backward(DPCursor dpCursor, ScoreType scoreType)
double
backward(SymbolList[] seq, ScoreType scoreType)
protected void
backward_initialize(DPCursor dpCursor, ScoreType scoreType)
protected void
backward_recurse(DPCursor dpCursor, ScoreType scoreType)
protected double
backward_termination(DPCursor dpCursor, ScoreType scoreType)
DPMatrix
backwardMatrix(SymbolList[] seq, DPMatrix matrix, ScoreType scoreType)
DPMatrix
backwardMatrix(SymbolList[] seq, ScoreType scoreType)
protected double
forward(DPCursor dpCursor, ScoreType scoreType)
double
forward(SymbolList[] seq, ScoreType scoreType)
protected void
forward_initialize(DPCursor dpCursor, 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
-
-
-
-
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
-
-
Method Detail
-
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 classDP
- Throws:
IllegalSymbolException
IllegalAlphabetException
-
backward
public double backward(SymbolList[] seq, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalSymbolException
- Specified by:
backward
in classDP
- Throws:
IllegalSymbolException
IllegalAlphabetException
-
forwardMatrix
public DPMatrix forwardMatrix(SymbolList[] seq, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalSymbolException
- Specified by:
forwardMatrix
in classDP
- Throws:
IllegalSymbolException
IllegalAlphabetException
-
backwardMatrix
public DPMatrix backwardMatrix(SymbolList[] seq, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalSymbolException
- Specified by:
backwardMatrix
in classDP
- Throws:
IllegalSymbolException
IllegalAlphabetException
-
forwardMatrix
public DPMatrix forwardMatrix(SymbolList[] seq, DPMatrix matrix, ScoreType scoreType) throws IllegalArgumentException, IllegalSymbolException, IllegalAlphabetException, IllegalSymbolException
- Specified by:
forwardMatrix
in classDP
- Throws:
IllegalArgumentException
IllegalSymbolException
IllegalAlphabetException
-
backwardMatrix
public DPMatrix backwardMatrix(SymbolList[] seq, DPMatrix matrix, ScoreType scoreType) throws IllegalArgumentException, IllegalSymbolException, IllegalAlphabetException, IllegalSymbolException
- Specified by:
backwardMatrix
in classDP
- 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 classDP
- Throws:
IllegalSymbolException
-
-