bpp-phyl  2.4.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)
 
 AbstractDiscreteRatesAcrossSitesTreeLikelihood (const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
 
AbstractDiscreteRatesAcrossSitesTreeLikelihoodoperator= (const AbstractDiscreteRatesAcrossSitesTreeLikelihood &tl)
 
virtual ~AbstractDiscreteRatesAcrossSitesTreeLikelihood ()
 
TreeLikelihoodclone () const =0
 
virtual Clonableclone () 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 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
 
virtual const ParameterListgetParameters () const =0
 
const ParameterListgetParameters () const
 
virtual const ParametergetParameter (const std::string &name) const =0
 
const ParametergetParameter (const std::string &name) const
 
virtual double getParameterValue (const std::string &name) const =0
 
double getParameterValue (const std::string &name) const
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
void setAllParametersValues (const ParameterList &parameters)
 
virtual void setParameterValue (const std::string &name, double value)=0
 
void setParameterValue (const std::string &name, double value)
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
void setParametersValues (const ParameterList &parameters)
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
bool matchParametersValues (const ParameterList &parameters)
 
virtual size_t getNumberOfParameters () const =0
 
size_t getNumberOfParameters () const
 
virtual void setNamespace (const std::string &prefix)=0
 
void setNamespace (const std::string &prefix)
 
virtual std::string getNamespace () const =0
 
std::string getNamespace () const
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const =0
 
std::string getParameterNameWithoutNamespace (const std::string &name) const
 
const std::shared_ptr< Parameter > & getSharedParameter (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:
const DiscreteDistributiongetRateDistribution () const
 Get the rate distribution used for the computation. More...
 
DiscreteDistributiongetRateDistribution ()
 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 SiteContainergetData () const
 Get the dataset for which the likelihood must be evaluated. More...
 
const AlphabetgetAlphabet () 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 ()
 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 TransitionModelgetModelForSite (int nodeId, size_t siteIndex) const =0
 Get the substitution model associated to a given node and alignment column. More...
 
virtual TransitionModelgetModelForSite (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

const std::shared_ptr< Parameter > & getSharedParameter (size_t i) const
 
std::shared_ptr< Parameter > & getSharedParameter (size_t i)
 
virtual void addParameter_ (Parameter *parameter)
 
virtual void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
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
 
ParameterListgetParameters_ ()
 

Protected Attributes

DiscreteDistributionrateDistribution_
 
const SiteContainerdata_
 
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::AbstractDiscreteRatesAcrossSitesTreeLikelihood ( DiscreteDistribution rDist,
bool  verbose = true 
)
bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::AbstractDiscreteRatesAcrossSitesTreeLikelihood ( const AbstractDiscreteRatesAcrossSitesTreeLikelihood tl)
inline
virtual bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::~AbstractDiscreteRatesAcrossSitesTreeLikelihood ( )
inlinevirtual

Member Function Documentation

void AbstractDiscreteRatesAcrossSitesTreeLikelihood::displayLikelihoodArray ( const VVVdouble likelihoodArray)
static
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 296 of file AbstractTreeLikelihood.h.

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

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

Implements bpp::DerivableSecondOrder.

Definition at line 297 of file AbstractTreeLikelihood.h.

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

Implements bpp::DerivableSecondOrder.

Definition at line 298 of file AbstractTreeLikelihood.h.

bool bpp::AbstractTreeLikelihood::enableSecondOrderDerivatives ( ) const
inlinevirtualinherited
const Alphabet* bpp::AbstractTreeLikelihood::getAlphabet ( ) const
inlinevirtualinherited
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.

Referenced by bpp::TreeLikelihood::~TreeLikelihood().

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.

Referenced by bpp::TreeLikelihood::~TreeLikelihood().

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.

Referenced by bpp::TreeLikelihood::~TreeLikelihood().

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 288 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_.

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

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 72 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

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

Referenced by ~AbstractDiscreteRatesAcrossSitesTreeLikelihood().

virtual double bpp::TreeLikelihood::getLikelihood ( ) const
pure virtualinherited
virtual const TreeLikelihoodData* bpp::TreeLikelihood::getLikelihoodData ( ) const
pure virtualinherited
virtual double bpp::TreeLikelihood::getLikelihoodForASite ( size_t  site) const
pure virtualinherited
virtual double bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForARateClass ( size_t  site,
size_t  rateClass 
) const
pure virtualinherited
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::TwoTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

Referenced by getLikelihoodForASiteForAState(), getLikelihoodForEachSiteForEachRateClassForEachState(), getLogLikelihoodForASiteForAState(), and bpp::DiscreteRatesAcrossSitesTreeLikelihood::~DiscreteRatesAcrossSitesTreeLikelihood().

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 110 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), getNumberOfClasses(), bpp::DiscreteDistribution::getProbability(), and rateDistribution_.

Referenced by ~AbstractDiscreteRatesAcrossSitesTreeLikelihood().

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().

Referenced by bpp::AbstractTreeLikelihood::getAlphabet(), getPosteriorProbabilitiesOfEachRate(), and getPosteriorRateOfEachSite().

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForEachSiteForEachRateClass ( ) const
virtual
VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForEachSiteForEachRateClassForEachState ( ) const
virtual
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().

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

virtual double bpp::TreeLikelihood::getLogLikelihood ( ) const
pure virtualinherited
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(), and bpp::TreeLikelihood::~TreeLikelihood().

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

Referenced by getLogLikelihoodForEachSiteForEachRateClass(), and bpp::DiscreteRatesAcrossSitesTreeLikelihood::~DiscreteRatesAcrossSitesTreeLikelihood().

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

Referenced by getLogLikelihoodForEachSiteForEachRateClassForEachState(), and bpp::DiscreteRatesAcrossSitesTreeLikelihood::~DiscreteRatesAcrossSitesTreeLikelihood().

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 123 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForARateClassForAState(), getNumberOfClasses(), bpp::DiscreteDistribution::getProbability(), and rateDistribution_.

Referenced by ~AbstractDiscreteRatesAcrossSitesTreeLikelihood().

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().

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

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 137 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

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

Referenced by getNumberOfClasses().

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 178 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState(), getNumberOfClasses(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and bpp::TreeLikelihood::getNumberOfStates().

Referenced by getNumberOfClasses().

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().

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

virtual const TransitionModel* bpp::TreeLikelihood::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::TwoTreeLikelihood, bpp::NonHomogeneousTreeLikelihood, and bpp::HomogeneousTreeLikelihood.

Referenced by bpp::TreeLikelihood::~TreeLikelihood().

virtual TransitionModel* bpp::TreeLikelihood::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::TwoTreeLikelihood, bpp::NonHomogeneousTreeLikelihood, and bpp::HomogeneousTreeLikelihood.

virtual ConstSiteModelIterator* bpp::TreeLikelihood::getNewSiteModelIterator ( size_t  siteIndex) const
pure virtualinherited
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 81 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

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

Referenced by ~AbstractDiscreteRatesAcrossSitesTreeLikelihood().

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 201 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::AbstractTreeLikelihood::getLikelihoodForEachSite(), getLikelihoodForEachSiteForEachRateClass(), getNumberOfClasses(), bpp::AbstractTreeLikelihood::getNumberOfSites(), bpp::DiscreteDistribution::getProbability(), and rateDistribution_.

Referenced by getNumberOfClasses().

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorRateOfEachSite ( ) const
virtual
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 238 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

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

Referenced by getNumberOfClasses().

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_.

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_.

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 252 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::DiscreteDistribution::getCategory(), getLikelihoodForEachSiteForEachRateClass(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and rateDistribution_.

Referenced by getNumberOfClasses().

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.

Referenced by bpp::RewardMappingTools::computeRewardVectors(), bpp::SubstitutionMappingTools::computeSubstitutionVectors(), bpp::SubstitutionMappingTools::computeSubstitutionVectorsNoAveraging(), bpp::TreeLikelihoodTools::getAncestralFrequencies(), and bpp::TreeLikelihood::~TreeLikelihood().

virtual size_t bpp::TreeLikelihood::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::RHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousTreeLikelihood.

Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies(), and bpp::TreeLikelihood::~TreeLikelihood().

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 310 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References getNumberOfClasses(), bpp::TreeLikelihood::getNumberOfStates(), bpp::DiscreteDistribution::getProbabilities(), bpp::DiscreteRatesAcrossSitesTreeLikelihood::getTransitionProbabilitiesPerRateClass(), and rateDistribution_.

Referenced by ~AbstractDiscreteRatesAcrossSitesTreeLikelihood().

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.

Referenced by bpp::RewardMappingTools::computeRewardVectors(), bpp::SubstitutionMappingTools::computeSubstitutionVectors(), bpp::SubstitutionMappingTools::computeSubstitutionVectorsNoAveraging(), getTransitionProbabilities(), and bpp::DiscreteRatesAcrossSitesTreeLikelihood::~DiscreteRatesAcrossSitesTreeLikelihood().

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 295 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::tree_.

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

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::TreeLikelihood.

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

Definition at line 302 of file AbstractTreeLikelihood.h.

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

Member Data Documentation

DiscreteDistribution* bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_
protected

Definition at line 61 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Referenced by bpp::RHomogeneousClockTreeLikelihood::applyParameters(), 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::RHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RHomogeneousTreeLikelihood::getLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASite(), getLikelihoodForASiteForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASite(), getLogLikelihoodForASiteForAState(), getPosteriorProbabilitiesOfEachRate(), getPosteriorRateOfEachSite(), getRateDistribution(), getRateDistributionParameters(), getRateWithMaxPostProbOfEachSite(), bpp::DRNonHomogeneousTreeLikelihood::getSecondOrderDerivative(), getTransitionProbabilities(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), bpp::DRHomogeneousTreeLikelihood::init_(), bpp::DRNonHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::init_(), bpp::RHomogeneousTreeLikelihood::init_(), bpp::RNonHomogeneousTreeLikelihood::init_(), bpp::AbstractNonHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::initParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::initParameters(), bpp::TwoTreeLikelihood::initParameters(), operator=(), bpp::NNIHomogeneousTreeLikelihood::testNNI(), and bpp::TwoTreeLikelihood::TwoTreeLikelihood().

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

Definition at line 230 of file AbstractTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::AbstractHomogeneousTreeLikelihood(), bpp::AbstractNonHomogeneousTreeLikelihood::AbstractNonHomogeneousTreeLikelihood(), bpp::AbstractTreeLikelihood::AbstractTreeLikelihood(), bpp::RHomogeneousClockTreeLikelihood::applyParameters(), 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::RHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeLikelihood(), bpp::NNIHomogeneousTreeLikelihood::doNNI(), bpp::DRHomogeneousTreeLikelihood::DRHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::DRNonHomogeneousTreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RHomogeneousTreeLikelihood::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::AbstractTreeLikelihood::getTree(), bpp::RHomogeneousClockTreeLikelihood::init_(), bpp::DRHomogeneousTreeLikelihood::init_(), bpp::DRNonHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::init_(), bpp::RHomogeneousTreeLikelihood::init_(), bpp::RNonHomogeneousTreeLikelihood::init_(), bpp::AbstractNonHomogeneousTreeLikelihood::init_(), bpp::RHomogeneousClockTreeLikelihood::initBranchLengthsParameters(), 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(), bpp::DRHomogeneousTreeLikelihood::setData(), bpp::DRNonHomogeneousTreeLikelihood::setData(), bpp::RHomogeneousTreeLikelihood::setData(), bpp::RNonHomogeneousTreeLikelihood::setData(), bpp::NNIHomogeneousTreeLikelihood::testNNI(), and bpp::AbstractTreeLikelihood::~AbstractTreeLikelihood().


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