public class RecombSingleBaumLevel
extends java.lang.Object
Class RestrictedSingleBaumLevel
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 RestrictedSingleBaumLevel
are not thread-safe.
Constructor and Description |
---|
RecombSingleBaumLevel(SamplerData samplerData)
Constructs a new
RecombSingleBaumLevel 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 |
capacity()
Returns the current capacity of this level.
|
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 |
gprobs(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 |
reset(int newCapacity)
Resets the size of this level to 0 and resets the capacity of this
level to the specified value.
|
void |
setBackwardValues(RecombSingleNodes 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(RecombSingleNodes nodes)
Stores the Baum forward algorithm child node pair values for this
level of the HMM in the specified
SingleNodes object. |
void |
setForwardValues(RecombSingleNodes nodes,
DiploidStates permittedStates,
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. |
void |
setInitialBackwardValues(RecombSingleNodes nodes)
Initializes the node pair values for the Baum backward algorithm.
|
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 RecombSingleBaumLevel(SamplerData samplerData)
RecombSingleBaumLevel
instance from the
specified data.samplerData
- the analysis datajava.lang.NullPointerException
- if samplerData == null
public void setForwardValues(RecombSingleNodes nodes, DiploidStates permittedStates, 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 HMMpermittedStates
- the permitted diploid model statesmarker
- 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 || permittedStates == null
public void setChildNodes(RecombSingleNodes nodes)
SingleNodes
object.nodes
- the node pair values that will be setjava.lang.NullPointerException
- if nodes == null
public void setInitialBackwardValues(RecombSingleNodes nodes)
nodes
- the node pair values to be initializedjava.lang.NullPointerException
- if nodes == null
public void setBackwardValues(RecombSingleNodes nodes)
nodes
parameter. When the method call returns, this
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 gprobs(int gt)
gt
- a genotype indexjava.lang.IndexOutOfBoundsException
- if
gt < 0 || gt >= this.nGenotypes()
public int capacity()
public void reset(int newCapacity)
newCapacity
- the new capacityjava.lang.IllegalArgumentException
- if newCapacity < 0
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
.