bpp-phyl  2.2.0
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
bpp::RHomogeneousTreeLikelihood Class Referenceabstract

This class implement the 'traditional' way of computing likelihood for a tree. More...

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

+ Inheritance diagram for bpp::RHomogeneousTreeLikelihood:
+ Collaboration diagram for bpp::RHomogeneousTreeLikelihood:

Public Member Functions

 RHomogeneousTreeLikelihood (const Tree &tree, SubstitutionModel *model, DiscreteDistribution *rDist, bool checkRooted=true, bool verbose=true, bool usePatterns=true) throw (Exception)
 Build a new RHomogeneousTreeLikelihood object without data. More...
 
 RHomogeneousTreeLikelihood (const Tree &tree, const SiteContainer &data, SubstitutionModel *model, DiscreteDistribution *rDist, bool checkRooted=true, bool verbose=true, bool usePatterns=true) throw (Exception)
 Build a new RHomogeneousTreeLikelihood object with data. More...
 
 RHomogeneousTreeLikelihood (const RHomogeneousTreeLikelihood &lik)
 
RHomogeneousTreeLikelihoodoperator= (const RHomogeneousTreeLikelihood &lik)
 
virtual ~RHomogeneousTreeLikelihood ()
 
RHomogeneousTreeLikelihoodclone () const
 
void setParameters (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Implements the Function interface. More...
 
double getValue () const throw (Exception)
 
size_t getSiteIndex (size_t site) const throw (IndexOutOfBoundsException)
 Get the index (used for inner computations) of a given site (original alignment column). More...
 
DRASRTreeLikelihoodDatagetLikelihoodData ()
 
const DRASRTreeLikelihoodDatagetLikelihoodData () const
 
void computeTreeLikelihood ()
 
virtual double getDLikelihoodForASiteForARateClass (size_t site, size_t rateClass) const
 
virtual double getDLikelihoodForASite (size_t site) const
 
virtual double getDLogLikelihoodForASite (size_t site) const
 
virtual double getDLogLikelihood () const
 
virtual void computeTreeDLikelihood (const std::string &variable)
 
virtual double getD2LikelihoodForASiteForARateClass (size_t site, size_t rateClass) const
 
virtual double getD2LikelihoodForASite (size_t site) const
 
virtual double getD2LogLikelihoodForASite (size_t site) const
 
virtual double getD2LogLikelihood () const
 
virtual void computeTreeD2Likelihood (const std::string &variable)
 
virtual void initParameters ()
 This builds the parameters list from all parametrizable objects, i.e. substitution model, rate distribution and tree. More...
 
virtual void applyParameters () throw (Exception)
 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 ()
 
virtual void setMinimumBranchLength (double minimum) throw (Exception)
 
virtual void setMaximumBranchLength (double maximum) throw (Exception)
 
virtual double getMinimumBranchLength () const
 
virtual double getMaximumBranchLength () const
 
virtual const SiteContainergetData () const =0
 Get the dataset for which the likelihood must be evaluated. More...
 
virtual bool isInitialized () const =0
 
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 getLikelihoodForEachSite () const =0
 Get the likelihood for each site. More...
 
virtual Vdouble getLogLikelihoodForEachSite () const =0
 Get the logarithm of the likelihood for each site. More...
 
virtual VVdouble getLikelihoodForEachSiteForEachState () const =0
 Get the likelihood for each site and for each state. More...
 
virtual VVdouble getLogLikelihoodForEachSiteForEachState () const =0
 Get the logarithm of the likelihood for each site and for each state. More...
 
virtual const TreegetTree () 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 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 void enableFirstOrderDerivatives (bool yn)=0
 
virtual bool enableFirstOrderDerivatives () const =0
 
void setNamespace (const std::string &prefix)
 
The TreeLikelihood interface.

Other methods are implemented in the AbstractHomogeneousTreeLikelihood class.

void setData (const SiteContainer &sites) throw (Exception)
 Set the dataset for which the likelihood must be evaluated. More...
 
double getLikelihood () const
 Get the likelihood for the whole dataset. More...
 
double getLogLikelihood () const
 Get the logarithm of the likelihood for the whole dataset. More...
 
double getLikelihoodForASite (size_t site) const
 Get the likelihood for a site. More...
 
double getLogLikelihoodForASite (size_t site) const
 Get the logarithm of the likelihood for a site. More...
 
The DiscreteRatesAcrossSites interface implementation:
double getLikelihoodForASiteForARateClass (size_t site, size_t rateClass) const
 Get the likelihood for a site knowing its rate class. More...
 
double getLogLikelihoodForASiteForARateClass (size_t site, size_t rateClass) const
 Get the logarithm of the likelihood for a site knowing its rate class. More...
 
double getLikelihoodForASiteForARateClassForAState (size_t site, size_t rateClass, int state) const
 Get the likelihood for a site knowing its rate class and its ancestral state. More...
 
double getLogLikelihoodForASiteForARateClassForAState (size_t site, size_t rateClass, int state) const
 Get the logarithm of the likelihood for a site knowing its rate class and its ancestral state. More...
 
DerivableFirstOrder interface.
double getFirstOrderDerivative (const std::string &variable) const throw (Exception)
 
DerivableSecondOrder interface.
double getSecondOrderDerivative (const std::string &variable) const throw (Exception)
 
double getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const throw (Exception)
 
The TreeLikelihood interface.

Other methods are implemented in the AbstractTreeLikelihood class.

size_t getNumberOfStates () const
 
const std::vector< int > & getAlphabetChars () const
 
int getAlphabetChar (size_t i) const
 
void initialize () throw (Exception)
 Init the likelihood object. More...
 
ParameterList getBranchLengthsParameters () const
 Get the branch lengths parameters. More...
 
ParameterList getSubstitutionModelParameters () const
 Get the parameters associated to substitution model(s). More...
 
ParameterList getRateDistributionParameters () const
 Get the parameters associated to the rate distirbution. More...
 
const std::vector< double > & getRootFrequencies (size_t siteIndex) const
 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
 Retrieves all Pij(t) for a particular branch, defined by the upper node. More...
 
ConstBranchModelIteratorgetNewBranchModelIterator (int nodeId) const
 
ConstSiteModelIteratorgetNewSiteModelIterator (size_t siteIndex) const
 
The HomogeneousTreeLikelihood interface.

Other methods are implemented in the AbstractTreeLikelihood class.

const SubstitutionModelgetSubstitutionModel () const
 
const SubstitutionModelgetSubstitutionModel (int nodeId, size_t siteIndex) const throw (NodeNotFoundException)
 Get the substitution model associated to a given node and alignment column. More...
 
SubstitutionModelgetSubstitutionModel ()
 
SubstitutionModelgetSubstitutionModel (int nodeId, size_t siteIndex) throw (NodeNotFoundException)
 Get the substitution model associated to a given node and alignment column. More...
 
void setSubstitutionModel (SubstitutionModel *model) throw (Exception)
 
The TreeLikelihood interface.
const SiteContainergetData () const
 Get the dataset for which the likelihood must be evaluated. More...
 
bool isInitialized () const
 
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...
 
const TreegetTree () const
 Get the tree (topology and branch lengths). More...
 
size_t getNumberOfSites () const
 Get the number of sites in the dataset. More...
 
const AlphabetgetAlphabet () const
 Get the alphabet associated to the dataset. More...
 
void enableDerivatives (bool yn)
 Tell if derivatives must be computed. More...
 
void enableSecondOrderDerivatives (bool yn)
 
bool enableSecondOrderDerivatives () const
 
void enableFirstOrderDerivatives (bool yn)
 
bool enableFirstOrderDerivatives () const
 
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...
 
VVdouble getTransitionProbabilities (int nodeId, size_t siteIndex) const
 Retrieves all Pij(t) for a particular branch, defined by the upper node and site. More...
 
ParameterList getDerivableParameters () const
 All derivable parameters. More...
 
ParameterList getNonDerivableParameters () const
 All non derivable parameters. More...
 
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...
 
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...
 
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...
 

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 computeSubtreeLikelihood (const Node *node)
 Compute the likelihood for a subtree defined by the Tree::Node node. More...
 
virtual void computeDownSubtreeDLikelihood (const Node *)
 
virtual void computeDownSubtreeD2Likelihood (const Node *)
 
void fireParameterChanged (const ParameterList &params)
 
virtual void displayLikelihood (const Node *node)
 This method is mainly for debugging purpose. More...
 
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...
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 

Protected Attributes

double minusLogLik_
 
SubstitutionModelmodel_
 
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...
 
size_t nbSites_
 
size_t nbDistinctSites_
 
size_t nbClasses_
 
size_t nbStates_
 
size_t nbNodes_
 
bool verbose_
 
double minimumBrLen_
 
double maximumBrLen_
 
std::auto_ptr< ConstraintbrLenConstraint_
 
DiscreteDistributionrateDistribution_
 
const SiteContainerdata_
 
TreeTemplate< Node > * tree_
 
bool computeFirstOrderDerivatives_
 
bool computeSecondOrderDerivatives_
 
bool initialized_
 

Private Member Functions

void init_ (bool usePatterns) throw (Exception)
 Method called by constructors. More...
 

Private Attributes

DRASRTreeLikelihoodDatalikelihoodData_
 

Friends

class RHomogeneousMixedTreeLikelihood
 

Detailed Description

This class implement the 'traditional' way of computing likelihood for a tree.

The substitution model is constant over the tree (homogeneous model). A non uniform distribution of rates among the sites is allowed (ASRV models).

This class uses an instance of the DRASRTreeLikelihoodData for conditionnal likelihood storage.

This class can also use a simple or recursive site compression. In the simple case, computations for identical sites are not duplicated. In the recursive case, computations for identical sub-sites (site patterns ) are also not duplicated: Following N. Galtier (personal communication ;-), we define a Pattern as a distinct site in a sub-dataset corresponding to the dataset with sequences associated to a particular subtree. The likelihood computation is the same for a given site, hence the idea is to save time from performing many times the same coputation. The network between all patterns is defined by the _patternLinks double map, initialized in the initLikelihoodsWithPatterns() method. This initialisation takes more time than the classic initTreeLikelihood one, where all likelihoods for a given site i are at the i coordinate in the likelihood tensor, but is really faster when computing the likelihood (computeLikelihoods() method). Hence, if you have to compute likelihood many times while holding the tree topology unchanged, you should use patterns. This decreases the likelihood computation time, but at a cost: some time is spent to establish the patterns relationships. Whether to use or not patterns depends on what you actllay need:

  • The more you compute likelihoods without changing the data or topology, the more patterns are interesting (this divides the cost of computing patterns by the number of computation performed). Patterns are hence usefull when you have a high number of computation to perform, while optimizing numerical parameters for instance).
  • Patterns are more likely to occur whith small alphabet (nucleotides).

Definition at line 82 of file RHomogeneousTreeLikelihood.h.

Constructor & Destructor Documentation

RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood ( const Tree tree,
SubstitutionModel model,
DiscreteDistribution rDist,
bool  checkRooted = true,
bool  verbose = true,
bool  usePatterns = true 
)
throw (Exception
)

Build a new RHomogeneousTreeLikelihood object without data.

This constructor only initialize the parameters. To compute a likelihood, you will need to call the setData() and the computeTreeLikelihood() methods.

Parameters
treeThe tree to use.
modelThe substitution model to use.
rDistThe rate across sites distribution to use.
checkRootedTell if we have to check for the tree to be unrooted. If true, any rooted tree will be unrooted before likelihood computation.
verboseShould I display some info?
usePatternsTell if recursive site compression should be performed.
Exceptions
Exceptionin an error occured.

Definition at line 55 of file RHomogeneousTreeLikelihood.cpp.

Referenced by clone().

RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood ( const Tree tree,
const SiteContainer data,
SubstitutionModel model,
DiscreteDistribution rDist,
bool  checkRooted = true,
bool  verbose = true,
bool  usePatterns = true 
)
throw (Exception
)

Build a new RHomogeneousTreeLikelihood object with data.

This constructor initializes all parameters, data, and likelihood arrays.

Parameters
treeThe tree to use.
dataSequences to use.
modelThe substitution model to use.
rDistThe rate across sites distribution to use.
checkRootedTell if we have to check for the tree to be unrooted. If true, any rooted tree will be unrooted before likelihood computation.
verboseShould I display some info?
usePatternsTell if recursive site compression should be performed.
Exceptions
Exceptionin an error occured.

Definition at line 72 of file RHomogeneousTreeLikelihood.cpp.

RHomogeneousTreeLikelihood::RHomogeneousTreeLikelihood ( const RHomogeneousTreeLikelihood lik)
RHomogeneousTreeLikelihood::~RHomogeneousTreeLikelihood ( )
virtual

Definition at line 126 of file RHomogeneousTreeLikelihood.cpp.

References likelihoodData_.

Member Function Documentation

RHomogeneousTreeLikelihood* bpp::RHomogeneousTreeLikelihood::clone ( ) const
inlinevirtual
void RHomogeneousTreeLikelihood::computeSubtreeLikelihood ( const Node node)
protectedvirtual
void RHomogeneousTreeLikelihood::computeTreeLikelihood ( )
void RHomogeneousTreeLikelihood::displayLikelihood ( const Node node)
protectedvirtual

This method is mainly for debugging purpose.

Parameters
nodeThe node at which likelihood values must be displayed.

Reimplemented in bpp::RHomogeneousMixedTreeLikelihood.

Definition at line 874 of file RHomogeneousTreeLikelihood.cpp.

References bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::displayLikelihoodArray(), bpp::Node::getId(), bpp::DRASRTreeLikelihoodData::getLikelihoodArray(), bpp::Node::getName(), and likelihoodData_.

void AbstractDiscreteRatesAcrossSitesTreeLikelihood::displayLikelihoodArray ( const VVVdouble likelihoodArray)
staticinherited

Print the likelihood array to terminal (debugging tool).

Parameters
likelihoodArraythe likelihood array.

Definition at line 287 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

Referenced by bpp::DRHomogeneousTreeLikelihood::displayLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::displayLikelihood(), displayLikelihood(), and bpp::RNonHomogeneousTreeLikelihood::displayLikelihood().

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

Tell if derivatives must be computed.

This methods calls the enableFirstOrderDerivatives and enableSecondOrderDerivatives.

Parameters
ynYes or no.

Implements bpp::TreeLikelihood.

Definition at line 292 of file AbstractTreeLikelihood.h.

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

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

virtual void bpp::TreeLikelihood::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.

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

Get the alphabet associated to the dataset.

Returns
the alphabet associated to the dataset.

Implements bpp::TreeLikelihood.

Definition at line 285 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_, and bpp::OrderedSequenceContainer::getAlphabet().

virtual const Alphabet* bpp::TreeLikelihood::getAlphabet ( ) const
pure virtualinherited

Get the alphabet associated to the dataset.

Returns
the alphabet associated to the dataset.

Implemented in bpp::AbstractTreeLikelihood.

int bpp::AbstractHomogeneousTreeLikelihood::getAlphabetChar ( size_t  i) const
inlinevirtualinherited
Returns
the alphabet state corresponding to the given model state.

Implements bpp::TreeLikelihood.

Definition at line 169 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::SubstitutionModel::getAlphabetChar(), and bpp::AbstractHomogeneousTreeLikelihood::model_.

const std::vector<int>& bpp::AbstractHomogeneousTreeLikelihood::getAlphabetChars ( ) const
inlinevirtualinherited
Returns
the alphabet states corresponding to all model states.

Implements bpp::TreeLikelihood.

Definition at line 167 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::SubstitutionModel::getAlphabetChars(), and bpp::AbstractHomogeneousTreeLikelihood::model_.

ParameterList AbstractHomogeneousTreeLikelihood::getBranchLengthsParameters ( ) const
virtualinherited
double RHomogeneousTreeLikelihood::getD2LogLikelihood ( ) const
virtual
double RHomogeneousTreeLikelihood::getD2LogLikelihoodForASite ( size_t  site) const
virtual
virtual const SiteContainer* bpp::TreeLikelihood::getData ( ) const
pure virtualinherited

Get the dataset for which the likelihood must be evaluated.

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

Implemented in bpp::AbstractTreeLikelihood.

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

Get the dataset for which the likelihood must be evaluated.

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

Implements bpp::TreeLikelihood.

Definition at line 284 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::data_.

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

ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getDerivableParameters ( ) const
virtualinherited

All derivable parameters.

Usually, this contains all branch lengths parameters.

Returns
A ParameterList.

Implements bpp::TreeLikelihood.

Reimplemented in bpp::RHomogeneousClockTreeLikelihood.

Definition at line 73 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

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

All derivable parameters.

Usually, this contains all branch lengths parameters.

Returns
A ParameterList.

Implemented in bpp::RHomogeneousClockTreeLikelihood, and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

double RHomogeneousTreeLikelihood::getDLogLikelihood ( ) const
virtual
double RHomogeneousTreeLikelihood::getDLogLikelihoodForASite ( size_t  site) const
virtual

Definition at line 329 of file RHomogeneousTreeLikelihood.cpp.

References getDLikelihoodForASite(), and getLikelihoodForASite().

Referenced by getDLogLikelihood().

double RHomogeneousTreeLikelihood::getFirstOrderDerivative ( const std::string &  variable) const
throw (Exception
)
virtual

Implements bpp::DerivableFirstOrder.

Definition at line 350 of file RHomogeneousTreeLikelihood.cpp.

double RHomogeneousTreeLikelihood::getLikelihood ( ) const
virtual

Get the likelihood for the whole dataset.

Returns
The likelihood of the dataset.

Implements bpp::TreeLikelihood.

Definition at line 152 of file RHomogeneousTreeLikelihood.cpp.

References getLikelihoodForASite(), and bpp::AbstractHomogeneousTreeLikelihood::nbSites_.

DRASRTreeLikelihoodData* bpp::RHomogeneousTreeLikelihood::getLikelihoodData ( )
inlinevirtual
Returns
The underlying likelihood data structure.

Implements bpp::TreeLikelihood.

Definition at line 222 of file RHomogeneousTreeLikelihood.h.

References likelihoodData_.

const DRASRTreeLikelihoodData* bpp::RHomogeneousTreeLikelihood::getLikelihoodData ( ) const
inlinevirtual
Returns
The underlying likelihood data structure.

Implements bpp::TreeLikelihood.

Definition at line 223 of file RHomogeneousTreeLikelihood.h.

References likelihoodData_.

double RHomogeneousTreeLikelihood::getLikelihoodForASite ( size_t  site) const
virtual
double RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClass ( size_t  site,
size_t  rateClass 
) const
virtual

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.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 207 of file RHomogeneousTreeLikelihood.cpp.

References bpp::DRASRTreeLikelihoodData::getLikelihoodArray(), bpp::DRASRTreeLikelihoodData::getRootArrayPosition(), likelihoodData_, bpp::AbstractHomogeneousTreeLikelihood::nbStates_, bpp::AbstractHomogeneousTreeLikelihood::rootFreqs_, and bpp::AbstractTreeLikelihood::tree_.

Referenced by getLikelihoodForASite(), and getLogLikelihoodForASite().

double RHomogeneousTreeLikelihood::getLikelihoodForASiteForARateClassForAState ( size_t  site,
size_t  rateClass,
int  state 
) const
virtual

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.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 236 of file RHomogeneousTreeLikelihood.cpp.

References bpp::DRASRTreeLikelihoodData::getLikelihoodArray(), bpp::DRASRTreeLikelihoodData::getRootArrayPosition(), likelihoodData_, and bpp::AbstractTreeLikelihood::tree_.

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

Definition at line 111 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

virtual double bpp::TreeLikelihood::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::getLikelihoodForEachSiteForEachState().

virtual Vdouble bpp::TreeLikelihood::getLikelihoodForEachSite ( ) const
pure virtualinherited

Get the likelihood for each site.

Returns
A vector with all likelihoods for each site.

Implemented in bpp::AbstractTreeLikelihood.

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

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForEachSiteForEachRateClass ( ) const
virtualinherited

Get the likelihood for each site and each rate class.

Returns
A two-dimension vector with all likelihoods.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 93 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodForEachSiteForEachRateClassForEachState ( ) const
virtualinherited

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

Returns
A three-dimension vector with all likelihoods.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 156 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

virtual VVdouble bpp::TreeLikelihood::getLikelihoodForEachSiteForEachState ( ) 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.

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

double RHomogeneousTreeLikelihood::getLogLikelihood ( ) const
virtual

Get the logarithm of the likelihood for the whole dataset.

Returns
The logarithm of the likelihood of the dataset.

Implements bpp::TreeLikelihood.

Definition at line 164 of file RHomogeneousTreeLikelihood.cpp.

References getLogLikelihoodForASite(), and bpp::AbstractHomogeneousTreeLikelihood::nbSites_.

Referenced by bpp::RHomogeneousMixedTreeLikelihood::fireParameterChanged(), and fireParameterChanged().

double RHomogeneousTreeLikelihood::getLogLikelihoodForASite ( size_t  site) const
virtual

Get the logarithm of the likelihood for a site.

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

Implements bpp::TreeLikelihood.

Definition at line 194 of file RHomogeneousTreeLikelihood.cpp.

References getLikelihoodForASiteForARateClass(), bpp::DiscreteDistribution::getProbability(), bpp::AbstractHomogeneousTreeLikelihood::nbClasses_, and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

Referenced by getLogLikelihood().

double RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClass ( size_t  site,
size_t  rateClass 
) const
virtual

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.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 222 of file RHomogeneousTreeLikelihood.cpp.

References bpp::DRASRTreeLikelihoodData::getLikelihoodArray(), bpp::DRASRTreeLikelihoodData::getRootArrayPosition(), likelihoodData_, bpp::AbstractHomogeneousTreeLikelihood::nbStates_, bpp::AbstractHomogeneousTreeLikelihood::rootFreqs_, and bpp::AbstractTreeLikelihood::tree_.

double RHomogeneousTreeLikelihood::getLogLikelihoodForASiteForARateClassForAState ( size_t  site,
size_t  rateClass,
int  state 
) const
virtual

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

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 243 of file RHomogeneousTreeLikelihood.cpp.

References bpp::DRASRTreeLikelihoodData::getLikelihoodArray(), bpp::DRASRTreeLikelihoodData::getRootArrayPosition(), likelihoodData_, and bpp::AbstractTreeLikelihood::tree_.

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

Definition at line 124 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

virtual double bpp::TreeLikelihood::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::getLogLikelihoodForEachSiteForEachState().

virtual Vdouble bpp::TreeLikelihood::getLogLikelihoodForEachSite ( ) 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.

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

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForEachSiteForEachRateClass ( ) 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::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 138 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

VVVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodForEachSiteForEachRateClassForEachState ( ) 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::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 179 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

virtual VVdouble bpp::TreeLikelihood::getLogLikelihoodForEachSiteForEachState ( ) 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.

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

virtual double bpp::AbstractHomogeneousTreeLikelihood::getMaximumBranchLength ( ) const
inlinevirtualinherited
virtual double bpp::AbstractHomogeneousTreeLikelihood::getMinimumBranchLength ( ) const
inlinevirtualinherited
ConstBranchModelIterator* bpp::AbstractHomogeneousTreeLikelihood::getNewBranchModelIterator ( int  nodeId) const
inlinevirtualinherited
ConstSiteModelIterator* bpp::AbstractHomogeneousTreeLikelihood::getNewSiteModelIterator ( size_t  siteIndex) const
inlinevirtualinherited
ParameterList AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNonDerivableParameters ( ) const
virtualinherited

All non derivable parameters.

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

Returns
A ParameterList.

Implements bpp::TreeLikelihood.

Reimplemented in bpp::RHomogeneousClockTreeLikelihood.

Definition at line 82 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

References bpp::ParameterList::addParameters().

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

All non derivable parameters.

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

Returns
A ParameterList.

Implemented in bpp::RHomogeneousClockTreeLikelihood, and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

size_t bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses ( ) const
inlinevirtualinherited
size_t bpp::AbstractTreeLikelihood::getNumberOfSites ( ) const
inlinevirtualinherited
virtual size_t bpp::TreeLikelihood::getNumberOfSites ( ) const
pure virtualinherited

Get the number of sites in the dataset.

Returns
the number of sites in the dataset.

Implemented in bpp::AbstractTreeLikelihood.

Referenced by bpp::SubstitutionMappingTools::getNormalizationsPerBranch().

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

Implements bpp::TreeLikelihood.

Definition at line 165 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::SubstitutionModel::getNumberOfStates(), and bpp::AbstractHomogeneousTreeLikelihood::model_.

VVdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorProbabilitiesOfEachRate ( ) const
virtualinherited

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

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

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 202 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getPosteriorRateOfEachSite ( ) const
virtualinherited

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

Returns
A vector with all rates.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 220 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

vector< size_t > AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateClassWithMaxPostProbOfEachSite ( ) 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::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 239 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

const DiscreteDistribution* 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::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 106 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

References bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_.

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

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

ParameterList bpp::AbstractHomogeneousTreeLikelihood::getRateDistributionParameters ( ) const
inlinevirtualinherited

Get the parameters associated to the rate distirbution.

Returns
A ParameterList object with all rate distribution parameters.

Reimplemented from bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 177 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistributionParameters().

Vdouble AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateWithMaxPostProbOfEachSite ( ) const
virtualinherited

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

Returns
A vector with all rate classes indexes.

Implements bpp::DiscreteRatesAcrossSitesTreeLikelihood.

Definition at line 253 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

const std::vector<double>& bpp::AbstractHomogeneousTreeLikelihood::getRootFrequencies ( size_t  siteIndex) const
inlinevirtualinherited

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

Definition at line 182 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::SubstitutionModel::getFrequencies(), and bpp::AbstractHomogeneousTreeLikelihood::model_.

double RHomogeneousTreeLikelihood::getSecondOrderDerivative ( const std::string &  variable) const
throw (Exception
)
virtual

Implements bpp::DerivableSecondOrder.

Definition at line 601 of file RHomogeneousTreeLikelihood.cpp.

double bpp::RHomogeneousTreeLikelihood::getSecondOrderDerivative ( const std::string &  variable1,
const std::string &  variable2 
) const
throw (Exception
)
inlinevirtual

Implements bpp::DerivableSecondOrder.

Definition at line 217 of file RHomogeneousTreeLikelihood.h.

size_t bpp::RHomogeneousTreeLikelihood::getSiteIndex ( size_t  site) const
throw (IndexOutOfBoundsException
)
inlinevirtual

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.

Implements bpp::TreeLikelihood.

Definition at line 201 of file RHomogeneousTreeLikelihood.h.

References bpp::DRASRTreeLikelihoodData::getRootArrayPosition(), and likelihoodData_.

const SubstitutionModel* bpp::AbstractHomogeneousTreeLikelihood::getSubstitutionModel ( ) const
inlinevirtualinherited
Returns
The substitution model attached to this instance.

Implements bpp::HomogeneousTreeLikelihood.

Definition at line 205 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::AbstractHomogeneousTreeLikelihood::model_.

const SubstitutionModel* bpp::AbstractHomogeneousTreeLikelihood::getSubstitutionModel ( int  nodeId,
size_t  siteIndex 
) const
throw (NodeNotFoundException
)
inlinevirtualinherited

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

Definition at line 206 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::AbstractHomogeneousTreeLikelihood::model_.

SubstitutionModel* bpp::AbstractHomogeneousTreeLikelihood::getSubstitutionModel ( )
inlinevirtualinherited
Returns
The substitution model attached to this instance.

Implements bpp::HomogeneousTreeLikelihood.

Definition at line 208 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::AbstractHomogeneousTreeLikelihood::model_.

SubstitutionModel* bpp::AbstractHomogeneousTreeLikelihood::getSubstitutionModel ( int  nodeId,
size_t  siteIndex 
)
throw (NodeNotFoundException
)
inlinevirtualinherited

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

Definition at line 209 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::AbstractHomogeneousTreeLikelihood::model_.

ParameterList AbstractHomogeneousTreeLikelihood::getSubstitutionModelParameters ( ) const
virtualinherited

Get the parameters associated to substitution model(s).

Returns
A ParameterList.

Implements bpp::TreeLikelihood.

Definition at line 259 of file AbstractHomogeneousTreeLikelihood.cpp.

References bpp::AbstractTreeLikelihood::initialized_, and bpp::AbstractHomogeneousTreeLikelihood::model_.

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

Definition at line 311 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.cpp.

virtual VVdouble bpp::TreeLikelihood::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.

VVVdouble bpp::AbstractHomogeneousTreeLikelihood::getTransitionProbabilitiesPerRateClass ( int  nodeId,
size_t  siteIndex 
) const
inlinevirtualinherited

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

Definition at line 184 of file AbstractHomogeneousTreeLikelihood.h.

References bpp::AbstractHomogeneousTreeLikelihood::pxy_.

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

Get the tree (topology and branch lengths).

Returns
The tree of this TreeLikelihood object.

Implements bpp::TreeLikelihood.

Definition at line 291 of file AbstractTreeLikelihood.h.

References bpp::AbstractTreeLikelihood::tree_.

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

double RHomogeneousTreeLikelihood::getValue ( ) const
throw (Exception
)
void RHomogeneousTreeLikelihood::init_ ( bool  usePatterns)
throw (Exception
)
private

Method called by constructors.

Definition at line 91 of file RHomogeneousTreeLikelihood.cpp.

void AbstractHomogeneousTreeLikelihood::initialize ( )
throw (Exception
)
virtualinherited

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::DRHomogeneousMixedTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

Definition at line 237 of file AbstractHomogeneousTreeLikelihood.cpp.

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

Referenced by bpp::OptimizationTools::buildDistanceTree(), bpp::RHomogeneousMixedTreeLikelihood::initialize(), and bpp::DRHomogeneousMixedTreeLikelihood::initialize().

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

Implemented in bpp::AbstractTreeLikelihood.

bool bpp::AbstractTreeLikelihood::isInitialized ( ) const
inlinevirtualinherited
void RHomogeneousTreeLikelihood::setData ( const SiteContainer sites)
throw (Exception
)
virtual
void RHomogeneousTreeLikelihood::setParameters ( const ParameterList parameters)
throw (ParameterNotFoundException,
ConstraintException
)
virtual

Implements the Function interface.

Update the parameter list and call the applyParameters() method. Then compute the likelihoods at each node (computeLikelihood() method) and call the getLogLikelihood() method.

If a subset of the whole parameter list is passed to the function, only these parameters are updated and the other remain constant (i.e. equal to their last value).

Parameters
parametersThe parameter list to pass to the function.

Implements bpp::Function.

Definition at line 250 of file RHomogeneousTreeLikelihood.cpp.

void AbstractHomogeneousTreeLikelihood::setSubstitutionModel ( SubstitutionModel model)
throw (Exception
)
virtualinherited
Returns
Set the substitution model for this instance.
Exceptions
ExceptionIf the model could not be set (for instance, because of a wrong alphabet type).

Implements bpp::HomogeneousTreeLikelihood.

Definition at line 172 of file AbstractHomogeneousTreeLikelihood.cpp.

References bpp::Node::getId().

Friends And Related Function Documentation

friend class RHomogeneousMixedTreeLikelihood
friend

Definition at line 269 of file RHomogeneousTreeLikelihood.h.

Member Data Documentation

double bpp::RHomogeneousTreeLikelihood::minusLogLik_
protected
size_t bpp::AbstractHomogeneousTreeLikelihood::nbSites_
protectedinherited
DiscreteDistribution* bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::rateDistribution_
protectedinherited

Definition at line 61 of file AbstractDiscreteRatesAcrossSitesTreeLikelihood.h.

Referenced by bpp::AbstractHomogeneousTreeLikelihood::applyParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::applyParameters(), bpp::TwoTreeLikelihood::applyParameters(), bpp::DRHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::DRNonHomogeneousTreeLikelihood::computeRootLikelihood(), bpp::AbstractHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::AbstractNonHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::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(), fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::TwoTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::getD2LikelihoodForASite(), getD2LikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getDLikelihoodForASite(), getDLikelihoodForASite(), getLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLikelihoodForASite(), getLogLikelihoodForASite(), bpp::RNonHomogeneousTreeLikelihood::getLogLikelihoodForASite(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNumberOfClasses(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getRateDistribution(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), bpp::AbstractHomogeneousTreeLikelihood::initParameters(), bpp::AbstractNonHomogeneousTreeLikelihood::initParameters(), bpp::TwoTreeLikelihood::initParameters(), and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::operator=().

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

Definition at line 226 of file AbstractTreeLikelihood.h.

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

bool bpp::AbstractHomogeneousTreeLikelihood::verbose_
protectedinherited

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