Package jebl.evolution.parsimony
Class FitchParsimony
- java.lang.Object
-
- jebl.evolution.parsimony.FitchParsimony
-
- All Implemented Interfaces:
ParsimonyCriterion
public class FitchParsimony extends java.lang.Object implements ParsimonyCriterion
Class for reconstructing characters using Fitch parsimony. This is intended to be much faster than the static methods in the utility "Parsimony" class.- Version:
- $Id: FitchParsimony.java 604 2007-01-04 20:22:42Z msuchard $
- Author:
- Andrew Rambaut, Alexei Drummond
-
-
Constructor Summary
Constructors Constructor Description FitchParsimony(java.util.List<Pattern> patterns, boolean gapsAreStates)
FitchParsimony(Patterns patterns, boolean gapsAreStates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getScore(Tree tree)
Calculates the minimum number of steps for the parsimony reconstruction for the given tree.double[]
getSiteScores(Tree tree)
Calculates the minimum number of siteScores for the parsimony reconstruction of a a set of character patterns on a tree.State[]
getStates(Tree tree, Node node)
Returns the reconstructed character states for a given node in the tree.
-
-
-
Method Detail
-
getSiteScores
public double[] getSiteScores(Tree tree)
Calculates the minimum number of siteScores for the parsimony reconstruction of a a set of character patterns on a tree. This only does the first pass of the Fitch algorithm so it does not store ancestral state reconstructions.- Specified by:
getSiteScores
in interfaceParsimonyCriterion
- Parameters:
tree
- a tree object to reconstruct the characters on- Returns:
- number of parsimony siteScores
-
getScore
public double getScore(Tree tree)
Description copied from interface:ParsimonyCriterion
Calculates the minimum number of steps for the parsimony reconstruction for the given tree. It is expected that the implementation's constructor will be set up with the characters so that repeated calls can be made to this function to evaluate different trees.- Specified by:
getScore
in interfaceParsimonyCriterion
- Parameters:
tree
- a tree object to reconstruct the characters on- Returns:
- the total score
-
getStates
public State[] getStates(Tree tree, Node node)
Returns the reconstructed character states for a given node in the tree. If this method is repeatedly called with the same tree and patterns then only the first call will reconstruct the states and each subsequent call will return the stored states.- Specified by:
getStates
in interfaceParsimonyCriterion
- Parameters:
tree
- a tree object to reconstruct the characters onnode
- the node of the tree- Returns:
- an array containing the reconstructed states for this node
-
-