Package pal.eval

Class LikelihoodTool

java.lang.Object
pal.eval.LikelihoodTool

public final class LikelihoodTool extends Object
  • Constructor Details

    • LikelihoodTool

      public LikelihoodTool()
  • Method Details

    • 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
    • optimiseUnrooted

      public static final Tree optimiseUnrooted(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.
      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
    • optimiseClockConstrained

      public static final Tree optimiseClockConstrained(Tree tree, Alignment alignment, SubstitutionModel model, boolean optimiseModel)
      Optimise the branches of a tree with regard to maximum likelihood, with a molecular clock assumption, that is, constrained such that all tips are contemporaneous, the tree is treated as rooted. The topology is unchanged.
      Parameters:
      tree - The tree with set branch lengths
      alignment - The alignment (sequence names must match tree)
      model - The substitution model to use
      optimiseModel - if true the model is optimised as well
      Returns:
      The resulting optimised tree
    • optimiseSRDT

      public static final Tree optimiseSRDT(Tree tree, Alignment alignment, SubstitutionModel model, TimeOrderCharacterData tocd, boolean optimiseModel, double[] rateStore)
      Optimise the branches of a tree with regard to maximum likelihood, with under an assumption of a molecular clock with serially sampled data and a single mutation rate parameter. This is equivalent to the TipDate model. The topology is unchanged.
      Parameters:
      tree - The tree with set branch lengths
      alignment - The alignment (sequence names must match tree)
      model - The substitution model to use
      tocd - The sample information object relating sequences to time or order
      optimiseModel - if true the model is optimised as well
      rateStore - storage space for the mutation rate, the initial value is used as the starting rate in the optimisation
      Returns:
      The resulting optimised tree
    • optimiseMRDT

      public static final Tree optimiseMRDT(Tree tree, Alignment alignment, SubstitutionModel model, TimeOrderCharacterData tocd, boolean optimiseModel, double[] rateStore)
      Optimise the branches of a tree with regard to maximum likelihood, with under an assumption of a molecular clock with serially sampled data and multiple mutation rate parameters, mu - one for each sampling interval. The topology is unchanged.
      Parameters:
      tree - The tree with set branch lengths
      alignment - The alignment (sequence names must match tree)
      model - The substitution model to use
      tocd - The sample information object relating sequences to time or order
      optimiseModel - if true the model is optimised as well
      rateStore - storage space for the mus, the initial values are used as the starting mus in the optimisation
      Returns:
      The resulting optimised tree
    • optimiseMRDT

      public static final Tree optimiseMRDT(Tree tree, Alignment alignment, SubstitutionModel model, TimeOrderCharacterData tocd, boolean optimiseModel, double[] rateChangeTimes, double[] rateStore)
      Optimise the branches of a tree with regard to maximum likelihood, with under an assumption of a molecular clock with serially sampled data and multiple mutation rate parameters, mu, over general time intervals. The topology is unchanged.
      Parameters:
      tree - The tree with set branch lengths
      alignment - The alignment (sequence names must match tree)
      model - The substitution model to use
      tocd - The sample information object relating sequences to time or order
      optimiseModel - if true the model is optimised as well
      rateChangeTimes - the times (as related to the sample information) of when a new mu is used (should be of length mus.length -1 )
      rateStore - storage space for the mus, the initial values are used as the starting mus in the optimisation
      Returns:
      The resulting 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