bpp-phyl  2.2.0
RNonHomogeneousMixedTreeLikelihood.h
Go to the documentation of this file.
1 //
2 // File: RNonHomogeneousMixedLikelihood.h
3 // Created by: Laurent Gueguen
4 // Created on: jeudi 11 novembre 2010, à 07h 56
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for phylogenetic data analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_H_
41 #define _RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_H_
42 
44 #include "../Model/MixedSubstitutionModelSet.h"
45 
46 #include <Bpp/Numeric/VectorTools.h>
47 #include <Bpp/Numeric/Prob/DiscreteDistribution.h>
48 
49 using namespace std;
50 namespace bpp
51 {
71 {
72 private:
73 
80  map<int, vector<RNonHomogeneousMixedTreeLikelihood*> > mvTreeLikelihoods_;
81 
93 
101 
107  bool main_;
108 
131  MixedSubstitutionModelSet* modelSet,
132  const MixedSubstitutionModelSet::HyperNode& hyperNode,
133  int upperNode,
134  DiscreteDistribution* rDist,
135  bool verbose,
136  bool usePatterns);
137 
161  const SiteContainer& data,
162  MixedSubstitutionModelSet* modelSet,
163  const MixedSubstitutionModelSet::HyperNode& hyperNode,
164  int upperNode,
165  DiscreteDistribution* rDist,
166  bool verbose,
167  bool usePatterns);
168 
169 
175  void init(bool usePatterns);
176 
177 
178 public:
196  const Tree& tree,
197  MixedSubstitutionModelSet* modelSet,
198  DiscreteDistribution* rDist,
199  bool verbose = true,
200  bool usePatterns = true)
201  throw (Exception);
202 
219  const SiteContainer& data,
220  MixedSubstitutionModelSet* modelSet,
221  DiscreteDistribution* rDist,
222  bool verbose = true,
223  bool usePatterns = true)
224  throw (Exception);
225 
227 
229 
231 
233 
234 public:
242  void setData(const SiteContainer& sites) throw (Exception);
243 
244 public:
245  // Specific methods:
246  void initialize() throw (Exception);
247 
248  void computeTreeDLikelihood(const string& variable);
249 
250  void computeTreeD2Likelihood(const string& variable);
251 
257  double getProbability() const;
258 
264  void setProbability(double x);
265 
271  const MixedSubstitutionModelSet::HyperNode& getHyperNode() { return hyperNode_;}
272 protected:
273 
274 
280  virtual void computeSubtreeLikelihood(const Node* node); // Recursive method.
281 
282  virtual void computeDownSubtreeDLikelihood(const Node*);
283 
284  virtual void computeDownSubtreeD2Likelihood(const Node*);
285 
286  void fireParameterChanged(const ParameterList& params);
287 
288  void computeTransitionProbabilitiesForNode(const Node* node);
289 
290 };
291 } // end of namespace bpp.
292 
293 #endif // _RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_H_
294 
This class implement the &#39;traditional&#39; way of computing likelihood for a tree, allowing for non-homog...
bool main_
a flag to say if this object is the head of the hierarchy
STL namespace.
Interface for phylogenetic tree objects.
Definition: Tree.h:148
map< int, vector< RNonHomogeneousMixedTreeLikelihood * > > mvTreeLikelihoods_
the map of the branch numbers to the vectors of the TreeLikelihoods for the expanded model on this br...
MixedSubstitutionModelSet::HyperNode hyperNode_
A specific HyperNode in which the computation is processed. If the probability of this HyperNode is -...
Substitution models manager for Mixed Substitution Models. This class inherits from SubstitutionModel...
The phylogenetic node class.
Definition: Node.h:90
int upperNode_
the number of the node under which tree the Treelikelihood is computed.