public class HapBaumLevel
extends java.lang.Object
Class HapBaumLevel
computes forward and backward Baum values for a
haploid hidden Markov model (HMM) whose states are edges of a leveled
directed acyclic graph (DAG).
Instances of class HapBaumLevel
are not thread-safe.
Constructor and Description |
---|
HapBaumLevel(Dag dag,
AL al)
Constructs a new
HapBaumLevel instance from the specified
data. |
Modifier and Type | Method and Description |
---|---|
float |
alProbs(int allele)
Returns the specified posterior allele probability.
|
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 |
childNode(int state)
Returns the child node of the specified HMM state with nonzero forward
probability.
|
Dag |
dag()
Returns the directed acyclic graph that determines the transition
probabilities.
|
int |
edge(int state)
Returns the edge of the specified HMM state with nonzero forward
probability.
|
AL |
emissions()
Returns the emission probabilities.
|
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.
|
int |
marker()
Return the level of the HMM.
|
int |
nAlleles()
Return the number of possible alleles at this level of the HMM.
|
int |
parentNode(int state)
Returns the parent node of the specified HMM state with nonzero forward
probability.
|
void |
setBackwardValues(HapNodes nodes)
Sets the Baum backward algorithm values for this level of the HMM
and stores the parent node values in the specified
nodes
parameter. |
void |
setChildNodes(HapNodes nodes)
Stores the Baum forward algorithm child node values for this
level of the HMM in the specified
HapNodes object. |
void |
setForwardValues(HapNodes nodes,
int marker,
int haplotype)
Sets the Baum forward algorithm values for this level of the HMM and
records the child node values in the specified
nodes parameter. |
int |
size()
Return the number of states with nonzero forward probability at
this level of the HMM.
|
int |
symbol(int state)
Returns the symbol of the specified HMM state with nonzero forward
probability.
|
java.lang.String |
toString()
Returns a string description of
this . |
public HapBaumLevel(Dag dag, AL al)
HapBaumLevel
instance from the specified
data.dag
- the directed acyclic graph that the determines transition
probabilitiesal
- the emission probabilitiesjava.lang.IllegalArgumentException
- if
dag.markers().equals(al.markers()) == false
java.lang.NullPointerException
- if dag == null || al == null
public void setForwardValues(HapNodes nodes, int marker, int haplotype)
nodes
parameter.
When the method call returns, the nodes
parameter will be
reset to the child node values for this level of the HMM.nodes
- child node values at the previous level of the HMMmarker
- the level of the HMM at which the Baum forward algorithm
values will be computedhaplotype
- a haplotype indexjava.lang.IndexOutOfBoundsException
- if
marker < 0 || marker >= this.dag().nMarkers()
java.lang.IndexOutOfBoundsException
- if
haplotype < 0 || haplotype >= this.al().nHaps()
java.lang.IndexOutOfBoundsException
- if any node 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(HapNodes nodes)
HapNodes
object.nodes
- the node values that will be setjava.lang.NullPointerException
- if nodes == null
public void setBackwardValues(HapNodes nodes)
nodes
parameter. When the method call returns, the nodes
parameter
will be reset to the parent node values for this level of the HMM.nodes
- parent node values at the next level of HMMjava.lang.IndexOutOfBoundsException
- if any node with non-zero value is
not a valid child node at the this.marker()
level of the HMMjava.lang.NullPointerException
- if nodes == null
public Dag dag()
public AL emissions()
public int marker()
public int nAlleles()
public float alProbs(int allele)
allele
- an allele indexjava.lang.IndexOutOfBoundsException
- if
allele < 0 || allele >= this.nAlleles()
public int size()
public int edge(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int parentNode(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int childNode(int state)
state
- an index of a HMM state with nonzero forward probabilityjava.lang.IndexOutOfBoundsException
- if
state < 0 || state >= this.size()
public int symbol(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