bpp-phyl  2.2.0
bpp::ClockTreeLikelihood Class Referenceabstract

Interface for likelihood computation with a global clock. More...

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

+ Inheritance diagram for bpp::ClockTreeLikelihood:
+ Collaboration diagram for bpp::ClockTreeLikelihood:

Public Member Functions

ClockTreeLikelihoodclone () const =0
 
virtual ~ClockTreeLikelihood ()
 
virtual void setData (const SiteContainer &sites)=0
 Set the dataset for which the likelihood must be evaluated. More...
 
virtual const SiteContainer * getData () const =0
 Get the dataset for which the likelihood must be evaluated. More...
 
virtual void initialize ()=0 throw (Exception)
 Init the likelihood object. More...
 
virtual bool isInitialized () const =0
 
virtual TreeLikelihoodDatagetLikelihoodData ()=0
 
virtual const TreeLikelihoodDatagetLikelihoodData () const =0
 
virtual double getLikelihoodForASite (size_t site) const =0
 Get the likelihood for a site. More...
 
virtual double getLogLikelihoodForASite (size_t site) const =0
 Get the logarithm of the likelihood for a site. More...
 
virtual double 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 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 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 size_t getNumberOfStates () const =0
 
virtual int getAlphabetStateAsInt (size_t i) const =0
 
virtual std::string getAlphabetStateAsChar (size_t i) const =0
 
virtual const std::vector< int > & getAlphabetStates () const =0
 
virtual const Alphabet * getAlphabet () 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...
 
Retrieve some particular parameters subsets.
virtual ParameterList getBranchLengthsParameters () const =0
 Get the branch lengths parameters. More...
 
virtual ParameterList getSubstitutionModelParameters () const =0
 Get the parameters associated to substitution model(s). More...
 
virtual const SubstitutionModelgetSubstitutionModel (int nodeId, size_t siteIndex) const =0 throw (NodeNotFoundException)
 Get the substitution model associated to a given node and alignment column. More...
 
virtual SubstitutionModelgetSubstitutionModel (int nodeId, size_t siteIndex)=0 throw (NodeNotFoundException)
 Get the substitution model associated to a given node and alignment column. More...
 
virtual 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 ConstBranchModelIteratorgetNewBranchModelIterator (int nodeId) const =0
 
virtual ConstSiteModelIteratorgetNewSiteModelIterator (size_t siteIndex) const =0
 
virtual size_t getSiteIndex (size_t site) const =0 throw (IndexOutOfBoundsException)
 Get the index (used for inner computations) of a given site (original alignment column). More...
 
virtual const std::vector< double > & getRootFrequencies (size_t siteIndex) const =0
 Get the values of the frequencies for each state in the alphabet at the root node. More...
 

Detailed Description

Interface for likelihood computation with a global clock.

Deprecated:
See GlobalClockTreeLikelihoodFunctionWrapper as a more general replacement.

Definition at line 58 of file ClockTreeLikelihood.h.

Constructor & Destructor Documentation

◆ ~ClockTreeLikelihood()

virtual bpp::ClockTreeLikelihood::~ClockTreeLikelihood ( )
inlinevirtual

Definition at line 66 of file ClockTreeLikelihood.h.

Member Function Documentation

◆ clone()

ClockTreeLikelihood* bpp::ClockTreeLikelihood::clone ( ) const
pure virtual

◆ enableDerivatives()

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.

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

◆ getAlphabetStateAsChar()

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

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

◆ getAlphabetStateAsInt()

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

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

◆ getAlphabetStates()

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

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

◆ getBranchLengthsParameters()

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

Get the branch lengths parameters.

Returns
A ParameterList with all branch lengths.

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

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

◆ getData()

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.

◆ getDerivableParameters()

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.

◆ getLikelihood()

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

◆ getLikelihoodData() [1/2]

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

◆ getLikelihoodData() [2/2]

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

◆ getLikelihoodForASite()

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

◆ getLikelihoodForASiteForAState()

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

◆ getLikelihoodForEachSite()

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.

◆ getLikelihoodForEachSiteForEachState()

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.

◆ getLogLikelihood()

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

Get the logarithm of the likelihood for the whole dataset.

Returns
The logarithm of the likelihood of the dataset.

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

◆ getLogLikelihoodForASite()

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

Get the logarithm of the likelihood for a site.

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

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

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

◆ getLogLikelihoodForASiteForAState()

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

◆ getLogLikelihoodForEachSite()

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.

◆ getLogLikelihoodForEachSiteForEachState()

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.

◆ getNewBranchModelIterator()

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

◆ getNewSiteModelIterator()

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

◆ getNonDerivableParameters()

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.

◆ getNumberOfSites()

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

◆ getNumberOfStates()

◆ getRootFrequencies()

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

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

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

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

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

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

◆ getSiteIndex()

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

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

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

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

◆ getSubstitutionModel() [1/2]

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

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

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

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

◆ getSubstitutionModel() [2/2]

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

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

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

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

◆ getSubstitutionModelParameters()

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

Get the parameters associated to substitution model(s).

Returns
A ParameterList.

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

◆ getTransitionProbabilities()

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.

◆ getTree()

◆ initialize()

virtual void bpp::TreeLikelihood::initialize ( )
throw (Exception
)
pure 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.

Implemented in bpp::AbstractTreeLikelihood, bpp::RNonHomogeneousMixedTreeLikelihood, bpp::AbstractNonHomogeneousTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, bpp::AbstractHomogeneousTreeLikelihood, bpp::TwoTreeLikelihood, and bpp::RHomogeneousMixedTreeLikelihood.

◆ isInitialized()

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

Implemented in bpp::AbstractTreeLikelihood.

◆ setData()

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

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