statalign.base
Class State

java.lang.Object
  extended by statalign.base.State

public class State
extends java.lang.Object

Objects of this class completely describe the state of the MCMC at a certain time. The state space that the chain explores comprises:

Apart from the above listed components State objects also store the Felsenstein likelihoods calculated for each character of each sequence and the full likelihood of the state to facilitate postprocessing based on these values (e.g. ancestral sequence estimation, loglikelihood trace etc.).

Tree node representation assumption: first nl nodes are the leaves, then come the ancestral nodes.

Author:
novak

Field Summary
 int[][] align
          Alignment: for each sequence and each character in the sequence the index of the ancestral character that it is aligned to, or -i-1 if it is not homologous to any character in the ancestor (gap) and the next character in the ancestor sequence (to the right) has index i
 double[] edgeLen
          Edge length to parent, for each node (first nl are leaves)
 double[][][] felsen
          Felsenstein likelihoods for each sequence and each character therein
 double[] indelParams
          Indel model parameters (in the order: R, lambda, mu)
 boolean isBurnin
          true if this state comes from the burnin.
 int[] left
          Tree representation: left descendant of each node (first nl are leaves), -1 for none
 double logLike
          Log-likelihood of the state, excluding model extension factors
 java.lang.String[] name
          Names of the leaf sequences
 int nl
          Number of leaves (input sequences)
 int nn
          Number of nodes
 int[] parent
          Tree representation: parent of each node (first nl are leaves), -1 for none
 int[] right
          Tree representation: right descendant of each node (first nl are leaves), -1 for none
 int root
          Root node of the tree
 java.lang.String[] seq
          All sequences as strings, including most likely ancestral characters
 double[] substParams
          Substitution model parameters, as given by the substitution plugin
 
Constructor Summary
State(int nn)
          Constructs a new State object, filling the given parameter and pre-allocating arrays (first dimensions only).
 
Method Summary
 java.lang.String[] getFullAlign()
          Returns the multiple alignment of all sequences, including ancestors.
 java.lang.String[] getLeafAlign()
          Returns the multiple alignment of all leaf sequences.
 java.lang.String getNewickString()
          Returns the Newick string representation of the tree
 java.lang.String getNewickStringWithLabels()
           
 java.lang.String[] getPairwiseAlign(int node)
          Returns string representation of alignment between node and its parent.
static void main(java.lang.String[] args)
           
 void updateNewickStringWithLabels()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nn

public int nn
Number of nodes


nl

public int nl
Number of leaves (input sequences)


root

public int root
Root node of the tree


left

public int[] left
Tree representation: left descendant of each node (first nl are leaves), -1 for none


right

public int[] right
Tree representation: right descendant of each node (first nl are leaves), -1 for none


parent

public int[] parent
Tree representation: parent of each node (first nl are leaves), -1 for none


edgeLen

public double[] edgeLen
Edge length to parent, for each node (first nl are leaves)


align

public int[][] align
Alignment: for each sequence and each character in the sequence the index of the ancestral character that it is aligned to, or -i-1 if it is not homologous to any character in the ancestor (gap) and the next character in the ancestor sequence (to the right) has index i


felsen

public double[][][] felsen
Felsenstein likelihoods for each sequence and each character therein


seq

public java.lang.String[] seq
All sequences as strings, including most likely ancestral characters


name

public java.lang.String[] name
Names of the leaf sequences


indelParams

public double[] indelParams
Indel model parameters (in the order: R, lambda, mu)


substParams

public double[] substParams
Substitution model parameters, as given by the substitution plugin


logLike

public double logLike
Log-likelihood of the state, excluding model extension factors


isBurnin

public boolean isBurnin
true if this state comes from the burnin.

Constructor Detail

State

public State(int nn)
Constructs a new State object, filling the given parameter and pre-allocating arrays (first dimensions only). Does not create parameter arrays.

Parameters:
nn - number of nodes total (including leaves)
Method Detail

getPairwiseAlign

public java.lang.String[] getPairwiseAlign(int node)
Returns string representation of alignment between node and its parent. Uses characters in seq to construct the strings, - is printed for gaps. Don't call for root, it will produce array bounds errors.

Parameters:
node - the node to get the alignment for
Returns:
String array of two elements, parent comes first

getLeafAlign

public java.lang.String[] getLeafAlign()
Returns the multiple alignment of all leaf sequences.


getFullAlign

public java.lang.String[] getFullAlign()
Returns the multiple alignment of all sequences, including ancestors.


getNewickString

public java.lang.String getNewickString()
Returns the Newick string representation of the tree


getNewickStringWithLabels

public java.lang.String getNewickStringWithLabels()

updateNewickStringWithLabels

public void updateNewickStringWithLabels()

main

public static void main(java.lang.String[] args)