Class 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
    • 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FitchParsimony

        public FitchParsimony​(java.util.List<Pattern> patterns,
                              boolean gapsAreStates)
      • FitchParsimony

        public FitchParsimony​(Patterns patterns,
                              boolean gapsAreStates)
    • 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 interface ParsimonyCriterion
        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 interface ParsimonyCriterion
        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 interface ParsimonyCriterion
        Parameters:
        tree - a tree object to reconstruct the characters on
        node - the node of the tree
        Returns:
        an array containing the reconstructed states for this node