cs195z.support
Interface PTreeAlgorithms

All Known Implementing Classes:
PStudentTreeAlgorithms

public interface PTreeAlgorithms

Extend this interface in your student class to perform the operations. The only requirement is that, when these methods are called with valid inputs, that you make the proper modifications to the PSpeciesNodes contained in the tree you are fed in such that the data tree is complete when the method completes.

Author:
apstewar

Field Summary
static int INFINITY
          A reasonable value for infinity.
 
Method Summary
 void felsenstein(net.datastructures.LinkedBinaryTree<PSpeciesNode> tree, HashMap<ZCharacter,Integer> stateIndices, double[][] transitionProb, int sequenceLength)
          Implements the Felsenstein max likelihood algorithm and makes changes to the PSpeciesNodes.
 void sankoff(net.datastructures.LinkedBinaryTree<PSpeciesNode> tree, HashMap<ZCharacter,Integer> stateIndices, int[][] costMatrix, int sequenceLength)
          Implements the Sankoff algorithm and makes changes to the PSpeciesNodes.
 

Field Detail

INFINITY

static final int INFINITY
A reasonable value for infinity. I initially used Integer.MAX_VALUE, but this caused unholy integer overflows that I don't want you to worry about. So use this.

See Also:
Constant Field Values
Method Detail

sankoff

void sankoff(net.datastructures.LinkedBinaryTree<PSpeciesNode> tree,
             HashMap<ZCharacter,Integer> stateIndices,
             int[][] costMatrix,
             int sequenceLength)
Implements the Sankoff algorithm and makes changes to the PSpeciesNodes. See docs.

Parameters:
tree - a binary tree with the constraint that it is complete
stateIndices - the indices for costMatrix, by ZCharacter
costMatrix - the scoring matrix from [parent][child]
sequenceLength - we conveniently provide the length in characters

felsenstein

void felsenstein(net.datastructures.LinkedBinaryTree<PSpeciesNode> tree,
                 HashMap<ZCharacter,Integer> stateIndices,
                 double[][] transitionProb,
                 int sequenceLength)
Implements the Felsenstein max likelihood algorithm and makes changes to the PSpeciesNodes. See docs, especially for the probability specification.

Parameters:
tree - a binary tree with the constraint that it is complete
stateIndices - the indices for transitionProb, by ZCharacter
transitionProb[y][x] - is P[x | y, t]
sequenceLength - we conveniently provide the length in characters