Package pal.eval
Class LikelihoodTool
- java.lang.Object
-
- pal.eval.LikelihoodTool
-
public final class LikelihoodTool extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LikelihoodTool()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
calculateLogLikelihood(Tree tree, Alignment alignment, SubstitutionModel model)
Calculate the log likelihood of a particular set of phylogenetic datastatic Alignment
getMatchingDataType(Alignment alignment, SubstitutionModel model)
Creates a new alignment that has a compatible data type with a substution model (needed for likelihood stuff)static 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.static 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.static 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.static 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.static 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).
-
-
-
Method Detail
-
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 lengthsalignment
- 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 lengthsalignment
- The alignment (sequence names must match tree)model
- The substitution model to useoptimiseModel
- 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 lengthsalignment
- The alignment (sequence names must match tree)model
- The substitution model to usetocd
- The sample information object relating sequences to time or orderoptimiseModel
- if true the model is optimised as wellrateStore
- 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 lengthsalignment
- The alignment (sequence names must match tree)model
- The substitution model to usetocd
- The sample information object relating sequences to time or orderoptimiseModel
- if true the model is optimised as wellrateStore
- 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 lengthsalignment
- The alignment (sequence names must match tree)model
- The substitution model to usetocd
- The sample information object relating sequences to time or orderoptimiseModel
- if true the model is optimised as wellrateChangeTimes
- 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 alignmentmodel
- The substitution model that will be used with the alignment data- Returns:
- An appropriately converted alignment
-
-