bpp-phyl3  3.0.0
bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood Class Referenceabstract

Partial implementation of the DiscreteRatesAcrossSitesTreeLikelihood interface. More...

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

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

Public Member Functions

 AbstractDiscreteRatesAcrossSitesTreeLikelihood (std::shared_ptr< DiscreteDistributionInterface > rDist, bool verbose=true)
 
 AbstractDiscreteRatesAcrossSitesTreeLikelihood (const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
 
AbstractDiscreteRatesAcrossSitesTreeLikelihoodoperator= (const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
 
virtual ~AbstractDiscreteRatesAcrossSitesTreeLikelihood ()
 
TreeLikelihoodInterfaceclone () const override=0
 
virtual Clonableclone () const=0
 
virtual void setData (const AlignmentDataInterface &sites)=0
 Set the dataset for which the likelihood must be evaluated. More...
 
virtual TreeLikelihoodDatalikelihoodData ()=0
 
virtual const TreeLikelihoodDatalikelihoodData () 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 getSecondOrderDerivative (const std::string &variable) const=0
 
virtual double getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const=0
 
virtual double d2f (const std::string &variable, const ParameterList &parameters)
 
virtual double d2f (const std::string &variable1, const std::string &variable2, const ParameterList &parameters)
 
virtual double getFirstOrderDerivative (const std::string &variable) const=0
 
virtual double df (const std::string &variable, const ParameterList &parameters)
 
virtual void setParameters (const ParameterList &parameters)=0
 
virtual double getValue () const=0
 
virtual double f (const ParameterList &parameters)
 
virtual bool hasParameter (const std::string &name) const=0
 
bool hasParameter (const std::string &name) const override
 
virtual const ParameterListgetParameters () const=0
 
const ParameterListgetParameters () const override
 
virtual const Parameterparameter (const std::string &name) const=0
 
const Parameterparameter (const std::string &name) const override
 
virtual double getParameterValue (const std::string &name) const=0
 
double getParameterValue (const std::string &name) const override
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
void setAllParametersValues (const ParameterList &parameters) override
 
virtual void setParameterValue (const std::string &name, double value)=0
 
void setParameterValue (const std::string &name, double value) override
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
void setParametersValues (const ParameterList &parameters) override
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
bool matchParametersValues (const ParameterList &parameters) override
 
virtual void removeConstraint (const std::string &name)=0
 
void removeConstraint (const std::string &name) override
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
virtual size_t getNumberOfParameters () const=0
 
size_t getNumberOfParameters () const override
 
virtual void setNamespace (const std::string &prefix)=0
 
void setNamespace (const std::string &prefix) override
 
virtual std::string getNamespace () const=0
 
std::string getNamespace () const override
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
virtual void fireParameterChanged (const ParameterList &parameters)
 
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:
std::shared_ptr< const DiscreteDistributionInterfacegetRateDistribution () const
 Get the rate distribution used for the computation. More...
 
std::shared_ptr< DiscreteDistributionInterfacegetRateDistribution ()
 Get the rate distribution used for the computation. More...
 
const DiscreteDistributionInterfacerateDistribution () const
 Get the rate distribution used for the computation. More...
 
DiscreteDistributionInterfacerateDistribution ()
 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 distribution. More...
 
VVdouble getLikelihoodPerSitePerRateClass () const
 Get the likelihood for each site and each rate class. More...
 
VVdouble getLogLikelihoodPerSitePerRateClass () const
 Get the logarithm of the likelihood for each site and each rate class. More...
 
VVVdouble getLikelihoodPerSitePerRateClassPerState () const
 Get the likelihood for each site and each rate class and each state. More...
 
VVVdouble getLogLikelihoodPerSitePerRateClassPerState () const
 Get the logarithm of the likelihood for each site and each rate class and each state. More...
 
VVdouble getPosteriorProbabilitiesPerRate () const
 Get the posterior probability for each site of belonging to a particular rate class. More...
 
Vdouble getRateWithMaxPostProbPerSite () const
 Get the posterior rate (the one with maximum posterior probability) for each site. More...
 
std::vector< size_t > getRateClassWithMaxPostProbPerSite () const
 Get the posterior rate class (the one with maximum posterior probability) for each site. More...
 
Vdouble getPosteriorRatePerSite () const
 Get the posterior rate, i.e. averaged over all classes and weighted with posterior probabilities, for each site. More...
 
The TreeLikelihood interface.
bool hasLikelihoodData () const
 
const AlignmentDataInterfacedata () const
 Get the dataset for which the likelihood must be evaluated. More...
 
std::shared_ptr< const AlphabetgetAlphabet () const
 Get the alphabet associated to the dataset. More...
 
Vdouble getLikelihoodPerSite () const
 Get the likelihood for each site. More...
 
Vdouble getLogLikelihoodPerSite () const
 Get the logarithm of the likelihood for each site. More...
 
VVdouble getLikelihoodPerSitePerState () const
 Get the likelihood for each site and for each state. More...
 
VVdouble getLogLikelihoodPerSitePerState () 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 Treetree () 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 ()
 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 std::shared_ptr< const TransitionModelInterfacegetModelForSite (int nodeId, size_t siteIndex) const =0
 Get the substitution model associated to a given node and alignment column. More...
 
virtual std::shared_ptr< TransitionModelInterfacegetModelForSite (int nodeId, size_t siteIndex)=0
 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
 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 Member Functions

virtual ParameterListgetParameters_ ()=0
 
ParameterListgetParameters_ () override
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
virtual void addParameter_ (Parameter *parameter)
 
virtual void addParameters_ (const ParameterList &parameters)
 
virtual void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
virtual void shareParameters_ (const ParameterList &parameters)
 
virtual void includeParameters_ (const ParameterList &parameters)
 
virtual void deleteParameter_ (size_t index)
 
virtual void deleteParameter_ (std::string &name)
 
virtual void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 

Protected Attributes

std::shared_ptr< DiscreteDistributionInterfacerateDistribution_
 
std::unique_ptr< const AlignmentDataInterfacedata_
 
std::shared_ptr< TreeTemplate< Node > > tree_
 
bool computeFirstOrderDerivatives_
 
bool computeSecondOrderDerivatives_
 
bool initialized_
 

Private Attributes

ParameterList parameters_
 
std::string prefix_
 

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 21 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Constructor & Destructor Documentation

◆ AbstractDiscreteRatesAcrossSitesTreeLikelihood() [1/2]

AbstractDiscreteRatesAcrossSitesTreeLikelihood::AbstractDiscreteRatesAcrossSitesTreeLikelihood ( std::shared_ptr< DiscreteDistributionInterface rDist,
bool  verbose = true 
)

◆ AbstractDiscreteRatesAcrossSitesTreeLikelihood() [2/2]

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

◆ ~AbstractDiscreteRatesAcrossSitesTreeLikelihood()

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

Member Function Documentation

◆ clone()

◆ data()

◆ 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::TreeLikelihoodInterface.

Definition at line 270 of file AbstractTreeLikelihood.h.

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

Referenced by AbstractDiscreteRatesAcrossSitesTreeLikelihood().

◆ enableFirstOrderDerivatives() [1/2]

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

◆ enableFirstOrderDerivatives() [2/2]

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

◆ enableSecondOrderDerivatives() [1/2]

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

◆ enableSecondOrderDerivatives() [2/2]

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

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractTreeLikelihood::getAlphabet ( ) const
inlinevirtualinherited

Get the alphabet associated to the dataset.

Returns
the alphabet associated to the dataset.

Implements bpp::TreeLikelihoodInterface.

Definition at line 263 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_.

◆ getAlphabetStateAsChar()

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

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

◆ getAlphabetStateAsInt()

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

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

◆ getAlphabetStates()

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

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

◆ getBranchLengthsParameters()

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

Get the branch lengths parameters.

Returns
A ParameterList with all branch lengths.

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

Referenced by getDerivableParameters().

◆ getDerivableParameters()

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getDerivableParameters ( ) const
virtual

All derivable parameters.

Usually, this contains all branch lengths parameters.

Returns
A ParameterList.

Implements bpp::TreeLikelihoodInterface.

Definition at line 37 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::TreeLikelihoodInterface::getBranchLengthsParameters(), and bpp::AbstractTreeLikelihood::initialized_.

◆ getLikelihood()

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

◆ getLikelihoodForASite()

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

Get the likelihood for a site.

Parameters
siteThe site index to analyse.
Returns
The likelihood for site site.

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

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

◆ getLikelihoodForASiteForARateClass()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

Referenced by getLikelihoodPerSitePerRateClass().

◆ getLikelihoodForASiteForARateClassForAState()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

Referenced by getLikelihoodForASiteForAState(), getLikelihoodPerSitePerRateClassPerState(), and getLogLikelihoodForASiteForAState().

◆ 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::TreeLikelihoodInterface.

Definition at line 75 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::getLikelihoodForASiteForARateClassForAState(), getNumberOfClasses(), and rateDistribution_.

◆ getLikelihoodPerSite()

Vdouble AbstractTreeLikelihood::getLikelihoodPerSite ( ) const
virtualinherited

Get the likelihood for each site.

Returns
A vector with all likelihoods for each site.

Implements bpp::TreeLikelihoodInterface.

Definition at line 11 of file AbstractTreeLikelihood.cpp.

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

Referenced by getPosteriorProbabilitiesPerRate(), and getPosteriorRatePerSite().

◆ getLikelihoodPerSitePerRateClass()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodPerSitePerRateClass ( ) const
virtual

◆ getLikelihoodPerSitePerRateClassPerState()

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodPerSitePerRateClassPerState ( ) const
virtual

◆ getLikelihoodPerSitePerState()

VVdouble AbstractTreeLikelihood::getLikelihoodPerSitePerState ( ) 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::TreeLikelihoodInterface.

Definition at line 35 of file AbstractTreeLikelihood.cpp.

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

◆ getLogLikelihood()

virtual double bpp::TreeLikelihoodInterface::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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

◆ getLogLikelihoodForASite()

virtual double bpp::TreeLikelihoodInterface::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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

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

◆ getLogLikelihoodForASiteForARateClass()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

Referenced by getLogLikelihoodPerSitePerRateClass().

◆ getLogLikelihoodForASiteForARateClassForAState()

virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.

Referenced by getLogLikelihoodPerSitePerRateClassPerState().

◆ 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::TreeLikelihoodInterface.

Definition at line 88 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::getLikelihoodForASiteForARateClassForAState(), getNumberOfClasses(), bpp::log(), and rateDistribution_.

◆ getLogLikelihoodPerSite()

Vdouble AbstractTreeLikelihood::getLogLikelihoodPerSite ( ) const
virtualinherited

Get the logarithm of the likelihood for each site.

Returns
A vector with all log likelihoods for each site.

Implements bpp::TreeLikelihoodInterface.

Definition at line 23 of file AbstractTreeLikelihood.cpp.

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

◆ getLogLikelihoodPerSitePerRateClass()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodPerSitePerRateClass ( ) 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::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 102 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::getLogLikelihoodForASiteForARateClass(), getNumberOfClasses(), and bpp::AbstractTreeLikelihood::getNumberOfSites().

◆ getLogLikelihoodPerSitePerRateClassPerState()

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodPerSitePerRateClassPerState ( ) 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::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 143 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::getLogLikelihoodForASiteForARateClassForAState(), getNumberOfClasses(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and bpp::TreeLikelihoodInterface::getNumberOfStates().

◆ getLogLikelihoodPerSitePerState()

VVdouble AbstractTreeLikelihood::getLogLikelihoodPerSitePerState ( ) 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::TreeLikelihoodInterface.

Definition at line 52 of file AbstractTreeLikelihood.cpp.

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

◆ getModelForSite() [1/2]

virtual std::shared_ptr<const TransitionModelInterface> bpp::TreeLikelihoodInterface::getModelForSite ( int  nodeId,
size_t  siteIndex 
) const
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.

Implemented in bpp::NonHomogeneousTreeLikelihood, and bpp::HomogeneousTreeLikelihood.

◆ getModelForSite() [2/2]

virtual std::shared_ptr<TransitionModelInterface> bpp::TreeLikelihoodInterface::getModelForSite ( int  nodeId,
size_t  siteIndex 
)
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::NonHomogeneousTreeLikelihood, and bpp::HomogeneousTreeLikelihood.

◆ getNewBranchModelIterator()

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

◆ getNewSiteModelIterator()

virtual ConstSiteModelIterator* bpp::TreeLikelihoodInterface::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::TreeLikelihoodInterface.

Definition at line 46 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::ParameterList::addParameters(), getRateDistributionParameters(), bpp::TreeLikelihoodInterface::getSubstitutionModelParameters(), and bpp::AbstractTreeLikelihood::initialized_.

◆ getNumberOfClasses()

◆ getNumberOfSites()

◆ getNumberOfStates()

◆ getPosteriorProbabilitiesPerRate()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorProbabilitiesPerRate ( ) 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] = probability for site i of belonging to rate class j.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 166 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::AbstractTreeLikelihood::getLikelihoodPerSite(), getLikelihoodPerSitePerRateClass(), getNumberOfClasses(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and rateDistribution_.

◆ getPosteriorRatePerSite()

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorRatePerSite ( ) 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::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 184 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::AbstractTreeLikelihood::getLikelihoodPerSite(), getLikelihoodPerSitePerRateClass(), getNumberOfClasses(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and rateDistribution_.

◆ getRateClassWithMaxPostProbPerSite()

vector< size_t > AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateClassWithMaxPostProbPerSite ( ) 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::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 203 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References getLikelihoodPerSitePerRateClass(), and bpp::AbstractTreeLikelihood::getNumberOfSites().

◆ getRateDistribution() [1/2]

std::shared_ptr<DiscreteDistributionInterface> bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistribution ( )
inlinevirtual

Get the rate distribution used for the computation.

Returns
A pointer toward the rate distribution of this instance.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 75 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ getRateDistribution() [2/2]

std::shared_ptr<const DiscreteDistributionInterface> 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::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 70 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ getRateDistributionParameters()

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistributionParameters ( ) const
virtual

◆ getRateWithMaxPostProbPerSite()

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateWithMaxPostProbPerSite ( ) 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::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 217 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References getLikelihoodPerSitePerRateClass(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and rateDistribution_.

◆ getRootFrequencies()

virtual const std::vector<double>& bpp::TreeLikelihoodInterface::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, and bpp::AbstractHomogeneousTreeLikelihood.

Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().

◆ getSiteIndex()

virtual size_t bpp::TreeLikelihoodInterface::getSiteIndex ( size_t  site) const
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::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.

Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().

◆ getSubstitutionModelParameters()

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

Get the parameters associated to substitution model(s).

Returns
A ParameterList.

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

Referenced by getNonDerivableParameters().

◆ 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::TreeLikelihoodInterface.

Definition at line 275 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References getNumberOfClasses(), bpp::TreeLikelihoodInterface::getNumberOfStates(), bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::getTransitionProbabilitiesPerRateClass(), and rateDistribution_.

◆ getTransitionProbabilitiesPerRateClass()

virtual VVVdouble bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::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, and bpp::AbstractHomogeneousTreeLikelihood.

Referenced by getTransitionProbabilities().

◆ hasLikelihoodData()

bool bpp::AbstractTreeLikelihood::hasLikelihoodData ( ) const
inlinevirtualinherited
Returns
True if the TreeLikelihood object has a LikelihoodData.

Implements bpp::TreeLikelihoodInterface.

Definition at line 261 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_.

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

◆ initialize()

void bpp::AbstractTreeLikelihood::initialize ( )
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::TreeLikelihoodInterface.

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

Definition at line 276 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::initialized_.

◆ isInitialized()

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

◆ likelihoodData() [1/2]

virtual const TreeLikelihoodData& bpp::TreeLikelihoodInterface::likelihoodData ( ) const
pure virtualinherited

◆ likelihoodData() [2/2]

virtual TreeLikelihoodData& bpp::TreeLikelihoodInterface::likelihoodData ( )
pure virtualinherited

◆ operator=()

◆ rateDistribution() [1/2]

DiscreteDistributionInterface& bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution ( )
inlinevirtual

Get the rate distribution used for the computation.

Returns
A reference toward the rate distribution of this instance.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 85 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ rateDistribution() [2/2]

const DiscreteDistributionInterface& bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution ( ) const
inlinevirtual

Get the rate distribution used for the computation.

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

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 80 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References rateDistribution_.

◆ resetLikelihoodArray()

◆ setData()

◆ tree()

Member Data Documentation

◆ computeFirstOrderDerivatives_

◆ computeSecondOrderDerivatives_

◆ data_

◆ initialized_

◆ rateDistribution_

std::shared_ptr<DiscreteDistributionInterface> bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_
protected

Definition at line 26 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::applyParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::applyParameters(), bpp::DRHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::AbstractHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::AbstractNonHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::DRHomogeneousTreeLikelihood::computeTreeD2LikelihoodAtNode(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeD2LikelihoodAtNode(), bpp::DRHomogeneousTreeLikelihood::computeTreeDLikelihoodAtNode(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeDLikelihoodAtNode(), bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::DRHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASite(), getLikelihoodForASiteForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASite(), getLogLikelihoodForASiteForAState(), getNumberOfClasses(), getPosteriorProbabilitiesPerRate(), getPosteriorRatePerSite(), getRateDistribution(), getRateDistributionParameters(), getRateWithMaxPostProbPerSite(), bpp::DRNonHomogeneousTreeLikelihood::getSecondOrderDerivative(), getTransitionProbabilities(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), bpp::DRHomogeneousTreeLikelihood::init_(), bpp::DRNonHomogeneousTreeLikelihood::init_(), bpp::RHomogeneousTreeLikelihood::init_(), bpp::RNonHomogeneousTreeLikelihood::init_(), bpp::AbstractNonHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::initParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::initParameters(), operator=(), rateDistribution(), and bpp::NNIHomogeneousTreeLikelihood::testNNI().

◆ tree_

std::shared_ptr< TreeTemplate<Node> > bpp::AbstractTreeLikelihood::tree_
mutableprotectedinherited

Definition at line 209 of file AbstractTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::AbstractHomogeneousTreeLikelihood(), bpp::AbstractNonHomogeneousTreeLikelihood::AbstractNonHomogeneousTreeLikelihood(), bpp::AbstractTreeLikelihood::AbstractTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeLikelihoodAtNode(), bpp::DRHomogeneousTreeLikelihood::computeLikelihoodAtNode(), bpp::DRHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::DRHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::RHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::NNIHomogeneousTreeLikelihood::doNNI(), bpp::DRHomogeneousTreeLikelihood::DRHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::DRNonHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::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::DRNonHomogeneousTreeLikelihood::getSecondOrderDerivative(), bpp::DRHomogeneousTreeLikelihood::init_(), bpp::DRNonHomogeneousTreeLikelihood::init_(), bpp::RHomogeneousTreeLikelihood::init_(), bpp::RNonHomogeneousTreeLikelihood::init_(), bpp::AbstractNonHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::operator=(), bpp::AbstractNonHomogeneousTreeLikelihood::operator=(), bpp::AbstractTreeLikelihood::operator=(), bpp::DRHomogeneousTreeLikelihood::operator=(), bpp::DRNonHomogeneousTreeLikelihood::operator=(), bpp::RHomogeneousTreeLikelihood::operator=(), bpp::RNonHomogeneousTreeLikelihood::operator=(), bpp::RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::RNonHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::setData(), bpp::RHomogeneousTreeLikelihood::setData(), bpp::RNonHomogeneousTreeLikelihood::setData(), bpp::DRHomogeneousTreeLikelihood::setData(), bpp::NNIHomogeneousTreeLikelihood::testNNI(), and bpp::AbstractTreeLikelihood::tree().


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