Class TreeSearchTool


  • public final class TreeSearchTool
    extends java.lang.Object

    Title: TreeSearchTool

    Description: An access point for a simple and stable interface to tree search methods

    Version:
    1.0
    Author:
    Matthew Goode
    • Constructor Detail

      • TreeSearchTool

        public TreeSearchTool()
    • Method Detail

      • basicUnrootedTreeMLSearch

        public Tree basicUnrootedTreeMLSearch​(Tree baseTree,
                                              Alignment a,
                                              SubstitutionModel sm,
                                              boolean optimiseModel)
        Do a basic tree search using maximum likelihood on an unrooted tree space, with a given starting tree
        Parameters:
        baseTree - The starting tree (which may or may not be unrooted - will be unrooted)
        a - The related alignment, OTU labels must match that of the tree
        sm - The related substitution model. The data type of the model should match that of the alignment. The parameters of this model may change if the optimise model is choosen.
        optimiseModel - If true the substitution model will be optimised concurrently with the tree. This will change in the input model.
        Returns:
        The optimised tree (the original tree is *not* altered)
      • basicUnrootedTreeMLSearch

        public Tree basicUnrootedTreeMLSearch​(Tree baseTree,
                                              Alignment a,
                                              SubstitutionModel sm,
                                              boolean optimiseModel,
                                              AlgorithmCallback callback)
        Do a basic tree search using maximum likelihood on an unrooted tree space, with a given starting tree
        Parameters:
        baseTree - The starting tree (which may or may not be unrooted - will be unrooted)
        a - The related alignment, OTU labels must match that of the tree
        sm - The related substitution model. The data type of the model should match that of the alignment. The parameters of this model may change if the optimise model is choosen.
        optimiseModel - If true the substitution model will be optimised concurrently with the tree. This will change in the input model.
        callback - An AlgorithmCallback object used to control and monitor the search progress
        Returns:
        The optimised tree (the original tree is *not* altered)
      • basicUnrootedTreeMLSearch

        public Tree basicUnrootedTreeMLSearch​(Alignment a,
                                              SubstitutionModel sm,
                                              boolean optimiseModel)
        Do a basic tree search using maximum likelihood on an unrooted tree space, without a given starting tree
        Parameters:
        a - The related alignment, OTU labels must match that of the tree
        sm - The related substitution model. The data type of the model should match that of the alignment. The parameters of this model may change if the optimise model is choosen.
        optimiseModel - If true the substitution model will be optimised concurrently with the tree. This will change in the input model.
        Returns:
        The optimised tree
      • basicUnrootedTreeMLSearch

        public Tree basicUnrootedTreeMLSearch​(Alignment a,
                                              SubstitutionModel sm,
                                              boolean optimiseModel,
                                              AlgorithmCallback callback)
        Do a basic tree search using maximum likelihood on an unrooted tree space, without a given starting tree
        Parameters:
        a - The related alignment, OTU labels must match that of the tree
        sm - The related substitution model. The data type of the model should match that of the alignment. The parameters of this model may change if the optimise model is choosen.
        optimiseModel - If true the substitution model will be optimised concurrently with the tree. This will change in the input model.
        callback - An AlgorithmCallback object used to control and monitor the search progress
        Returns:
        The optimised tree
      • optimiseUnrootedFixed

        public static final Tree optimiseUnrootedFixed​(Tree tree,
                                                       Alignment alignment,
                                                       SubstitutionModel model,
                                                       boolean optimiseModel)
        Optimise the branches of a tree with regard to maximum likelihood, with no constraints on the branchlengths (as for an unrooted tree). The topology is unchanged. No topology changes are made!
        Parameters:
        tree - The tree (remains unchanged)
        alignment - The alignment (sequence names must match tree)
        model - The substitution model to use (is changed if optimisation of the model is choosen)
        optimiseModel - if true the model is also optimised, otherwise just the tree
        Returns:
        The optimised tree
      • optimiseUnrootedFixed

        public static final Tree optimiseUnrootedFixed​(Tree tree,
                                                       Alignment alignment,
                                                       SubstitutionModel model,
                                                       boolean optimiseModel,
                                                       AlgorithmCallback callback)
        Optimise the branches of a tree with regard to maximum likelihood, with no constraints on the branchlengths (as for an unrooted tree). The topology is unchanged. No topology changes are made!
        Parameters:
        tree - The tree (remains unchanged)
        alignment - The alignment (sequence names must match tree)
        model - The substitution model to use (is changed if optimisation of the model is choosen)
        optimiseModel - if true the model is also optimised, otherwise just the tree
        callback - An algorithm callback object for monitoring process of search algorithm
        Returns:
        The optimised tree
      • optimiseClockConstrainedFixed

        public static final Tree optimiseClockConstrainedFixed​(Tree tree,
                                                               Alignment alignment,
                                                               SubstitutionModel model,
                                                               boolean optimiseModel,
                                                               AlgorithmCallback callback)
        Optimise the branches of a tree with regard to maximum likelihood, with the contraints of a global molecular clock - that is, all the tips terminate at the same point. The topology is unchanged -no topology changes are made!
        Parameters:
        tree - The tree (remains unchanged) - should be rooted
        alignment - The alignment (sequence names must match tree)
        model - The substitution model to use (is changed if optimisation of the model is choosen)
        optimiseModel - if true the model is also optimised, otherwise just the tree
        callback - An algorithm callback object for monitoring process of search algorithm
        Returns:
        The optimised tree
      • getMatchingDataType

        public static final Alignment getMatchingDataType​(Alignment alignment,
                                                          SubstitutionModel model)
        Creates a new alignment that has a compatible data type with a substution model (needed for likelihood stuff)
        Parameters:
        alignment - The base alignment
        model - The substitution model that will be used with the alignment data
        Returns:
        An appropriately converted alignment
      • calculateLogLikelihood

        public static final double calculateLogLikelihood​(Tree tree,
                                                          Alignment alignment,
                                                          SubstitutionModel model)
        Calculate the log likelihood of a particular set of phylogenetic data
        Parameters:
        tree - The tree with set branch lengths
        alignment - The alignment (sequence names must match tree)
        model - The substitution model to use
        Returns:
        The log likelihood