bpp-phyl  2.2.0
bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood Class Referenceabstract

Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface. More...

#include <Bpp/Phyl/Likelihood/AbstractDiscreteRatesAcrossSitesTreeLikelihood.h>

+ Inheritance diagram for bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood:
+ Collaboration diagram for bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood:

Public Member Functions

 AbstractDiscreteRatesAcrossSitesTreeLikelihood (DiscreteDistribution *rDist, bool verbose=true) throw (Exception)
 
 AbstractDiscreteRatesAcrossSitesTreeLikelihood (const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
 
AbstractDiscreteRatesAcrossSitesTreeLikelihoodoperator= (const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
 
virtual ~AbstractDiscreteRatesAcrossSitesTreeLikelihood ()
 
TreeLikelihoodclone () const =0
 
virtual void setData (const SiteContainer &sites)=0
 Set the dataset for which the likelihood must be evaluated. More...
 
virtual TreeLikelihoodDatagetLikelihoodData ()=0
 
virtual const TreeLikelihoodDatagetLikelihoodData () const =0
 
virtual double getLikelihoodForASite (size_t site) const =0
 Get the likelihood for a site. More...
 
virtual double getLogLikelihoodForASite (size_t site) const =0
 Get the logarithm of the likelihood for a site. More...
 
virtual double getLikelihood () const =0
 Get the likelihood for the whole dataset. More...
 
virtual double getLogLikelihood () const =0
 Get the logarithm of the likelihood for the whole dataset. More...
 
virtual size_t getNumberOfStates () const =0
 
virtual int getAlphabetStateAsInt (size_t i) const =0
 
virtual std::string getAlphabetStateAsChar (size_t i) const =0
 
virtual const std::vector< int > & getAlphabetStates () const =0
 
virtual double getLikelihoodForASiteForARateClass (size_t site, size_t rateClass) const =0
 Get the likelihood for a site knowing its rate class. More...
 
virtual double getLogLikelihoodForASiteForARateClass (size_t site, size_t rateClass) const =0
 Get the logarithm of the likelihood for a site knowing its rate class. More...
 
virtual double getLikelihoodForASiteForARateClassForAState (size_t site, size_t rateClass, int state) const =0
 Get the likelihood for a site knowing its rate class and its ancestral state. More...
 
virtual double getLogLikelihoodForASiteForARateClassForAState (size_t site, size_t rateClass, int state) const =0
 Get the logarithm of the likelihood for a site knowing its rate class and its ancestral state. More...
 
virtual VVVdouble getTransitionProbabilitiesPerRateClass (int nodeId, size_t siteIndex) const =0
 Retrieves all Pij(t) for a particular branch, defined by the upper node. More...
 
The TreeLikelihood interface.

Other methods are implemented in the AbstractTreeLikelihood class.

double getLikelihoodForASiteForAState (size_t site, int state) const
 Get the likelihood for a site and for a state. More...
 
double getLogLikelihoodForASiteForAState (size_t site, int state) const
 Get the logarithm of the likelihood for a site and for a state. More...
 
ParameterList getDerivableParameters () const
 All derivable parameters. More...
 
ParameterList getNonDerivableParameters () const
 All non derivable parameters. More...
 
VVdouble getTransitionProbabilities (int nodeId, size_t siteIndex) const
 Retrieves all Pij(t) for a particular branch, defined by the upper node and site. More...
 
The DiscreteRatesAcrossSites interface implementation:
const DiscreteDistribution * getRateDistribution () const
 Get the rate distribution used for the computation. More...
 
DiscreteDistribution * getRateDistribution ()
 Get the rate distribution used for the computation. More...
 
size_t getNumberOfClasses () const
 Get the number of classes. More...
 
ParameterList getRateDistributionParameters () const
 Get the parameters associated to the rate distirbution. More...
 
VVdouble getLikelihoodForEachSiteForEachRateClass () const
 Get the likelihood for each site and each rate class. More...
 
VVdouble getLogLikelihoodForEachSiteForEachRateClass () const
 Get the logarithm of the likelihood for each site and each rate class. More...
 
VVVdouble getLikelihoodForEachSiteForEachRateClassForEachState () const
 Get the likelihood for each site and each rate class and each state. More...
 
VVVdouble getLogLikelihoodForEachSiteForEachRateClassForEachState () const
 Get the logarithm of the likelihood for each site and each rate class and each state. More...
 
VVdouble getPosteriorProbabilitiesOfEachRate () const
 Get the posterior probability for each site of belonging to a particular rate class. More...
 
Vdouble getRateWithMaxPostProbOfEachSite () const
 Get the posterior rate (the one with maximum posterior probability) for each site. More...
 
std::vector< size_t > getRateClassWithMaxPostProbOfEachSite () const
 Get the posterior rate class (the one with maximum posterior probability) for each site. More...
 
Vdouble getPosteriorRateOfEachSite () const
 Get the posterior rate, i.e. averaged over all classes and weighted with posterior probabilities, for each site. More...
 
The TreeLikelihood interface.
const SiteContainer * getData () const
 Get the dataset for which the likelihood must be evaluated. More...
 
const Alphabet * getAlphabet () const
 Get the alphabet associated to the dataset. More...
 
Vdouble getLikelihoodForEachSite () const
 Get the likelihood for each site. More...
 
Vdouble getLogLikelihoodForEachSite () const
 Get the logarithm of the likelihood for each site. More...
 
VVdouble getLikelihoodForEachSiteForEachState () const
 Get the likelihood for each site and for each state. More...
 
VVdouble getLogLikelihoodForEachSiteForEachState () const
 Get the logarithm of the likelihood for each site and for each state. More...
 
size_t getNumberOfSites () const
 Get the number of sites in the dataset. More...
 
const TreegetTree () const
 Get the tree (topology and branch lengths). More...
 
void enableDerivatives (bool yn)
 Tell if derivatives must be computed. More...
 
void enableFirstOrderDerivatives (bool yn)
 
bool enableFirstOrderDerivatives () const
 
void enableSecondOrderDerivatives (bool yn)
 
bool enableSecondOrderDerivatives () const
 
bool isInitialized () const
 
void initialize () throw (Exception)
 Init the likelihood object. More...
 
Retrieve some particular parameters subsets.
virtual ParameterList getBranchLengthsParameters () const =0
 Get the branch lengths parameters. More...
 
virtual ParameterList getSubstitutionModelParameters () const =0
 Get the parameters associated to substitution model(s). More...
 
virtual const SubstitutionModelgetSubstitutionModel (int nodeId, size_t siteIndex) const =0 throw (NodeNotFoundException)
 Get the substitution model associated to a given node and alignment column. More...
 
virtual SubstitutionModelgetSubstitutionModel (int nodeId, size_t siteIndex)=0 throw (NodeNotFoundException)
 Get the substitution model associated to a given node and alignment column. More...
 
virtual ConstBranchModelIteratorgetNewBranchModelIterator (int nodeId) const =0
 
virtual ConstSiteModelIteratorgetNewSiteModelIterator (size_t siteIndex) const =0
 
virtual size_t getSiteIndex (size_t site) const =0 throw (IndexOutOfBoundsException)
 Get the index (used for inner computations) of a given site (original alignment column). More...
 
virtual const std::vector< double > & getRootFrequencies (size_t siteIndex) const =0
 Get the values of the frequencies for each state in the alphabet at the root node. More...
 

Static Public Member Functions

Generic tools to deal with likelihood arrays
static void resetLikelihoodArray (VVVdouble &likelihoodArray)
 Set all conditional likelihoods to 1. More...
 
static void displayLikelihoodArray (const VVVdouble &likelihoodArray)
 Print the likelihood array to terminal (debugging tool). More...
 

Protected Attributes

DiscreteDistribution * rateDistribution_
 
const SiteContainer * data_
 
TreeTemplate< Node > * tree_
 
bool computeFirstOrderDerivatives_
 
bool computeSecondOrderDerivatives_
 
bool initialized_
 

Detailed Description

Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface.

It contains a pointer toward a DiscreteDistribution object. This object may be shared by several instances of the class.

Definition at line 56 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Constructor & Destructor Documentation

◆ AbstractDiscreteRatesAcrossSitesTreeLikelihood() [1/2]

AbstractDiscreteRatesAcrossSitesTreeLikelihood::AbstractDiscreteRatesAcrossSitesTreeLikelihood ( DiscreteDistribution *  rDist,
bool  verbose = true 
)
throw (Exception
)

◆ AbstractDiscreteRatesAcrossSitesTreeLikelihood() [2/2]

bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::AbstractDiscreteRatesAcrossSitesTreeLikelihood ( const AbstractDiscreteRatesAcrossSitesTreeLikelihood tl)
inline

◆ ~AbstractDiscreteRatesAcrossSitesTreeLikelihood()

virtual bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::~AbstractDiscreteRatesAcrossSitesTreeLikelihood ( )
inlinevirtual

Member Function Documentation

◆ clone()

◆ displayLikelihoodArray()

void AbstractDiscreteRatesAcrossSitesTreeLikelihood::displayLikelihoodArray ( const VVVdouble &  likelihoodArray)
static

◆ enableDerivatives()

void bpp::AbstractTreeLikelihood::enableDerivatives ( bool  yn)
inlinevirtualinherited

Tell if derivatives must be computed.

This methods calls the enableFirstOrderDerivatives and enableSecondOrderDerivatives.

Parameters
ynYes or no.

Implements bpp::TreeLikelihood.

Definition at line 292 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::computeFirstOrderDerivatives_, and bpp::AbstractTreeLikelihood::computeSecondOrderDerivatives_.

Referenced by AbstractDiscreteRatesAcrossSitesTreeLikelihood(), and bpp::DistanceEstimation::computeMatrix().

◆ enableFirstOrderDerivatives() [1/2]

void bpp::AbstractTreeLikelihood::enableFirstOrderDerivatives ( bool  yn)
inlineinherited

◆ enableFirstOrderDerivatives() [2/2]

bool bpp::AbstractTreeLikelihood::enableFirstOrderDerivatives ( ) const
inlineinherited

◆ enableSecondOrderDerivatives() [1/2]

void bpp::AbstractTreeLikelihood::enableSecondOrderDerivatives ( bool  yn)
inlineinherited

◆ enableSecondOrderDerivatives() [2/2]

bool bpp::AbstractTreeLikelihood::enableSecondOrderDerivatives ( ) const
inlineinherited

◆ getAlphabet()

const Alphabet* bpp::AbstractTreeLikelihood::getAlphabet ( ) const
inlinevirtualinherited

Get the alphabet associated to the dataset.

Returns
the alphabet associated to the dataset.

Implements bpp::TreeLikelihood.

Definition at line 285 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_.

◆ getAlphabetStateAsChar()

virtual std::string bpp::TreeLikelihood::getAlphabetStateAsChar ( size_t  i) const
pure virtualinherited
Returns
the alphabet state corresponding to the given model state.

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

◆ getAlphabetStateAsInt()

virtual int bpp::TreeLikelihood::getAlphabetStateAsInt ( size_t  i) const
pure virtualinherited
Returns
the alphabet state corresponding to the given model state.

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

◆ getAlphabetStates()

virtual const std::vector<int>& bpp::TreeLikelihood::getAlphabetStates ( ) const
pure virtualinherited
Returns
the alphabet states corresponding to all model states.

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

◆ getBranchLengthsParameters()

virtual ParameterList bpp::TreeLikelihood::getBranchLengthsParameters ( ) const
pure virtualinherited

Get the branch lengths parameters.

Returns
A ParameterList with all branch lengths.

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

Referenced by bpp::OptimizationTools::ScaleFunction::ScaleFunction().

◆ getData()

const SiteContainer* bpp::AbstractTreeLikelihood::getData ( ) const
inlinevirtualinherited

Get the dataset for which the likelihood must be evaluated.

Returns
A pointer toward the site container where the sequences are stored.

Implements bpp::TreeLikelihood.

Definition at line 284 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_.

Referenced by bpp::RNonHomogeneousMixedTreeLikelihood::init().

◆ getDerivableParameters()

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getDerivableParameters ( ) const
virtual

All derivable parameters.

Usually, this contains all branch lengths parameters.

Returns
A ParameterList.

Implements bpp::TreeLikelihood.

Reimplemented in bpp::RHomogeneousClockTreeLikelihood.

Definition at line 73 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLikelihood()

virtual double bpp::TreeLikelihood::getLikelihood ( ) const
pure virtualinherited

◆ getLikelihoodData() [1/2]

virtual TreeLikelihoodData* bpp::TreeLikelihood::getLikelihoodData ( )
pure virtualinherited

◆ getLikelihoodData() [2/2]

virtual const TreeLikelihoodData* bpp::TreeLikelihood::getLikelihoodData ( ) const
pure virtualinherited

◆ getLikelihoodForASite()

virtual double bpp::TreeLikelihood::getLikelihoodForASite ( size_t  site) const
pure virtualinherited

◆ getLikelihoodForASiteForARateClass()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForARateClass ( size_t  site,
size_t  rateClass 
) const
pure virtualinherited

Get the likelihood for a site knowing its rate class.

Parameters
siteThe site index.
rateClassThe rate class index.
Returns
The likelihood for the specified site and rate class.

Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

◆ getLikelihoodForASiteForARateClassForAState()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForARateClassForAState ( size_t  site,
size_t  rateClass,
int  state 
) const
pure virtualinherited

Get the likelihood for a site knowing its rate class and its ancestral state.

Parameters
siteThe site index.
rateClassThe rate class index.
stateThe ancestral state.
Returns
The likelihood for the specified site and rate class and ancestral state.

Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

◆ getLikelihoodForASiteForAState()

double AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForAState ( size_t  site,
int  state 
) const
virtual

Get the likelihood for a site and for a state.

Parameters
siteThe site index to analyse.
stateThe state to consider.
Returns
The likelihood for site site and state state.

Implements bpp::TreeLikelihood.

Definition at line 111 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLikelihoodForEachSite()

Vdouble AbstractTreeLikelihood::getLikelihoodForEachSite ( ) const
virtualinherited

Get the likelihood for each site.

Returns
A vector with all likelihoods for each site.

Implements bpp::TreeLikelihood.

Definition at line 46 of file AbstractTreeLikelihood.cpp.

References bpp::TreeLikelihood::getLikelihoodForASite(), and bpp::AbstractTreeLikelihood::getNumberOfSites().

◆ getLikelihoodForEachSiteForEachRateClass()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForEachSiteForEachRateClass ( ) const
virtual

Get the likelihood for each site and each rate class.

Returns
A two-dimension vector with all likelihoods.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 93 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLikelihoodForEachSiteForEachRateClassForEachState()

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForEachSiteForEachRateClassForEachState ( ) const
virtual

Get the likelihood for each site and each rate class and each state.

Returns
A three-dimension vector with all likelihoods.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 156 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLikelihoodForEachSiteForEachState()

VVdouble AbstractTreeLikelihood::getLikelihoodForEachSiteForEachState ( ) const
virtualinherited

Get the likelihood for each site and for each state.

Returns
A 2d vector with all likelihoods for each site and for each state.

Implements bpp::TreeLikelihood.

Definition at line 64 of file AbstractTreeLikelihood.cpp.

References bpp::TreeLikelihood::getLikelihoodForASiteForAState(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and bpp::TreeLikelihood::getNumberOfStates().

◆ getLogLikelihood()

virtual double bpp::TreeLikelihood::getLogLikelihood ( ) const
pure virtualinherited

Get the logarithm of the likelihood for the whole dataset.

Returns
The logarithm of the likelihood of the dataset.

Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

◆ getLogLikelihoodForASite()

virtual double bpp::TreeLikelihood::getLogLikelihoodForASite ( size_t  site) const
pure virtualinherited

Get the logarithm of the likelihood for a site.

Parameters
siteThe site index to analyse.
Returns
The logarithm of the likelihood for site site.

Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

Referenced by bpp::AbstractTreeLikelihood::getLogLikelihoodForEachSite().

◆ getLogLikelihoodForASiteForARateClass()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForASiteForARateClass ( size_t  site,
size_t  rateClass 
) const
pure virtualinherited

Get the logarithm of the likelihood for a site knowing its rate class.

Parameters
siteThe site index.
rateClassThe rate class index.
Returns
The logarithm of the likelihood for the specified site and rate class.

Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

◆ getLogLikelihoodForASiteForARateClassForAState()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState ( size_t  site,
size_t  rateClass,
int  state 
) const
pure virtualinherited

Get the logarithm of the likelihood for a site knowing its rate class and its ancestral state.

Parameters
siteThe site index.
rateClassThe rate class index.
stateThe ancestral state.
Returns
The logarithm of the likelihood for the specified site and rate class and ancestral state..

Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

◆ getLogLikelihoodForASiteForAState()

double AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForASiteForAState ( size_t  site,
int  state 
) const
virtual

Get the logarithm of the likelihood for a site and for a state.

Parameters
siteThe site index to analyse.
stateThe state to consider.
Returns
The logarithm of the likelihood for site site and state state.

Implements bpp::TreeLikelihood.

Definition at line 124 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLogLikelihoodForEachSite()

Vdouble AbstractTreeLikelihood::getLogLikelihoodForEachSite ( ) const
virtualinherited

Get the logarithm of the likelihood for each site.

Returns
A vector with all log likelihoods for each site.

Implements bpp::TreeLikelihood.

Definition at line 55 of file AbstractTreeLikelihood.cpp.

References bpp::TreeLikelihood::getLogLikelihoodForASite(), and bpp::AbstractTreeLikelihood::getNumberOfSites().

◆ getLogLikelihoodForEachSiteForEachRateClass()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForEachSiteForEachRateClass ( ) const
virtual

Get the logarithm of the likelihood for each site and each rate class.

Returns
A two-dimension vector with all log likelihoods: V[i][j] = likelihood of site i and rate class j.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 138 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLogLikelihoodForEachSiteForEachRateClassForEachState()

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForEachSiteForEachRateClassForEachState ( ) const
virtual

Get the logarithm of the likelihood for each site and each rate class and each state.

Returns
A three-dimension vector with all log likelihoods: V[i][j][k} = likelihood of site i and rate class j and state k.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 179 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getLogLikelihoodForEachSiteForEachState()

VVdouble AbstractTreeLikelihood::getLogLikelihoodForEachSiteForEachState ( ) const
virtualinherited

Get the logarithm of the likelihood for each site and for each state.

Returns
A 2d vector with all log likelihoods for each site and for each state.

Implements bpp::TreeLikelihood.

Definition at line 81 of file AbstractTreeLikelihood.cpp.

References bpp::TreeLikelihood::getLogLikelihoodForASiteForAState(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and bpp::TreeLikelihood::getNumberOfStates().

◆ getNewBranchModelIterator()

virtual ConstBranchModelIterator* bpp::TreeLikelihood::getNewBranchModelIterator ( int  nodeId) const
pure virtualinherited

◆ getNewSiteModelIterator()

virtual ConstSiteModelIterator* bpp::TreeLikelihood::getNewSiteModelIterator ( size_t  siteIndex) const
pure virtualinherited

◆ getNonDerivableParameters()

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNonDerivableParameters ( ) const
virtual

All non derivable parameters.

Usually, this contains all substitution model parameters and rate distribution.

Returns
A ParameterList.

Implements bpp::TreeLikelihood.

Reimplemented in bpp::RHomogeneousClockTreeLikelihood.

Definition at line 82 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getNumberOfClasses()

size_t bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses ( ) const
inlinevirtual

Get the number of classes.

Returns
The Number of classes.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 108 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ getNumberOfSites()

size_t bpp::AbstractTreeLikelihood::getNumberOfSites ( ) const
inlinevirtualinherited

◆ getNumberOfStates()

◆ getPosteriorProbabilitiesOfEachRate()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorProbabilitiesOfEachRate ( ) const
virtual

Get the posterior probability for each site of belonging to a particular rate class.

Returns
A two-dimension vector with all posterior probabilities: V[i][j] = probablity for site i of belonging to rate class j.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 202 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getPosteriorRateOfEachSite()

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorRateOfEachSite ( ) const
virtual

Get the posterior rate, i.e. averaged over all classes and weighted with posterior probabilities, for each site.

Returns
A vector with all rates.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 220 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getRateClassWithMaxPostProbOfEachSite()

vector< size_t > AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateClassWithMaxPostProbOfEachSite ( ) const
virtual

Get the posterior rate class (the one with maximum posterior probability) for each site.

Returns
A vector with all rate classes indexes.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 239 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getRateDistribution() [1/2]

const DiscreteDistribution* bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistribution ( ) const
inlinevirtual

Get the rate distribution used for the computation.

Returns
A const pointer toward the rate distribution of this instance.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 106 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ getRateDistribution() [2/2]

DiscreteDistribution* bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistribution ( )
inlinevirtual

Get the rate distribution used for the computation.

Returns
A pointer toward the rate distribution of this instance.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 107 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ getRateDistributionParameters()

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistributionParameters ( ) const
virtual

Get the parameters associated to the rate distirbution.

Returns
A ParameterList object with all rate distribution parameters.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Reimplemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.

Definition at line 64 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::getRateDistributionParameters(), and bpp::AbstractNonHomogeneousTreeLikelihood::getRateDistributionParameters().

◆ getRateWithMaxPostProbOfEachSite()

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateWithMaxPostProbOfEachSite ( ) const
virtual

Get the posterior rate (the one with maximum posterior probability) for each site.

Returns
A vector with all rate classes indexes.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 253 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getRootFrequencies()

virtual const std::vector<double>& bpp::TreeLikelihood::getRootFrequencies ( size_t  siteIndex) const
pure virtualinherited

Get the values of the frequencies for each state in the alphabet at the root node.

For reversible models, these are the equilibrium frequencies. For non-reversible models, these usually are distinct parameters.

For models without site partitioning, the set of frequencies is the same for all positions. For partition models, the frequencies may differ from one site to another.

Parameters
siteIndexThe index of the alignment position.
See also
getSiteIndex
Returns
A vector with ancestral frequencies for each state in the alphabet;

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

◆ getSiteIndex()

virtual size_t bpp::TreeLikelihood::getSiteIndex ( size_t  site) const
throw (IndexOutOfBoundsException
)
pure virtualinherited

Get the index (used for inner computations) of a given site (original alignment column).

Parameters
siteAn alignment position.
Returns
The site index corresponding to the given input alignment position.

Implemented in bpp::RHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousTreeLikelihood.

◆ getSubstitutionModel() [1/2]

virtual const SubstitutionModel* bpp::TreeLikelihood::getSubstitutionModel ( int  nodeId,
size_t  siteIndex 
) const
throw (NodeNotFoundException
)
pure virtualinherited

Get the substitution model associated to a given node and alignment column.

Parameters
nodeIdThe id of the request node.
siteIndexThe index of the alignment position.
See also
getSiteIndex
Returns
A pointer toward the corresponding model.
Exceptions
NodeNotFoundExceptionThis exception may be thrown if the node is not found (depending on the implementation).

Implemented in bpp::AbstractHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::NonHomogeneousTreeLikelihood, bpp::HomogeneousTreeLikelihood, and bpp::SitePartitionHomogeneousTreeLikelihood.

◆ getSubstitutionModel() [2/2]

virtual SubstitutionModel* bpp::TreeLikelihood::getSubstitutionModel ( int  nodeId,
size_t  siteIndex 
)
throw (NodeNotFoundException
)
pure virtualinherited

Get the substitution model associated to a given node and alignment column.

Parameters
nodeIdThe id of the request node.
siteIndexThe index of the alignment position.
See also
getSiteIndex
Returns
A pointer toward the corresponding model.
Exceptions
NodeNotFoundExceptionThis exception may be thrown if the node is not found (depending on the implementation).

Implemented in bpp::AbstractHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::NonHomogeneousTreeLikelihood, bpp::HomogeneousTreeLikelihood, and bpp::SitePartitionHomogeneousTreeLikelihood.

◆ getSubstitutionModelParameters()

virtual ParameterList bpp::TreeLikelihood::getSubstitutionModelParameters ( ) const
pure virtualinherited

Get the parameters associated to substitution model(s).

Returns
A ParameterList.

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

◆ getTransitionProbabilities()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getTransitionProbabilities ( int  nodeId,
size_t  siteIndex 
) const
virtual

Retrieves all Pij(t) for a particular branch, defined by the upper node and site.

These intermediate results may be used by other methods.

Parameters
nodeIdThe node defining the branch of interest.
siteIndexThe index of the alignment position.
See also
getSiteIndex
Returns
An array of dimension 2, where a[x][y] is the probability of substituting from x to y.

Implements bpp::TreeLikelihood.

Definition at line 311 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

◆ getTransitionProbabilitiesPerRateClass()

virtual VVVdouble bpp::DiscreteRatesAcrossSitesTreeLikelihood::getTransitionProbabilitiesPerRateClass ( int  nodeId,
size_t  siteIndex 
) const
pure virtualinherited

Retrieves all Pij(t) for a particular branch, defined by the upper node.

These intermediate results may be used by other methods.

Parameters
nodeIdThe node defining the branch of interest.
siteIndexThe position in the alignment.
Returns
An array of dimension 3, where a[c][x][y] is the probability of substituting from x to y while being in rate class c.

Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, and bpp::TwoTreeLikelihood.

◆ getTree()

const Tree& bpp::AbstractTreeLikelihood::getTree ( ) const
inlinevirtualinherited

Get the tree (topology and branch lengths).

Returns
The tree of this TreeLikelihood object.

Implements bpp::TreeLikelihood.

Definition at line 291 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::tree_.

Referenced by bpp::NNIHomogeneousTreeLikelihood::getTopology(), and bpp::RNonHomogeneousMixedTreeLikelihood::init().

◆ initialize()

void bpp::AbstractTreeLikelihood::initialize ( )
throw (Exception
)
inlinevirtualinherited

Init the likelihood object.

This method is used to initialize all parameters. It is typically called after the constructor and the setData method. It contains virtual methods that can't be called in the constructor.

Exceptions
Exceptionif something bad happened, for instance if no data are associated to the likelihood function.

Implements bpp::TreeLikelihood.

Reimplemented in bpp::RNonHomogeneousMixedTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

Definition at line 298 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::initialized_.

◆ isInitialized()

bool bpp::AbstractTreeLikelihood::isInitialized ( ) const
inlinevirtualinherited

◆ operator=()

◆ resetLikelihoodArray()

◆ setData()

virtual void bpp::TreeLikelihood::setData ( const SiteContainer &  sites)
pure virtualinherited

Member Data Documentation

◆ computeFirstOrderDerivatives_

◆ computeSecondOrderDerivatives_

◆ data_

◆ initialized_

◆ rateDistribution_

DiscreteDistribution* bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_
protected

Definition at line 61 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::applyParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::applyParameters(), bpp::TwoTreeLikelihood::applyParameters(), bpp::DRHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::AbstractHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::AbstractNonHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::TwoTreeLikelihood::computeTreeD2Likelihood(), bpp::DRHomogeneousTreeLikelihood::computeTreeD2LikelihoodAtNode(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeD2LikelihoodAtNode(), bpp::TwoTreeLikelihood::computeTreeDLikelihood(), bpp::DRHomogeneousTreeLikelihood::computeTreeDLikelihoodAtNode(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeDLikelihoodAtNode(), bpp::TwoTreeLikelihood::computeTreeLikelihood(), bpp::DRHomogeneousTreeLikelihood::fireParameterChanged(), bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::TwoTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASite(), getNumberOfClasses(), getRateDistribution(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), bpp::AbstractHomogeneousTreeLikelihood::initParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::initParameters(), bpp::TwoTreeLikelihood::initParameters(), and operator=().

◆ tree_

TreeTemplate<Node>* bpp::AbstractTreeLikelihood::tree_
mutableprotectedinherited

Definition at line 226 of file AbstractTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::AbstractHomogeneousTreeLikelihood(), bpp::AbstractNonHomogeneousTreeLikelihood::AbstractNonHomogeneousTreeLikelihood(), bpp::AbstractTreeLikelihood::AbstractTreeLikelihood(), bpp::DRHomogeneousTreeLikelihood::computeLikelihoodAtNode(), bpp::DRNonHomogeneousTreeLikelihood::computeLikelihoodAtNode(), bpp::DRHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeDLikelihood(), bpp::DRHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::DRHomogeneousTreeLikelihood::DRHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::DRNonHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), bpp::AbstractHomogeneousTreeLikelihood::getNewSiteModelIterator(), bpp::AbstractTreeLikelihood::getTree(), bpp::DRHomogeneousTreeLikelihood::operator=(), bpp::DRNonHomogeneousTreeLikelihood::operator=(), bpp::AbstractHomogeneousTreeLikelihood::operator=(), bpp::RHomogeneousTreeLikelihood::operator=(), bpp::RNonHomogeneousTreeLikelihood::operator=(), bpp::AbstractNonHomogeneousTreeLikelihood::operator=(), bpp::AbstractTreeLikelihood::operator=(), bpp::RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::RNonHomogeneousTreeLikelihood(), and bpp::AbstractTreeLikelihood::~AbstractTreeLikelihood().


The documentation for this class was generated from the following files: