public class DuoBaumLevel
extends java.lang.Object
Class DuoBaumLevel
computes forward and backward Baum
values at a level of a hidden Markov model (HMM) whose states are
ordered edge trios of a leveled directed acyclic graph (DAG).
Instances of class SingleBaumLevel
are not thread-safe.
Constructor and Description |
---|
DuoBaumLevel(Dag dag,
GL gl)
Constructs a new
DuoBaumLevel 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 |
childNodeA2(int state)
Returns the child node of the second edge of the specified HMM state
with nonzero forward probability.
|
int |
childNodeAB1(int state)
Returns the child node of the first edge of the specified HMM state
with nonzero forward probability.
|
int |
childNodeB2(int state)
Returns the child node of the third edge of the specified HMM state
with nonzero forward probability.
|
Dag |
dag()
Returns the directed acyclic graph that determines the transition
probabilities.
|
int |
edgeA2(int state)
Returns the second edge of the specified HMM state with nonzero forward
probability.
|
int |
edgeAB1(int state)
Returns the first edge of the specified HMM state with nonzero forward
probability.
|
int |
edgeB2(int state)
Returns the third 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 |
gtProbsA(int gt)
Returns the specified posterior genotype probability for the parent.
|
float |
gtProbsB(int gt)
Returns the specified posterior genotype probability for the offspring.
|
int |
marker()
Return the level of the HMM.
|
int |
nGenotypes()
Return the number of possible genotypes at this level of the HMM.
|
int |
parentNodeA2(int state)
Returns the parent node of the second edge of the specified HMM state
with nonzero forward probability.
|
int |
parentNodeAB1(int state)
Returns the parent node of the first edge of the specified HMM state
with nonzero forward probability.
|
int |
parentNodeB2(int state)
Returns the parent node of the third edge of the specified HMM state
with nonzero forward probability.
|
void |
setBackwardValues(DuoNodes nodes)
Sets the Baum backward algorithm values for this level of the HMM
and stores the parent node trio values in the specified
nodes parameter. |
void |
setChildNodes(DuoNodes nodes)
Stores the Baum forward algorithm child node trio values for this
level of the HMM in the specified
DuoNodes object. |
void |
setForwardValues(DuoNodes nodes,
int marker,
int sampleA,
int sampleB)
Sets the Baum forward algorithm values for this level of the HMM
and records the child node trio values in the specified
nodes parameter. |
int |
size()
Return the number of states with nonzero forward probability at
this level of the HMM.
|
int |
symbolA2(int state)
Returns the symbol for the second edge of the specified HMM state
with nonzero forward probability.
|
int |
symbolAB1(int state)
Returns the symbol for the first edge of the specified HMM state
with nonzero forward probability.
|
int |
symbolB2(int state)
Returns the symbol for the third edge of the specified HMM state
with nonzero forward probability.
|
java.lang.String |
toString()
Returns a string description of
this . |
public DuoBaumLevel(Dag dag, GL gl)
DuoBaumLevel
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(DuoNodes nodes, int marker, int sampleA, int sampleB)
nodes
parameter. When the method call returns, the nodes
parameter will be reset to the child node trio values for this level of
the HMM.nodes
- child node trio values at the previous level of the HMMmarker
- the level of the HMM at which the Baum forward algorithm
probabilities will be computedsampleA
- the parent sample indexsampleB
- the offspring sample indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.dag().nMarkers()
java.lang.IndexOutOfBoundsException
- if
sampleA < 0 || sampleA >= this.gl().nSamples()
java.lang.IndexOutOfBoundsException
- if
sampleB < 0 || sampleB >= this.gl().nSamples()
java.lang.IndexOutOfBoundsException
- if any node in any node trio 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(DuoNodes nodes)
DuoNodes
object.nodes
- the node trio values that will be setjava.lang.NullPointerException
- if nodes == null
public void setBackwardValues(DuoNodes nodes)
nodes
parameter. When the method call returns, the
$nodes
parameter will be reset to the parent node trio values
for this level of the HMM.nodes
- parent node trio values at the next level of HMMjava.lang.IndexOutOfBoundsException
- if any node in any node trio 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 gtProbsA(int gt)
gt
- a genotype indexjava.lang.IndexOutOfBoundsException
- if
gt < 0 || gt >= this.nGenotypes()
public float gtProbsB(int gt)
gt
- a genotype indexjava.lang.IndexOutOfBoundsException
- if
gt < 0 || gt >= this.nGenotypes()
public int size()
public int edgeAB1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int edgeA2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int edgeB2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int parentNodeAB1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int parentNodeA2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int parentNodeB2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int childNodeAB1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int childNodeA2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int childNodeB2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int symbolAB1(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int symbolA2(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int symbolB2(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
.