|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.dp.DP
Objects that can perform dymamic programming operations upon sequences with HMMs.
The three main DP operations are Forwards, Backwards and Viterbi. Forwards and Backwards calculate the probability of the sequences having been made in any way by the model. Viterbi finds the most supported way that the sequence could have been made.
Each of the functions can return the dynamic-programming matrix containing the intermediate results. This may be useful for model training, or for visualisation.
Each of the funcitons can be calculated using the model probabilities, the null-model probabilities or the odds (ratio between the two). For Forwards and Backwards, the odds calculations produce numbers with questionable basis in reality. For Viterbi with odds, you will recieve the path through the model that is most different from the null model, and supported by the probabilities.
Nested Class Summary | |
static class |
DP.ReverseIterator
|
Constructor Summary | |
DP(MarkovModel model)
|
Method Summary | |
abstract double |
backward(SymbolList[] symList,
ScoreType scoreType)
|
abstract DPMatrix |
backwardMatrix(SymbolList[] symList,
DPMatrix matrix,
ScoreType scoreType)
|
abstract DPMatrix |
backwardMatrix(SymbolList[] symList,
ScoreType scoreType)
|
static int[][] |
backwardTransitions(MarkovModel model,
State[] states)
|
static double[][] |
backwardTransitionScores(MarkovModel model,
State[] states,
int[][] transitions,
ScoreType scoreType)
|
static MarkovModel |
flatView(MarkovModel model)
|
abstract double |
forward(SymbolList[] symList,
ScoreType scoreType)
|
abstract DPMatrix |
forwardMatrix(SymbolList[] symList,
DPMatrix matrix,
ScoreType scoreType)
|
abstract DPMatrix |
forwardMatrix(SymbolList[] symList,
ScoreType scoreType)
|
DPMatrix |
forwardsBackwards(SymbolList[] symList,
ScoreType scoreType)
|
static int[][] |
forwardTransitions(MarkovModel model,
State[] states)
|
static double[][] |
forwardTransitionScores(MarkovModel model,
State[] states,
int[][] transitions,
ScoreType scoreType)
|
StatePath |
generate(int length)
Generates an alignment from a model. |
int[][] |
getBackwardTransitions()
|
double[][] |
getBackwardTransitionScores(ScoreType scoreType)
|
int |
getDotStatesIndex()
|
int[][] |
getForwardTransitions()
|
double[][] |
getForwardTransitionScores(ScoreType scoreType)
|
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 |
update()
|
abstract StatePath |
viterbi(SymbolList[] symList,
ScoreType scoreType)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DP(MarkovModel model) throws IllegalSymbolException, IllegalTransitionException, BioException
Method Detail |
public static double scoreWeightMatrix(WeightMatrix matrix, SymbolList symList, int start) throws IllegalSymbolException
matrix
- the weight matrix used to evaluate the sequencessymList
- the SymbolList to assessstart
- the index of the first symbol in the window to evaluate
IllegalSymbolException
public static MarkovModel flatView(MarkovModel model) throws IllegalAlphabetException, IllegalSymbolException
IllegalAlphabetException
IllegalSymbolException
public static State[] stateList(MarkovModel mm) throws IllegalSymbolException, IllegalTransitionException, BioException
IllegalSymbolException
IllegalTransitionException
BioException
public static int[][] forwardTransitions(MarkovModel model, State[] states) throws IllegalSymbolException
IllegalSymbolException
public static double[][] forwardTransitionScores(MarkovModel model, State[] states, int[][] transitions, ScoreType scoreType) throws IllegalSymbolException
IllegalSymbolException
public static int[][] backwardTransitions(MarkovModel model, State[] states) throws IllegalSymbolException
IllegalSymbolException
public static double[][] backwardTransitionScores(MarkovModel model, State[] states, int[][] transitions, ScoreType scoreType) throws IllegalSymbolException
IllegalSymbolException
public int getDotStatesIndex()
public MarkovModel getModel()
public State[] getStates()
public int[][] getForwardTransitions()
public double[][] getForwardTransitionScores(ScoreType scoreType)
public int[][] getBackwardTransitions()
public double[][] getBackwardTransitionScores(ScoreType scoreType)
public void lockModel()
public void unlockModel()
public void update()
public abstract double forward(SymbolList[] symList, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException
IllegalSymbolException
IllegalAlphabetException
IllegalTransitionException
public abstract double backward(SymbolList[] symList, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException
IllegalSymbolException
IllegalAlphabetException
IllegalTransitionException
public abstract DPMatrix forwardMatrix(SymbolList[] symList, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException
IllegalSymbolException
IllegalAlphabetException
IllegalTransitionException
public abstract DPMatrix backwardMatrix(SymbolList[] symList, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException
IllegalSymbolException
IllegalAlphabetException
IllegalTransitionException
public abstract DPMatrix forwardMatrix(SymbolList[] symList, DPMatrix matrix, ScoreType scoreType) throws java.lang.IllegalArgumentException, IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException
java.lang.IllegalArgumentException
IllegalSymbolException
IllegalAlphabetException
IllegalTransitionException
public abstract DPMatrix backwardMatrix(SymbolList[] symList, DPMatrix matrix, ScoreType scoreType) throws java.lang.IllegalArgumentException, IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException
java.lang.IllegalArgumentException
IllegalSymbolException
IllegalAlphabetException
IllegalTransitionException
public abstract StatePath viterbi(SymbolList[] symList, ScoreType scoreType) throws IllegalSymbolException, java.lang.IllegalArgumentException, IllegalAlphabetException, IllegalTransitionException
IllegalSymbolException
java.lang.IllegalArgumentException
IllegalAlphabetException
IllegalTransitionException
public DPMatrix forwardsBackwards(SymbolList[] symList, ScoreType scoreType) throws BioException
BioException
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.
length
- the length of the sequence to generate
IllegalSymbolException
BioException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |