5 #ifndef BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTHOMOGENEOUSTREELIKELIHOOD_H
6 #define BPP_PHYL_LEGACY_LIKELIHOOD_ABSTRACTHOMOGENEOUSTREELIKELIHOOD_H
28 public ConstSiteModelIterator
43 throw Exception(
"AbstractHomogeneousTreeLikelihood::ConstHomogeneousSiteModelIterator::next(). No more site in the set.");
52 std::shared_ptr<TransitionModelInterface>
model_;
55 mutable std::map<int, VVVdouble>
pxy_;
57 mutable std::map<int, VVVdouble>
dpxy_;
59 mutable std::map<int, VVVdouble>
d2pxy_;
87 std::shared_ptr<TransitionModelInterface> model,
88 std::shared_ptr<DiscreteDistributionInterface> rDist,
89 bool checkRooted =
true,
113 std::shared_ptr<TransitionModelInterface> model,
114 std::shared_ptr<DiscreteDistributionInterface> rDist,
168 std::shared_ptr<const TransitionModelInterface>
getModel()
const {
return model_; }
169 std::shared_ptr<const TransitionModelInterface>
getModel(
int nodeId,
size_t siteIndex)
const {
return model_; }
172 std::shared_ptr<TransitionModelInterface>
getModel(
int nodeId,
size_t siteIndex) {
return model_; }
174 void setModel(std::shared_ptr<TransitionModelInterface> model);
185 return std::dynamic_pointer_cast<const SubstitutionModelInterface>(
model_);
197 virtual std::shared_ptr<const SubstitutionModelInterface>
getSubstitutionModel(
int nodeId,
size_t siteIndex)
const
199 return std::dynamic_pointer_cast<const SubstitutionModelInterface>(
model_);
Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface.
ParameterList getRateDistributionParameters() const
Get the parameters associated to the rate distribution.
ConstSiteModelDescription * next()
ConstNoPartitionSiteModelDescription siteModelDescription_
ConstHomogeneousSiteModelIterator(const Tree &tree, std::shared_ptr< const TransitionModelInterface > model)
Partial implementation for homogeneous model of the TreeLikelihood interface.
virtual void initParameters()
This builds the parameters list from all parametrizable objects, i.e. substitution model,...
VVVdouble getTransitionProbabilitiesPerRateClass(int nodeId, size_t siteIndex) const
Retrieves all Pij(t) for a particular branch, defined by the upper node.
size_t getNumberOfStates() const
virtual void setMaximumBranchLength(double maximum)
virtual void setMinimumBranchLength(double minimum)
virtual std::shared_ptr< const SubstitutionModelInterface > getSubstitutionModel(int nodeId, size_t siteIndex) const
Get a SubstitutionModel pointer toward the model associated to this instance, if possible.
std::vector< Node * > nodes_
Pointer toward all nodes in the tree.
virtual void initBranchLengthsParameters(bool verbose=true)
std::shared_ptr< TransitionModelInterface > getModel(int nodeId, size_t siteIndex)
void setModel(std::shared_ptr< TransitionModelInterface > model)
std::shared_ptr< TransitionModelInterface > getModel()
virtual double getMinimumBranchLength() const
virtual void applyParameters()
All parameters are stored in a parameter list. This function apply these parameters to the substituti...
std::shared_ptr< TransitionModelInterface > model_
const std::vector< double > & getRootFrequencies(size_t siteIndex) const
Get the values of the frequencies for each state in the alphabet at the root node.
ParameterList brLenParameters_
ConstBranchModelIterator * getNewBranchModelIterator(int nodeId) const
virtual std::shared_ptr< const SubstitutionModelInterface > getSubstitutionModel() const
Get a SubstitutionModel pointer toward the model associated to this instance, if possible.
const std::vector< int > & getAlphabetStates() const
virtual ~AbstractHomogeneousTreeLikelihood()
ParameterList getBranchLengthsParameters() const
Get the branch lengths parameters.
virtual double getMaximumBranchLength() const
virtual void computeTransitionProbabilitiesForNode(const Node *node)
Fill the pxy_, dpxy_ and d2pxy_ arrays for one node.
ParameterList getRateDistributionParameters() const
Get the parameters associated to the rate distribution.
std::shared_ptr< ConstraintInterface > brLenConstraint_
std::string getAlphabetStateAsChar(size_t i) const
std::shared_ptr< const TransitionModelInterface > getModel(int nodeId, size_t siteIndex) const
std::vector< double > rootFreqs_
void init_(const Tree &tree, std::shared_ptr< TransitionModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rDist, bool checkRooted, bool verbose)
Method called by constructor.
ConstSiteModelIterator * getNewSiteModelIterator(size_t siteIndex) const
ParameterList getSubstitutionModelParameters() const
Get the parameters associated to substitution model(s).
int getAlphabetStateAsInt(size_t i) const
AbstractHomogeneousTreeLikelihood(const Tree &tree, std::shared_ptr< TransitionModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rDist, bool checkRooted=true, bool verbose=true)
void initialize()
Init the likelihood object.
std::map< int, VVVdouble > dpxy_
std::map< int, VVVdouble > pxy_
std::shared_ptr< const TransitionModelInterface > getModel() const
std::map< int, VVVdouble > d2pxy_
virtual void computeAllTransitionProbabilities()
Fill the pxy_, dpxy_ and d2pxy_ arrays for all nodes.
AbstractHomogeneousTreeLikelihood & operator=(const AbstractHomogeneousTreeLikelihood &lik)
Assignation operator.
const Tree & tree() const
Get the tree (topology and branch lengths).
std::shared_ptr< TreeTemplate< Node > > tree_
Specialization of the TreeLikelihood interface for the Homogeneous case.
The phylogenetic node class.
Iterates through all models used for all sites on a given branch.
A pair of SubstitutionModel / BranchIterator.
Iterates through all models used for all branches on a given site.
Interface for phylogenetic tree objects.
std::string toString(T t)
Defines the basic types of data flow nodes.
std::vector< VVdouble > VVVdouble