bpp-phyl3  3.0.0
RNonHomogeneousMixedTreeLikelihood.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_RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_H
6 #define BPP_PHYL_LEGACY_LIKELIHOOD_RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_H
7 
10 
11 #include "../Model/MixedSubstitutionModelSet.h"
13 
14 namespace bpp
15 {
35 {
36 private:
41  std::map<int, std::vector< std::shared_ptr<RNonHomogeneousMixedTreeLikelihood>>> mvTreeLikelihoods_;
42 
53 
59 
63  bool main_;
64 
86  const Tree& tree,
87  std::shared_ptr<MixedSubstitutionModelSet> modelSet,
88  const MixedSubstitutionModelSet::HyperNode& hyperNode,
89  int upperNode,
90  std::shared_ptr<DiscreteDistributionInterface> rDist,
91  bool verbose,
92  bool usePatterns);
93 
116  const Tree& tree,
118  std::shared_ptr<MixedSubstitutionModelSet> modelSet,
119  const MixedSubstitutionModelSet::HyperNode& hyperNode,
120  int upperNode,
121  std::shared_ptr<DiscreteDistributionInterface> rDist,
122  bool verbose,
123  bool usePatterns);
124 
125 
129  void init(bool usePatterns);
130 
131 public:
149  const Tree& tree,
150  std::shared_ptr<MixedSubstitutionModelSet> modelSet,
151  std::shared_ptr<DiscreteDistributionInterface> rDist,
152  bool verbose = true,
153  bool usePatterns = true);
154 
171  const Tree& tree,
173  std::shared_ptr<MixedSubstitutionModelSet> modelSet,
174  std::shared_ptr<DiscreteDistributionInterface> rDist,
175  bool verbose = true,
176  bool usePatterns = true);
177 
179 
181 
183 
185 
186 public:
194  void setData(const AlignmentDataInterface& sites);
195 
196 public:
197  // Specific methods:
198  void initialize();
199 
200  void computeTreeDLikelihood(const std::string& variable);
201 
202  void computeTreeD2Likelihood(const std::string& variable);
203 
207  double getProbability() const;
208 
212  void setProbability(double x);
213 
219 
220 protected:
226  virtual void computeSubtreeLikelihood(const Node* node); // Recursive method.
227 
228  virtual void computeDownSubtreeDLikelihood(const Node*);
229 
230  virtual void computeDownSubtreeD2Likelihood(const Node*);
231 
232  void fireParameterChanged(const ParameterList& params);
233 
235 };
236 } // end of namespace bpp.
237 #endif // BPP_PHYL_LEGACY_LIKELIHOOD_RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_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
void computeTransitionProbabilitiesForNode(const Node *node)
Fill the pxy_, dpxy_ and d2pxy_ arrays for one node.
virtual void computeSubtreeLikelihood(const Node *node)
Compute the likelihood for a subtree defined by the Tree::Node node.
const MixedSubstitutionModelSet::HyperNode & getHyperNode()
returns the HyperNode describing the owned submodels.
RNonHomogeneousMixedTreeLikelihood & operator=(const RNonHomogeneousMixedTreeLikelihood &lik)
RNonHomogeneousMixedTreeLikelihood * clone() const
std::map< int, std::vector< std::shared_ptr< RNonHomogeneousMixedTreeLikelihood > > > mvTreeLikelihoods_
the map of the branch numbers to the vectors of the TreeLikelihoods for the expanded model on this br...
void setData(const AlignmentDataInterface &sites)
Set the dataset for which the likelihood must be evaluated.
double getProbability() const
returns the probability of this object in the hierarchy
void setProbability(double x)
sets the probability of this object in the hierarchy
MixedSubstitutionModelSet::HyperNode hyperNode_
A specific HyperNode in which the computation is processed. If the probability of this HyperNode is -...
bool main_
a flag to say if this object is the head of the hierarchy
int upperNode_
the number of the node under which tree the Treelikelihood is computed.
This class implement the 'traditional' way of computing likelihood for a tree, allowing for non-homog...
Interface for phylogenetic tree objects.
Definition: Tree.h:115
Defines the basic types of data flow nodes.