bpp-phyl3  3.0.0
RHomogeneousMixedTreeLikelihood.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_LEGACY_LIKELIHOOD_RHOMOGENEOUSMIXEDTREELIKELIHOOD_H
6 #define BPP_PHYL_LEGACY_LIKELIHOOD_RHOMOGENEOUSMIXEDTREELIKELIHOOD_H
7 
10 
11 #include "../../Model/MixedTransitionModel.h"
12 #include "../../Model/SubstitutionModel.h"
14 
15 namespace bpp
16 {
28 {
29 private:
30  std::vector< std::shared_ptr<RHomogeneousTreeLikelihood>> treeLikelihoodsContainer_;
31  std::vector<double> probas_;
32 
33 public:
52  const Tree& tree,
53  std::shared_ptr<TransitionModelInterface> model,
54  std::shared_ptr<DiscreteDistributionInterface> rDist,
55  bool checkRooted = true,
56  bool verbose = true,
57  bool usePatterns = true);
58 
75  const Tree& tree,
77  std::shared_ptr<TransitionModelInterface> model,
78  std::shared_ptr<DiscreteDistributionInterface> rDist,
79  bool checkRooted = true,
80  bool verbose = true,
81  bool usePatterns = true);
82 
84 
86 
88 
90 
91 public:
99  void setData(const AlignmentDataInterface& sites);
100 
109  double getLikelihoodForASiteForARateClass(size_t site, size_t rateClass) const;
110  double getLogLikelihoodForASiteForARateClass(size_t site, size_t rateClass) const;
111  double getLikelihoodForASiteForARateClassForAState(size_t site, size_t rateClass, int state) const;
112  double getLogLikelihoodForASiteForARateClassForAState(size_t site, size_t rateClass, int state) const;
115 public:
116  // Specific methods:
117  void initialize();
118 
119  void fireParameterChanged(const ParameterList& params);
120 
121  void computeTreeLikelihood();
122 
123  virtual double getDLikelihoodForASiteForARateClass(size_t site, size_t rateClass) const;
124 
125  virtual void computeTreeDLikelihood(const std::string& variable);
126 
127  virtual double getD2LikelihoodForASiteForARateClass(size_t site, size_t rateClass) const;
128 
129  virtual void computeTreeD2Likelihood(const std::string& variable);
130 
131 protected:
137  virtual void computeSubtreeLikelihood(const Node* node); // Recursive method.
138 
139  virtual void computeDownSubtreeDLikelihood(const Node*);
140 
141  virtual void computeDownSubtreeD2Likelihood(const Node*);
142 
153 
159  virtual void displayLikelihood(const Node* node);
160 };
161 } // end of namespace bpp.
162 #endif // BPP_PHYL_LEGACY_LIKELIHOOD_RHOMOGENEOUSMIXEDTREELIKELIHOOD_H
const AlignmentDataInterface & data() const
Get the dataset for which the likelihood must be evaluated.
const Tree & tree() const
Get the tree (topology and branch lengths).
The phylogenetic node class.
Definition: Node.h:59
virtual double getDLikelihoodForASiteForARateClass(size_t site, size_t rateClass) const
double getLogLikelihoodForASiteForARateClassForAState(size_t site, size_t rateClass, int state) const
Get the logarithm of the likelihood for a site knowing its rate class and its ancestral state.
RHomogeneousMixedTreeLikelihood * clone() const
void computeTransitionProbabilitiesForNode(const Node *node)
This method is used by fireParameterChanged method.
virtual void computeTreeD2Likelihood(const std::string &variable)
virtual void computeSubtreeLikelihood(const Node *node)
Compute the likelihood for a subtree defined by the Tree::Node node.
double getLikelihoodForASiteForARateClassForAState(size_t site, size_t rateClass, int state) const
Get the likelihood for a site knowing its rate class and its ancestral state.
void computeAllTransitionProbabilities()
This method is used by fireParameterChanged method.
virtual double getD2LikelihoodForASiteForARateClass(size_t site, size_t rateClass) const
RHomogeneousMixedTreeLikelihood & operator=(const RHomogeneousMixedTreeLikelihood &lik)
void fireParameterChanged(const ParameterList &params)
std::vector< std::shared_ptr< RHomogeneousTreeLikelihood > > treeLikelihoodsContainer_
void setData(const AlignmentDataInterface &sites)
Set the dataset for which the likelihood must be evaluated.
double getLikelihoodForASiteForARateClass(size_t site, size_t rateClass) const
Get the likelihood for a site knowing its rate class.
virtual void displayLikelihood(const Node *node)
This method is mainly for debugging purpose.
virtual void computeTreeDLikelihood(const std::string &variable)
double getLogLikelihoodForASiteForARateClass(size_t site, size_t rateClass) const
Get the logarithm of the likelihood for a site knowing its rate class.
This class implement the 'traditional' way of computing likelihood for a tree.
Interface for phylogenetic tree objects.
Definition: Tree.h:115
Defines the basic types of data flow nodes.