bpp-phyl3
3.0.0
|
Specialization of the TreeLikelihood interface for the branch non-homogeneous and non-stationary models. More...
#include <Bpp/Phyl/Legacy/Likelihood/NonHomogeneousTreeLikelihood.h>
Public Member Functions | |
NonHomogeneousTreeLikelihood * | clone () const override=0 |
std::shared_ptr< const TransitionModelInterface > | getModelForSite (int nodeId, size_t siteIndex) const override |
Get the substitution model associated to a given node and alignment column. More... | |
std::shared_ptr< TransitionModelInterface > | getModelForSite (int nodeId, size_t siteIndex) override |
Get the substitution model associated to a given node and alignment column. More... | |
virtual std::shared_ptr< const TransitionModelInterface > | getModelForNode (int nodeId) const =0 |
Get the model associated to a given node. More... | |
virtual std::shared_ptr< TransitionModelInterface > | getModelForNode (int nodeId)=0 |
Get the substitution model associated to a given node. More... | |
virtual std::shared_ptr< const SubstitutionModelSet > | getSubstitutionModelSet () const =0 |
virtual const SubstitutionModelSet & | substitutionModelSet () const =0 |
virtual std::shared_ptr< SubstitutionModelSet > | getSubstitutionModelSet ()=0 |
virtual SubstitutionModelSet & | substitutionModelSet ()=0 |
virtual void | setSubstitutionModelSet (std::shared_ptr< SubstitutionModelSet > model)=0 |
virtual ParameterList | getRootFrequenciesParameters () const =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 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 |
Specialization of the TreeLikelihood interface for the branch non-homogeneous and non-stationary models.
The main difference is that the likelihood depends on the position of the root. The frequencies at the root of the tree are new parameters, which are not necessarily equal to the equilibrium frequencies of the substitution model.
This interface further assumes that the substitution model is the same for all sites, for a given branch.
Definition at line 25 of file NonHomogeneousTreeLikelihood.h.
|
overridepure virtual |
Implements bpp::TreeLikelihoodInterface.
Implemented in bpp::RNonHomogeneousTreeLikelihood, bpp::RNonHomogeneousMixedTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.
|
pure virtualinherited |
Get the dataset for which the likelihood must be evaluated.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
Tell if derivatives must be computed.
This methods calls the enableFirstOrderDerivatives and enableSecondOrderDerivatives.
yn | Yes or no. |
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
Get the alphabet associated to the dataset.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtualinherited |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtualinherited |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtualinherited |
Get the branch lengths parameters.
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getDerivableParameters().
|
pure virtualinherited |
All derivable parameters.
Usually, this contains all branch lengths parameters.
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
|
pure virtualinherited |
Get the likelihood for the whole dataset.
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
|
pure virtualinherited |
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 virtualinherited |
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 virtualinherited |
Get the likelihood for each site.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
Get the likelihood for each site and for each state.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
Get the logarithm of the likelihood for the whole dataset.
Implemented in bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, bpp::DRNonHomogeneousTreeLikelihood, and bpp::DRHomogeneousMixedTreeLikelihood.
|
pure virtualinherited |
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 virtualinherited |
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 virtualinherited |
Get the logarithm of the likelihood for each site.
Implemented in bpp::AbstractTreeLikelihood.
Referenced by bpp::PairedSiteLikelihoods::appendModel().
|
pure virtualinherited |
Get the logarithm of the likelihood for each site and for each state.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtual |
Get the model associated to a given node.
nodeId | The id of the request node. |
NodeNotFoundException | This exception may be thrown if the node is not found (depending on the implementation). |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
Referenced by getModelForSite().
|
pure virtual |
Get the substitution model associated to a given node.
nodeId | The id of the request node. |
NodeNotFoundException | This exception may be thrown if the node is not found (depending on the implementation). |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
inlineoverridevirtual |
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. |
Implements bpp::TreeLikelihoodInterface.
Definition at line 32 of file NonHomogeneousTreeLikelihood.h.
References getModelForNode().
|
inlineoverridevirtual |
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). |
Implements bpp::TreeLikelihoodInterface.
Definition at line 37 of file NonHomogeneousTreeLikelihood.h.
References getModelForNode().
|
pure virtualinherited |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtualinherited |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
|
pure virtualinherited |
All non derivable parameters.
Usually, this contains all substitution model parameters and rate distribution.
Implemented in bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood.
|
pure virtualinherited |
Get the number of sites in the dataset.
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
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 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.
siteIndex | The index of the alignment position. |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
pure virtualinherited |
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 virtualinherited |
Get the parameters associated to substitution model(s).
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood, and bpp::AbstractHomogeneousTreeLikelihood.
Referenced by bpp::AbstractDiscreteRatesAcrossSitesTreeLikelihood::getNonDerivableParameters().
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
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.
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 virtualinherited |
Implemented in bpp::AbstractTreeLikelihood.
|
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.
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 virtualinherited |
Implemented in bpp::AbstractTreeLikelihood.
|
pure virtualinherited |
Implemented in bpp::DRTreeLikelihoodInterface, bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.
|
pure virtualinherited |
Implemented in bpp::DRTreeLikelihoodInterface, bpp::DRHomogeneousTreeLikelihood, bpp::RNonHomogeneousTreeLikelihood, bpp::RHomogeneousTreeLikelihood, and bpp::DRNonHomogeneousTreeLikelihood.
Referenced by bpp::TreeLikelihoodTools::getAncestralFrequencies().
|
pure virtualinherited |
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 |
Exception | If the model could not be set (for instance, because of a wrong alphabet type). |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
pure virtual |
Implemented in bpp::AbstractNonHomogeneousTreeLikelihood.
|
pure virtualinherited |
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().