bpp-phyl3  3.0.0
bpp::AbstractNonHomogeneousTreeLikelihood Class Referenceabstract

Partial implementation for branch non-homogeneous models of the TreeLikelihood interface. More...

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

+ Inheritance diagram for bpp::AbstractNonHomogeneousTreeLikelihood:
+ Collaboration diagram for bpp::AbstractNonHomogeneousTreeLikelihood:

Classes

class  ConstNonHomogeneousSiteModelIterator
 

Public Member Functions

 AbstractNonHomogeneousTreeLikelihood (const Tree &tree, std::shared_ptr< SubstitutionModelSet > modelSet, std::shared_ptr< DiscreteDistributionInterface > rDist, bool verbose=true, bool reparametrizeRoot=true)
 
 AbstractNonHomogeneousTreeLikelihood (const AbstractNonHomogeneousTreeLikelihood &lik)
 Copy constructor. More...
 
AbstractNonHomogeneousTreeLikelihoodoperator= (const AbstractNonHomogeneousTreeLikelihood &lik)
 Assignation operator. More...
 
virtual ~AbstractNonHomogeneousTreeLikelihood ()
 
virtual void initParameters ()
 This builds the parameters list from all parametrizable objects, i.e. substitution model, rate distribution and tree. More...
 
virtual void applyParameters ()
 All parameters are stored in a parameter list. This function apply these parameters to the substitution model, to the rate distribution and to the branch lengths. More...
 
virtual void initBranchLengthsParameters (bool verbose=true)
 
virtual void setMinimumBranchLength (double minimum)
 
virtual void setMaximumBranchLength (double maximum)
 
virtual double getMinimumBranchLength () const
 
virtual double getMaximumBranchLength () const
 
NonHomogeneousTreeLikelihoodclone () const override=0
 
std::shared_ptr< const TransitionModelInterfacegetModelForSite (int nodeId, size_t siteIndex) const override
 Get the substitution model associated to a given node and alignment column. More...
 
std::shared_ptr< TransitionModelInterfacegetModelForSite (int nodeId, size_t siteIndex) override
 Get the substitution model associated to a given node and alignment column. More...
 
virtual void setData (const AlignmentDataInterface &sites)=0
 Set the dataset for which the likelihood must be evaluated. More...
 
virtual const AlignmentDataInterfacedata () const =0
 Get the dataset for which the likelihood must be evaluated. More...
 
virtual bool isInitialized () const =0
 
virtual bool hasLikelihoodData () const =0
 
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 getLikelihoodForASiteForAState (size_t site, int state) const =0
 Get the likelihood for a site and for a state. More...
 
virtual double getLogLikelihoodForASiteForAState (size_t site, int state) const =0
 Get the logarithm of the likelihood for a site and for a state. More...
 
virtual Vdouble getLikelihoodPerSite () const =0
 Get the likelihood for each site. More...
 
virtual Vdouble getLogLikelihoodPerSite () const =0
 Get the logarithm of the likelihood for each site. More...
 
virtual VVdouble getLikelihoodPerSitePerState () const =0
 Get the likelihood for each site and for each state. More...
 
virtual VVdouble getLogLikelihoodPerSitePerState () const =0
 Get the logarithm of the likelihood for each site and for each state. 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 const Treetree () const =0
 Get the tree (topology and branch lengths). More...
 
virtual size_t getNumberOfSites () const =0
 Get the number of sites in the dataset. More...
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const =0
 Get the alphabet associated to the dataset. More...
 
virtual void enableDerivatives (bool yn)=0
 Tell if derivatives must be computed. More...
 
virtual ParameterList getDerivableParameters () const =0
 All derivable parameters. More...
 
virtual ParameterList getNonDerivableParameters () const =0
 All non derivable parameters. More...
 
virtual void enableSecondOrderDerivatives (bool yn)=0
 
virtual bool enableSecondOrderDerivatives () 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 void enableFirstOrderDerivatives (bool yn)=0
 
virtual bool enableFirstOrderDerivatives () const=0
 
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
 
virtual const ParameterListgetParameters () const=0
 
virtual const Parameterparameter (const std::string &name) const=0
 
virtual double getParameterValue (const std::string &name) const=0
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
virtual void setParameterValue (const std::string &name, double value)=0
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
virtual void removeConstraint (const std::string &name)=0
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
virtual size_t getNumberOfParameters () const=0
 
virtual void setNamespace (const std::string &prefix)=0
 
virtual std::string getNamespace () const=0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
virtual Clonableclone () const=0
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
void setNamespace (const std::string &prefix) override
 
std::string getNamespace () const override
 
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...
 
The TreeLikelihood interface.

Other methods are implemented in the AbstractTreeLikelihood class.

size_t getNumberOfStates () const override
 
const std::vector< int > & getAlphabetStates () const override
 
int getAlphabetStateAsInt (size_t i) const override
 
std::string getAlphabetStateAsChar (size_t i) const override
 
void initialize () override
 Init the likelihood object. More...
 
ParameterList getBranchLengthsParameters () const override
 Get the branch lengths parameters. More...
 
ParameterList getSubstitutionModelParameters () const override
 Get the parameters associated to substitution model(s). More...
 
ParameterList getRateDistributionParameters () const override
 Get the parameters associated to the rate distribution. More...
 
std::shared_ptr< const TransitionModelInterfacegetModelForNode (int nodeId) const override
 Get the model associated to a given node. More...
 
std::shared_ptr< TransitionModelInterfacegetModelForNode (int nodeId) override
 Get the substitution model associated to a given node. More...
 
const std::vector< double > & getRootFrequencies (size_t siteIndex) const override
 Get the values of the frequencies for each state in the alphabet at the root node. More...
 
VVVdouble getTransitionProbabilitiesPerRateClass (int nodeId, size_t siteIndex) const override
 Retrieves all Pij(t) for a particular branch, defined by the upper node. More...
 
ConstBranchModelIteratorgetNewBranchModelIterator (int nodeId) const override
 
ConstSiteModelIteratorgetNewSiteModelIterator (size_t siteIndex) const override
 
The NonHomogeneousTreeLikelihood interface.

Other methods are implemented in the AbstractTreeLikelihood class.

std::shared_ptr< const SubstitutionModelSetgetSubstitutionModelSet () const override
 
const SubstitutionModelSetsubstitutionModelSet () const override
 
std::shared_ptr< SubstitutionModelSetgetSubstitutionModelSet () override
 
SubstitutionModelSetsubstitutionModelSet () override
 
void setSubstitutionModelSet (std::shared_ptr< SubstitutionModelSet > modelSet) override
 
ParameterList getRootFrequenciesParameters () const override
 
Retrieve some particular parameters subsets.
virtual VVdouble getTransitionProbabilities (int nodeId, size_t siteIndex) const =0
 Retrieves all Pij(t) for a particular branch, defined by the upper node and site. More...
 
virtual size_t getSiteIndex (size_t site) const =0
 Get the index (used for inner computations) of a given site (original alignment column). 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...
 
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
 

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 void computeAllTransitionProbabilities ()
 Fill the pxy_, dpxy_ and d2pxy_ arrays for all nodes. More...
 
virtual void computeTransitionProbabilitiesForNode (const Node *node)
 Fill the pxy_, dpxy_ and d2pxy_ arrays for one node. More...
 
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< SubstitutionModelSetmodelSet_
 
ParameterList brLenParameters_
 
std::map< int, VVVdoublepxy_
 
std::map< int, VVVdoubledpxy_
 
std::map< int, VVVdoubled2pxy_
 
std::vector< double > rootFreqs_
 
std::vector< Node * > nodes_
 Pointer toward all nodes in the tree. More...
 
std::map< int, const Node * > idToNode_
 An index linking nodes to their id, for faster access than the getNode() method. More...
 
size_t nbSites_
 
size_t nbDistinctSites_
 
size_t nbClasses_
 
size_t nbStates_
 
size_t nbNodes_
 
bool verbose_
 
double minimumBrLen_
 
double maximumBrLen_
 
std::shared_ptr< ConstraintInterfacebrLenConstraint_
 
bool reparametrizeRoot_
 
int root1_
 
int root2_
 
std::shared_ptr< DiscreteDistributionInterfacerateDistribution_
 
std::unique_ptr< const AlignmentDataInterfacedata_
 
std::shared_ptr< TreeTemplate< Node > > tree_
 
bool computeFirstOrderDerivatives_
 
bool computeSecondOrderDerivatives_
 
bool initialized_
 

Private Member Functions

void init_ (const Tree &tree, std::shared_ptr< SubstitutionModelSet > modelSet, std::shared_ptr< DiscreteDistributionInterface > rDist, bool verbose)
 Method called by constructor. More...
 

Private Attributes

ParameterList parameters_
 
std::string prefix_
 

Detailed Description

Partial implementation for branch non-homogeneous models of the TreeLikelihood interface.

This class provides a pointer toward a single substitution model + several utilitary variables.

Definition at line 22 of file AbstractNonHomogeneousTreeLikelihood.h.

Constructor & Destructor Documentation

◆ AbstractNonHomogeneousTreeLikelihood() [1/2]

AbstractNonHomogeneousTreeLikelihood::AbstractNonHomogeneousTreeLikelihood ( const Tree tree,
std::shared_ptr< SubstitutionModelSet modelSet,
std::shared_ptr< DiscreteDistributionInterface rDist,
bool  verbose = true,
bool  reparametrizeRoot = true 
)

◆ AbstractNonHomogeneousTreeLikelihood() [2/2]

AbstractNonHomogeneousTreeLikelihood::AbstractNonHomogeneousTreeLikelihood ( const AbstractNonHomogeneousTreeLikelihood lik)

Copy constructor.

This constructor is to be called by the derived class copy constructor.

Definition at line 57 of file AbstractNonHomogeneousTreeLikelihood.cpp.

References bpp::Node::getId(), idToNode_, nodes_, and bpp::AbstractTreeLikelihood::tree_.

◆ ~AbstractNonHomogeneousTreeLikelihood()

virtual bpp::AbstractNonHomogeneousTreeLikelihood::~AbstractNonHomogeneousTreeLikelihood ( )
inlinevirtual

Definition at line 119 of file AbstractNonHomogeneousTreeLikelihood.h.

Member Function Documentation

◆ applyParameters()

◆ clone()

NonHomogeneousTreeLikelihood* bpp::NonHomogeneousTreeLikelihood::clone ( ) const
overridepure virtualinherited

◆ computeAllTransitionProbabilities()

void AbstractNonHomogeneousTreeLikelihood::computeAllTransitionProbabilities ( )
protectedvirtual

◆ computeTransitionProbabilitiesForNode()

◆ data() [1/2]

◆ data() [2/2]

virtual const AlignmentDataInterface& bpp::TreeLikelihoodInterface::data ( ) const
pure virtualinherited

Get the dataset for which the likelihood must be evaluated.

Returns
The site container where the sequences are stored.

Implemented in bpp::AbstractTreeLikelihood.

◆ displayLikelihoodArray()

void AbstractDiscreteRatesAcrossSitesTreeLikelihood::displayLikelihoodArray ( const VVVdouble likelihoodArray)
staticinherited

◆ enableDerivatives() [1/2]

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::AbstractDiscreteRatesAcrossSitesTreeLikelihood().

◆ enableDerivatives() [2/2]

virtual void bpp::TreeLikelihoodInterface::enableDerivatives ( bool  yn)
pure virtualinherited

Tell if derivatives must be computed.

This methods calls the enableFirstOrderDerivatives and enableSecondOrderDerivatives.

Parameters
ynYes or no.

Implemented in bpp::AbstractTreeLikelihood.

◆ 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() [1/2]

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

◆ getAlphabet() [2/2]

virtual std::shared_ptr<const Alphabet> bpp::TreeLikelihoodInterface::getAlphabet ( ) const
pure virtualinherited

Get the alphabet associated to the dataset.

Returns
the alphabet associated to the dataset.

Implemented in bpp::AbstractTreeLikelihood.

◆ getAlphabetStateAsChar()

std::string bpp::AbstractNonHomogeneousTreeLikelihood::getAlphabetStateAsChar ( size_t  i) const
inlineoverridevirtual
Returns
the alphabet state corresponding to the given model state.

Implements bpp::TreeLikelihoodInterface.

Definition at line 145 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getAlphabetStateAsInt()

int bpp::AbstractNonHomogeneousTreeLikelihood::getAlphabetStateAsInt ( size_t  i) const
inlineoverridevirtual
Returns
the alphabet state corresponding to the given model state.

Implements bpp::TreeLikelihoodInterface.

Definition at line 143 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getAlphabetStates()

const std::vector<int>& bpp::AbstractNonHomogeneousTreeLikelihood::getAlphabetStates ( ) const
inlineoverridevirtual
Returns
the alphabet states corresponding to all model states.

Implements bpp::TreeLikelihoodInterface.

Definition at line 141 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getBranchLengthsParameters()

ParameterList AbstractNonHomogeneousTreeLikelihood::getBranchLengthsParameters ( ) const
overridevirtual

◆ getDerivableParameters() [1/2]

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getDerivableParameters ( ) const
virtualinherited

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

◆ getDerivableParameters() [2/2]

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

All derivable parameters.

Usually, this contains all branch lengths parameters.

Returns
A ParameterList.

Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

◆ 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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodPerSitePerRateClass().

◆ getLikelihoodForASiteForARateClassForAState()

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

◆ getLikelihoodForASiteForAState() [1/2]

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

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(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ getLikelihoodForASiteForAState() [2/2]

virtual double bpp::TreeLikelihoodInterface::getLikelihoodForASiteForAState ( size_t  site,
int  state 
) const
pure virtualinherited

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.

Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

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

◆ getLikelihoodPerSite() [1/2]

Vdouble AbstractTreeLikelihood::getLikelihoodPerSite ( ) const
virtualinherited

◆ getLikelihoodPerSite() [2/2]

virtual Vdouble bpp::TreeLikelihoodInterface::getLikelihoodPerSite ( ) const
pure virtualinherited

Get the likelihood for each site.

Returns
A vector with all likelihoods for each site.

Implemented in bpp::AbstractTreeLikelihood.

◆ getLikelihoodPerSitePerRateClass()

◆ getLikelihoodPerSitePerRateClassPerState()

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodPerSitePerRateClassPerState ( ) const
virtualinherited

◆ getLikelihoodPerSitePerState() [1/2]

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

◆ getLikelihoodPerSitePerState() [2/2]

virtual VVdouble bpp::TreeLikelihoodInterface::getLikelihoodPerSitePerState ( ) const
pure 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.

Implemented in bpp::AbstractTreeLikelihood.

◆ 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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodPerSitePerRateClassPerState().

◆ getLogLikelihoodForASiteForAState() [1/2]

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

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(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), bpp::log(), and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ getLogLikelihoodForASiteForAState() [2/2]

virtual double bpp::TreeLikelihoodInterface::getLogLikelihoodForASiteForAState ( size_t  site,
int  state 
) const
pure virtualinherited

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.

Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

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

◆ getLogLikelihoodPerSite() [1/2]

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

◆ getLogLikelihoodPerSite() [2/2]

virtual Vdouble bpp::TreeLikelihoodInterface::getLogLikelihoodPerSite ( ) const
pure virtualinherited

Get the logarithm of the likelihood for each site.

Returns
A vector with all log likelihoods for each site.

Implemented in bpp::AbstractTreeLikelihood.

Referenced by bpp::PairedSiteLikelihoods::appendModel().

◆ getLogLikelihoodPerSitePerRateClass()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodPerSitePerRateClass ( ) const
virtualinherited

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(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), and bpp::AbstractTreeLikelihood::getNumberOfSites().

◆ getLogLikelihoodPerSitePerRateClassPerState()

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodPerSitePerRateClassPerState ( ) const
virtualinherited

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(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), bpp::AbstractTreeLikelihood::getNumberOfSites(), and bpp::TreeLikelihoodInterface::getNumberOfStates().

◆ getLogLikelihoodPerSitePerState() [1/2]

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

◆ getLogLikelihoodPerSitePerState() [2/2]

virtual VVdouble bpp::TreeLikelihoodInterface::getLogLikelihoodPerSitePerState ( ) const
pure 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.

Implemented in bpp::AbstractTreeLikelihood.

◆ getMaximumBranchLength()

virtual double bpp::AbstractNonHomogeneousTreeLikelihood::getMaximumBranchLength ( ) const
inlinevirtual

Definition at line 244 of file AbstractNonHomogeneousTreeLikelihood.h.

References maximumBrLen_.

◆ getMinimumBranchLength()

virtual double bpp::AbstractNonHomogeneousTreeLikelihood::getMinimumBranchLength ( ) const
inlinevirtual

Definition at line 243 of file AbstractNonHomogeneousTreeLikelihood.h.

References minimumBrLen_.

◆ getModelForNode() [1/2]

std::shared_ptr<const TransitionModelInterface> bpp::AbstractNonHomogeneousTreeLikelihood::getModelForNode ( int  nodeId) const
inlineoverridevirtual

Get the model associated to a given node.

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

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 158 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getModelForNode() [2/2]

std::shared_ptr<TransitionModelInterface> bpp::AbstractNonHomogeneousTreeLikelihood::getModelForNode ( int  nodeId)
inlineoverridevirtual

Get the substitution model associated to a given node.

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

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 163 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getModelForSite() [1/2]

std::shared_ptr<const TransitionModelInterface> bpp::NonHomogeneousTreeLikelihood::getModelForSite ( int  nodeId,
size_t  siteIndex 
) const
inlineoverridevirtualinherited

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.

Implements bpp::TreeLikelihoodInterface.

Definition at line 32 of file NonHomogeneousTreeLikelihood.h.

References bpp::NonHomogeneousTreeLikelihood::getModelForNode().

◆ getModelForSite() [2/2]

std::shared_ptr<TransitionModelInterface> bpp::NonHomogeneousTreeLikelihood::getModelForSite ( int  nodeId,
size_t  siteIndex 
)
inlineoverridevirtualinherited

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

Implements bpp::TreeLikelihoodInterface.

Definition at line 37 of file NonHomogeneousTreeLikelihood.h.

References bpp::NonHomogeneousTreeLikelihood::getModelForNode().

◆ getNewBranchModelIterator()

ConstBranchModelIterator* bpp::AbstractNonHomogeneousTreeLikelihood::getNewBranchModelIterator ( int  nodeId) const
inlineoverridevirtual

Implements bpp::TreeLikelihoodInterface.

Definition at line 172 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_, and nbDistinctSites_.

◆ getNewSiteModelIterator()

ConstSiteModelIterator* bpp::AbstractNonHomogeneousTreeLikelihood::getNewSiteModelIterator ( size_t  siteIndex) const
inlineoverridevirtual

Implements bpp::TreeLikelihoodInterface.

Definition at line 177 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getNonDerivableParameters() [1/2]

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNonDerivableParameters ( ) const
virtualinherited

◆ getNonDerivableParameters() [2/2]

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

All non derivable parameters.

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

Returns
A ParameterList.

Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

◆ getNumberOfClasses()

◆ getNumberOfSites() [1/2]

◆ getNumberOfSites() [2/2]

virtual size_t bpp::TreeLikelihoodInterface::getNumberOfSites ( ) const
pure virtualinherited

Get the number of sites in the dataset.

Returns
the number of sites in the dataset.

Implemented in bpp::AbstractTreeLikelihood.

◆ getNumberOfStates()

size_t bpp::AbstractNonHomogeneousTreeLikelihood::getNumberOfStates ( ) const
inlineoverridevirtual
Returns
the number of model states of the underlying Markov chain.

Implements bpp::TreeLikelihoodInterface.

Definition at line 139 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getPosteriorProbabilitiesPerRate()

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorProbabilitiesPerRate ( ) const
virtualinherited

◆ getPosteriorRatePerSite()

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorRatePerSite ( ) const
virtualinherited

◆ getRateClassWithMaxPostProbPerSite()

vector< size_t > AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateClassWithMaxPostProbPerSite ( ) const
virtualinherited

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodPerSitePerRateClass(), and bpp::AbstractTreeLikelihood::getNumberOfSites().

◆ getRateDistribution() [1/2]

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

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ getRateDistribution() [2/2]

std::shared_ptr<const DiscreteDistributionInterface> bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistribution ( ) const
inlinevirtualinherited

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ getRateDistributionParameters()

ParameterList bpp::AbstractNonHomogeneousTreeLikelihood::getRateDistributionParameters ( ) const
inlineoverridevirtual

◆ getRateWithMaxPostProbPerSite()

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateWithMaxPostProbPerSite ( ) const
virtualinherited

◆ getRootFrequencies()

const std::vector<double>& bpp::AbstractNonHomogeneousTreeLikelihood::getRootFrequencies ( size_t  siteIndex) const
inlineoverridevirtual

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;

Implements bpp::TreeLikelihoodInterface.

Definition at line 168 of file AbstractNonHomogeneousTreeLikelihood.h.

References rootFreqs_.

◆ getRootFrequenciesParameters()

ParameterList bpp::AbstractNonHomogeneousTreeLikelihood::getRootFrequenciesParameters ( ) const
inlineoverridevirtual
Returns
The parameters on which the root frequencies depend.

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 201 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

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

◆ getSubstitutionModelSet() [1/2]

std::shared_ptr<const SubstitutionModelSet> bpp::AbstractNonHomogeneousTreeLikelihood::getSubstitutionModelSet ( ) const
inlineoverridevirtual
Returns
The set of substitution models associated to this instance.

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 191 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getSubstitutionModelSet() [2/2]

std::shared_ptr<SubstitutionModelSet> bpp::AbstractNonHomogeneousTreeLikelihood::getSubstitutionModelSet ( )
inlineoverridevirtual
Returns
The set of substitution models associated to this instance.

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 195 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ getTransitionProbabilities() [1/2]

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

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), bpp::TreeLikelihoodInterface::getNumberOfStates(), bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface::getTransitionProbabilitiesPerRateClass(), and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ getTransitionProbabilities() [2/2]

virtual VVdouble bpp::TreeLikelihoodInterface::getTransitionProbabilities ( int  nodeId,
size_t  siteIndex 
) const
pure virtualinherited

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.

Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

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

◆ getTransitionProbabilitiesPerRateClass()

VVVdouble bpp::AbstractNonHomogeneousTreeLikelihood::getTransitionProbabilitiesPerRateClass ( int  nodeId,
size_t  siteIndex 
) const
inlineoverridevirtual

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.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihoodInterface.

Definition at line 170 of file AbstractNonHomogeneousTreeLikelihood.h.

References pxy_.

◆ hasLikelihoodData() [1/2]

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

◆ hasLikelihoodData() [2/2]

virtual bool bpp::TreeLikelihoodInterface::hasLikelihoodData ( ) const
pure virtualinherited
Returns
True if the TreeLikelihood object has a LikelihoodData.

Implemented in bpp::AbstractTreeLikelihood.

◆ init_()

◆ initBranchLengthsParameters()

◆ initialize()

void AbstractNonHomogeneousTreeLikelihood::initialize ( )
overridevirtual

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.

Definition at line 234 of file AbstractNonHomogeneousTreeLikelihood.cpp.

References computeAllTransitionProbabilities(), bpp::AbstractTreeLikelihood::data_, bpp::AbstractParametrizable::fireParameterChanged(), bpp::AbstractParametrizable::getParameters(), bpp::AbstractTreeLikelihood::initialized_, and initParameters().

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

◆ initParameters()

void AbstractNonHomogeneousTreeLikelihood::initParameters ( )
virtual

◆ isInitialized() [1/2]

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

◆ isInitialized() [2/2]

virtual bool bpp::TreeLikelihoodInterface::isInitialized ( ) const
pure virtualinherited
Returns
'true' is the likelihood function has been initialized.

Implemented in bpp::AbstractTreeLikelihood.

◆ 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 ( )
inlinevirtualinherited

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ rateDistribution() [2/2]

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

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 bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

◆ resetLikelihoodArray()

◆ setData()

◆ setMaximumBranchLength()

virtual void bpp::AbstractNonHomogeneousTreeLikelihood::setMaximumBranchLength ( double  maximum)
inlinevirtual

◆ setMinimumBranchLength()

virtual void bpp::AbstractNonHomogeneousTreeLikelihood::setMinimumBranchLength ( double  minimum)
inlinevirtual

◆ setSubstitutionModelSet()

void AbstractNonHomogeneousTreeLikelihood::setSubstitutionModelSet ( std::shared_ptr< SubstitutionModelSet model)
overridevirtual

◆ substitutionModelSet() [1/2]

const SubstitutionModelSet& bpp::AbstractNonHomogeneousTreeLikelihood::substitutionModelSet ( ) const
inlineoverridevirtual
Returns
The set of substitution models associated to this instance.

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 193 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ substitutionModelSet() [2/2]

SubstitutionModelSet& bpp::AbstractNonHomogeneousTreeLikelihood::substitutionModelSet ( )
inlineoverridevirtual
Returns
The set of substitution models associated to this instance.

Implements bpp::NonHomogeneousTreeLikelihood.

Definition at line 197 of file AbstractNonHomogeneousTreeLikelihood.h.

References modelSet_.

◆ tree() [1/2]

◆ tree() [2/2]

virtual const Tree& bpp::TreeLikelihoodInterface::tree ( ) const
pure virtualinherited

Member Data Documentation

◆ brLenConstraint_

std::shared_ptr<ConstraintInterface> bpp::AbstractNonHomogeneousTreeLikelihood::brLenConstraint_
protected

◆ brLenParameters_

◆ computeFirstOrderDerivatives_

◆ computeSecondOrderDerivatives_

◆ d2pxy_

◆ data_

◆ dpxy_

◆ idToNode_

std::map<int, const Node*> bpp::AbstractNonHomogeneousTreeLikelihood::idToNode_
mutableprotected

◆ initialized_

◆ maximumBrLen_

double bpp::AbstractNonHomogeneousTreeLikelihood::maximumBrLen_
protected

◆ minimumBrLen_

double bpp::AbstractNonHomogeneousTreeLikelihood::minimumBrLen_
protected

◆ modelSet_

◆ nbClasses_

size_t bpp::AbstractNonHomogeneousTreeLikelihood::nbClasses_
protected

Definition at line 84 of file AbstractNonHomogeneousTreeLikelihood.h.

Referenced by bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeLikelihoodAtNode_(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeSubtreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeSubtreeLikelihoodPostfix(), bpp::DRNonHomogeneousTreeLikelihood::computeSubtreeLikelihoodPrefix(), computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeD2LikelihoodAtNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeDLikelihoodAtNode(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::DRNonHomogeneousTreeLikelihood::getSecondOrderDerivative(), init_(), operator=(), and setSubstitutionModelSet().

◆ nbDistinctSites_

◆ nbNodes_

◆ nbSites_

◆ nbStates_

size_t bpp::AbstractNonHomogeneousTreeLikelihood::nbStates_
protected

Definition at line 85 of file AbstractNonHomogeneousTreeLikelihood.h.

Referenced by bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeDownSubtreeDLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeLikelihoodAtNode_(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::RNonHomogeneousMixedTreeLikelihood::computeSubtreeLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeSubtreeLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeSubtreeLikelihoodPostfix(), bpp::DRNonHomogeneousTreeLikelihood::computeSubtreeLikelihoodPrefix(), computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeD2Likelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeD2Likelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeD2LikelihoodAtNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTreeDLikelihood(), bpp::RNonHomogeneousTreeLikelihood::computeTreeDLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeTreeDLikelihoodAtNode(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass(), bpp::DRNonHomogeneousTreeLikelihood::getSecondOrderDerivative(), operator=(), bpp::DRNonHomogeneousTreeLikelihood::setData(), bpp::RNonHomogeneousTreeLikelihood::setData(), and setSubstitutionModelSet().

◆ nodes_

◆ pxy_

◆ rateDistribution_

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

Definition at line 26 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::applyParameters(), applyParameters(), bpp::DRHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::AbstractHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), 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(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForASiteForAState(), bpp::RHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForASiteForAState(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorProbabilitiesPerRate(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorRatePerSite(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistribution(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistributionParameters(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateWithMaxPostProbPerSite(), bpp::DRNonHomogeneousTreeLikelihood::getSecondOrderDerivative(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getTransitionProbabilities(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), bpp::DRHomogeneousTreeLikelihood::init_(), bpp::DRNonHomogeneousTreeLikelihood::init_(), bpp::RHomogeneousTreeLikelihood::init_(), bpp::RNonHomogeneousTreeLikelihood::init_(), init_(), bpp::AbstractHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::initParameters(), initParameters(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::operator=(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution(), and bpp::NNIHomogeneousTreeLikelihood::testNNI().

◆ reparametrizeRoot_

bool bpp::AbstractNonHomogeneousTreeLikelihood::reparametrizeRoot_
protected

◆ root1_

◆ root2_

◆ rootFreqs_

◆ tree_

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

Definition at line 209 of file AbstractTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::AbstractHomogeneousTreeLikelihood(), 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_(), init_(), bpp::AbstractHomogeneousTreeLikelihood::init_(), bpp::AbstractHomogeneousTreeLikelihood::operator=(), 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().

◆ verbose_

bool bpp::AbstractNonHomogeneousTreeLikelihood::verbose_
protected

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