public class SingleBaumLevel
extends java.lang.Object
Class SingleBaumLevel
computes forward and backward Baum
values at a level of a hidden Markov model (HMM) whose states are
ordered edge pairs of a leveled directed acyclic graph (DAG).
Instances of class SingleBaumLevel
are not thread-safe.
Constructor and Description |
---|
SingleBaumLevel(Dag dag,
GL gl)
Constructs a new
SingleBaumLevel instance from the specified
data. |
Modifier and Type | Method and Description |
---|---|
float |
backwardValue(int state)
Returns the normalized backward value for the specified HMM state
with nonzero forward probability.
|
float |
backwardValuesSum()
Returns the sum of the backward values at this level of the HMM
when the backward values are computed using backward
values from the next level that are normalized to sum to 1.
|
int |
childNode1(int state)
Returns the child node of the first edge of the specified HMM state
with nonzero forward probability.
|
int |
childNode2(int state)
Returns the child node of the second edge of the specified HMM state
with nonzero forward probability.
|
Dag |
dag()
Returns the directed acyclic graph that determines the transition
probabilities.
|
int |
edge1(int state)
Returns the first edge of the specified HMM state with nonzero forward
probability.
|
int |
edge2(int state)
Returns the second edge of the specified HMM state with nonzero forward
probability.
|
float |
forwardValue(int state)
Returns the normalized forward value for the specified HMM state
with nonzero forward probability.
|
float |
forwardValuesSum()
Returns the sum of the forward values at this level of the HMM
when the forward values are computed using forward values
from the previous level that are normalized to sum to 1.
|
GL |
gl()
Returns the emission probabilities.
|
float |
gtProbs(int gt)
Returns the specified posterior genotype probability.
|
int |
marker()
Return the level of the HMM.
|
int |
nGenotypes()
Return the number of possible genotypes at this level of the HMM.
|
int |
parentNode1(int state)
Returns the parent node of the first edge of the specified HMM state
with nonzero forward probability.
|
int |
parentNode2(int state)
Returns the parent node of the second edge of the specified HMM state
with nonzero forward probability.
|
void |
setBackwardValues(SingleNodes nodes)
Sets the Baum backward algorithm values for this level of the HMM
and stores the parent node pair values in the specified
nodes parameter. |
void |
setChildNodes(SingleNodes nodes)
Stores the Baum forward algorithm child node pair values for this
level of the HMM in the specified
SingleNodes object. |
void |
setForwardValues(SingleNodes nodes,
int marker,
int sample)
Sets the Baum forward algorithm values for this level of the HMM
and records the child node pair values in the specified
nodes parameter. |
int |
size()
Return the number of states with nonzero forward probability at
this level of the HMM.
|
int |
symbol1(int state)
Returns the symbol for the first edge of the specified HMM state
with nonzero forward probability.
|
int |
symbol2(int state)
Returns the symbol for the second edge of the specified HMM state
with nonzero forward probability.
|
java.lang.String |
toString()
Returns a string description of
this . |
public SingleBaumLevel(Dag dag, GL gl)
SingleBaumLevel
instance from the specified
data.dag
- the directed acyclic graph that the determines transition
probabilitiesgl
- the emission probabilitiesjava.lang.IllegalArgumentException
- if
dag.markers().equals(gl.markers()) == false
java.lang.NullPointerException
- if dag == null || gl == null
public void setForwardValues(SingleNodes nodes, int marker, int sample)
nodes
parameter. When the method call returns, the nodes
parameter will be reset to the child node pair values for this level of
the HMM.nodes
- child node pair values at the previous level of the HMMmarker
- the level of the HMM at which the Baum forward algorithm
values will be computedsample
- a sample indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.dag().nMarkers()
java.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.gl().nSamples()
java.lang.IndexOutOfBoundsException
- if either node in any node pair with
non-zero value is not a valid parent node at the specified level of the
HMMjava.lang.NullPointerException
- if nodes == null
public void setChildNodes(SingleNodes nodes)
SingleNodes
object.nodes
- the node pair values that will be setjava.lang.NullPointerException
- if nodes == null
public void setBackwardValues(SingleNodes nodes)
nodes
parameter. When the method call returns, the
nodes
parameter will be reset to the parent
node pair values for this level of the HMM.nodes
- parent node pair values at the next level of HMMjava.lang.IndexOutOfBoundsException
- if either node in any node pair with
non-zero value is not a valid child node at this level of the HMMjava.lang.NullPointerException
- if nodes == null
public Dag dag()
public GL gl()
public int marker()
public int nGenotypes()
public float gtProbs(int gt)
gt
- a genotype indexjava.lang.IndexOutOfBoundsException
- if
gt < 0 || gt >= this.nGenotypes()
public int size()
public int edge1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int edge2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int parentNode1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int parentNode2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int childNode1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int childNode2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int symbol1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int symbol2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public float forwardValue(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public float backwardValue(int state)
state
- an index of a state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public float forwardValuesSum()
public float backwardValuesSum()
public java.lang.String toString()
this
. The exact details
of the description are unspecified and subject to change.toString
in class java.lang.Object
this