bpp-phyl  2.2.0
AbstractDiscreteRatesAcrossSitesTreeLikelihood.h
Go to the documentation of this file.
1 //
2 // File: AbstractDiscreteRatesAcrossSitesTreeLikelihood.h
3 // Created by: Julien Dutheil
4 // Created on: Wed Jun 15 09:42 2005
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 _ABSTRACTDISCRETERATEACROSSSITESTREELIKELIHOOD_H_
41 #define _ABSTRACTDISCRETERATEACROSSSITESTREELIKELIHOOD_H_
42 
43 #include "AbstractTreeLikelihood.h"
45 #include "../Model/SubstitutionModel.h"
46 
47 namespace bpp
48 {
49 
59 {
60  protected:
61  DiscreteDistribution* rateDistribution_;
62 
63  public:
65  DiscreteDistribution* rDist,
66  bool verbose = true
67  ) throw (Exception);
68 
73  {}
74 
77  {
80  return *this;
81  }
82 
84 
85  public:
86 
94  double getLikelihoodForASiteForAState (size_t site, int state) const;
95  double getLogLikelihoodForASiteForAState(size_t site, int state) const;
96  ParameterList getDerivableParameters() const;
97  ParameterList getNonDerivableParameters() const;
98  VVdouble getTransitionProbabilities(int nodeId, size_t siteIndex) const;
106  const DiscreteDistribution* getRateDistribution() const { return rateDistribution_; }
107  DiscreteDistribution* getRateDistribution() { return rateDistribution_; }
108  size_t getNumberOfClasses() const { return rateDistribution_->getNumberOfCategories(); }
109  ParameterList getRateDistributionParameters() const;
114  VVdouble getPosteriorProbabilitiesOfEachRate() const;
115  Vdouble getRateWithMaxPostProbOfEachSite() const;
116  std::vector<size_t> getRateClassWithMaxPostProbOfEachSite() const;
117  Vdouble getPosteriorRateOfEachSite() const;
131  static void resetLikelihoodArray(VVVdouble & likelihoodArray);
132 
138  static void displayLikelihoodArray(const VVVdouble & likelihoodArray);
139 
142 };
143 
144 } //end of namespace bpp.
145 
146 #endif //_ABSTRACTDISCRETERATEACROSSSITESTREELIKELIHOOD_H_
147 
Vdouble getRateWithMaxPostProbOfEachSite() const
Get the posterior rate (the one with maximum posterior probability) for each site.
Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface.
double getLogLikelihoodForASiteForAState(size_t site, int state) const
Get the logarithm of the likelihood for a site and for a state.
const DiscreteDistribution * getRateDistribution() const
Get the rate distribution used for the computation.
ParameterList getRateDistributionParameters() const
Get the parameters associated to the rate distirbution.
double getLikelihoodForASiteForAState(size_t site, int state) const
Get the likelihood for a site and for a state.
VVdouble getTransitionProbabilities(int nodeId, size_t siteIndex) const
Retrieves all Pij(t) for a particular branch, defined by the upper node and site. ...
static void displayLikelihoodArray(const VVVdouble &likelihoodArray)
Print the likelihood array to terminal (debugging tool).
VVdouble getPosteriorProbabilitiesOfEachRate() const
Get the posterior probability for each site of belonging to a particular rate class.
AbstractTreeLikelihood & operator=(const AbstractTreeLikelihood &lik)
DiscreteDistribution * getRateDistribution()
Get the rate distribution used for the computation.
Partial implementation of the TreeLikelihood interface.
Vdouble getPosteriorRateOfEachSite() const
Get the posterior rate, i.e. averaged over all classes and weighted with posterior probabilities...
Interface for rate across sites (RAS) implementation.
VVVdouble getLogLikelihoodForEachSiteForEachRateClassForEachState() const
Get the logarithm of the likelihood for each site and each rate class and each state.
std::vector< size_t > getRateClassWithMaxPostProbOfEachSite() const
Get the posterior rate class (the one with maximum posterior probability) for each site...
static void resetLikelihoodArray(VVVdouble &likelihoodArray)
Set all conditional likelihoods to 1.
ParameterList getNonDerivableParameters() const
All non derivable parameters.
AbstractDiscreteRatesAcrossSitesTreeLikelihood & operator=(const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
VVVdouble getLikelihoodForEachSiteForEachRateClassForEachState() const
Get the likelihood for each site and each rate class and each state.
AbstractDiscreteRatesAcrossSitesTreeLikelihood(DiscreteDistribution *rDist, bool verbose=true)
VVdouble getLogLikelihoodForEachSiteForEachRateClass() const
Get the logarithm of the likelihood for each site and each rate class.
VVdouble getLikelihoodForEachSiteForEachRateClass() const
Get the likelihood for each site and each rate class.