Package pal.eval
Class LikelihoodTool
java.lang.Object
pal.eval.LikelihoodTool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final double
calculateLogLikelihood
(Tree tree, Alignment alignment, SubstitutionModel model) Calculate the log likelihood of a particular set of phylogenetic datastatic 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)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.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.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.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.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).
-
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 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
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
-