bpp-phyl3
3.0.0
|
The TreeLikelihood interface. More...
#include <Bpp/Phyl/Legacy/Likelihood/TreeLikelihood.h>
Classes | |
class | BranchIterator |
An iterator over a set of branches, specified by their node ids. More... | |
class | ConstBranchModelDescription |
A pair of SubstitutionModel / SiteIterator. More... | |
class | ConstBranchModelIterator |
Iterates through all models used for all sites on a given branch. More... | |
class | ConstSiteModelDescription |
A pair of SubstitutionModel / BranchIterator. More... | |
class | ConstSiteModelIterator |
Iterates through all models used for all branches on a given site. More... | |
class | SiteIterator |
An iterator over a set of sites, specified by their position. More... | |
Public Member Functions | |
TreeLikelihoodInterface () | |
virtual | ~TreeLikelihoodInterface () |
TreeLikelihoodInterface * | clone () const override=0 |
virtual void | setData (const AlignmentDataInterface &sites)=0 |
Set the dataset for which the likelihood must be evaluated. More... | |
virtual const AlignmentDataInterface & | data () const =0 |
Get the dataset for which the likelihood must be evaluated. More... | |
virtual void | initialize ()=0 |
Init the likelihood object. More... | |
virtual bool | isInitialized () const =0 |
virtual bool | hasLikelihoodData () const =0 |
virtual TreeLikelihoodData & | likelihoodData ()=0 |
virtual const TreeLikelihoodData & | likelihoodData () 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 Tree & | tree () 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 std::shared_ptr< 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... | |
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 ¶meters) |
virtual double | d2f (const std::string &variable1, const std::string &variable2, const ParameterList ¶meters) |
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 ¶meters) |
virtual void | setParameters (const ParameterList ¶meters)=0 |
virtual double | getValue () const=0 |
virtual double | f (const ParameterList ¶meters) |
virtual bool | hasParameter (const std::string &name) const=0 |
virtual const ParameterList & | getParameters () const=0 |
virtual const Parameter & | parameter (const std::string &name) const=0 |
virtual double | getParameterValue (const std::string &name) const=0 |
virtual void | setAllParametersValues (const ParameterList ¶meters)=0 |
virtual void | setParameterValue (const std::string &name, double value)=0 |
virtual void | setParametersValues (const ParameterList ¶meters)=0 |
virtual bool | matchParametersValues (const ParameterList ¶meters)=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 |
Retrieve some particular parameters subsets. | |
virtual ParameterList | getBranchLengthsParameters () const =0 |
Get the branch lengths parameters. More... | |
virtual ParameterList | getSubstitutionModelParameters () const =0 |
Get the parameters associated to substitution model(s). More... | |
virtual std::shared_ptr< const TransitionModelInterface > | getModelForSite (int nodeId, size_t siteIndex) const =0 |
Get the substitution model associated to a given node and alignment column. More... | |
virtual std::shared_ptr< TransitionModelInterface > | getModelForSite (int nodeId, size_t siteIndex)=0 |
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 ConstBranchModelIterator * | getNewBranchModelIterator (int nodeId) const =0 |
virtual ConstSiteModelIterator * | getNewSiteModelIterator (size_t siteIndex) const =0 |
virtual size_t | getSiteIndex (size_t site) const =0 |
Get the index (used for inner computations) of a given site (original alignment column). More... | |
virtual const std::vector< double > & | getRootFrequencies (size_t siteIndex) const =0 |
Get the values of the frequencies for each state in the alphabet at the root node. More... | |
Protected Member Functions | |
virtual ParameterList & | getParameters_ ()=0 |
The TreeLikelihood interface.
This interface defines the methods needed for computing the likelihood of a phylogenetic tree, given a dataset.
Definition at line 28 of file TreeLikelihood.h.
|
inline |
Definition at line 135 of file TreeLikelihood.h.
|
inlinevirtual |
Definition at line 136 of file TreeLikelihood.h.
|
overridepure virtual |
Implements bpp::SecondOrderDerivable.
Implemented in bpp::NonHomogeneousTreeLikelihood, bpp::DRTreeLikelihoodInterface, bpp::NNIHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::HomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RNonHomogeneousMixedTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
|
pure virtual |
Get the dataset for which the likelihood must be evaluated.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Tell if derivatives must be computed.
This methods calls the enableFirstOrderDerivatives and enableSecondOrderDerivatives.
yn | Yes or no. |
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Get the alphabet associated to the dataset.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtual |
Get the branch lengths parameters.
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getDerivableParameters().
|
pure virtual |
All derivable parameters.
Usually, this contains all branch lengths parameters.
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
|
pure virtual |
Get the likelihood for the whole dataset.
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
|
pure virtual |
Get the likelihood for a site.
site | The site index to analyse. |
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
Referenced by bpp::AbstractTreeLikelihood::getLikelihoodPerSite().
|
pure virtual |
Get the likelihood for a site and for a state.
site | The site index to analyse. |
state | The state to consider. |
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
Referenced by bpp::AbstractTreeLikelihood::getLikelihoodPerSitePerState().
|
pure virtual |
Get the likelihood for each site.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Get the likelihood for each site and for each state.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Get the logarithm of the likelihood for the whole dataset.
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
|
pure virtual |
Get the logarithm of the likelihood for a site.
site | The site index to analyse. |
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
Referenced by bpp::AbstractTreeLikelihood::getLogLikelihoodPerSite().
|
pure virtual |
Get the logarithm of the likelihood for a site and for a state.
site | The site index to analyse. |
state | The state to consider. |
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
Referenced by bpp::AbstractTreeLikelihood::getLogLikelihoodPerSitePerState().
|
pure virtual |
Get the logarithm of the likelihood for each site.
Implemented in bpp::AbstractTreeLikelihood.
Referenced by bpp::PairedSiteLikelihoods::appendModel().
|
pure virtual |
Get the logarithm of the likelihood for each site and for each state.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Get the substitution model associated to a given node and alignment column.
nodeId | The id of the request node. |
siteIndex | The index of the alignment position. |
Implemented in bpp::NonHomogeneousTreeLikelihood, and bpp::HomogeneousTreeLikelihood.
|
pure virtual |
Get the substitution model associated to a given node and alignment column.
nodeId | The id of the request node. |
siteIndex | The index of the alignment position. |
NodeNotFoundException | This exception may be thrown if the node is not found (depending on the implementation). |
Implemented in bpp::NonHomogeneousTreeLikelihood, and bpp::HomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtual |
All non derivable parameters.
Usually, this contains all substitution model parameters and rate distribution.
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
|
pure virtual |
Get the number of sites in the dataset.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies(), bpp::TreeLikelihoodTools::getAncestralFrequencies_(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLikelihoodPerSitePerRateClassPerState(), bpp::AbstractTreeLikelihood::getLikelihoodPerSitePerState(), bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getLogLikelihoodPerSitePerRateClassPerState(), bpp::AbstractTreeLikelihood::getLogLikelihoodPerSitePerState(), bpp::DRTreeLikelihoodTools::getPosteriorProbabilitiesPerStatePerRate(), bpp::DRTreeLikelihoodTools::getPosteriorStateFrequencies(), and bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getTransitionProbabilities().
|
pure virtual |
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.
siteIndex | The index of the alignment position. |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().
|
pure virtual |
Get the index (used for inner computations) of a given site (original alignment column).
site | An alignment position. |
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().
|
pure virtual |
Get the parameters associated to substitution model(s).
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNonDerivableParameters().
|
pure virtual |
Retrieves all Pij(t) for a particular branch, defined by the upper node and site.
These intermediate results may be used by other methods.
nodeId | The node defining the branch of interest. |
siteIndex | The index of the alignment position. |
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies_().
|
pure virtual |
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
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.
Exception | if something bad happened, for instance if no data are associated to the likelihood function. |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, bpp::RNonHomogeneousMixedTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRHomogeneousMixedTreeLikelihood, bpp::AbstractTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Implemented in bpp::DRTreeLikelihoodInterface, bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::DRTreeLikelihoodInterface, bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().
|
pure virtual |
Set the dataset for which the likelihood must be evaluated.
sites | The data set to use. |
Implemented in bpp::NNIHomogeneousTreeLikelihood, bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RNonHomogeneousMixedTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::RHomogeneousMixedTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
Referenced by bpp::AbstractHomogeneousTreeLikelihood::setModel(), and bpp::AbstractNonHomogeneousTreeLikelihood::setSubstitutionModelSet().
|
pure virtual |
Get the tree (topology and branch lengths).
Implemented in bpp::AbstractTreeLikelihood.
Referenced by bpp::PairedSiteLikelihoods::appendModel(), bpp::TreeLikelihoodTools::getAncestralFrequencies(), bpp::TreeLikelihoodTools::getAncestralFrequencies_(), and bpp::DRTreeLikelihoodTools::getPosteriorProbabilitiesPerStatePerRate().