bpp-phyl3  3.0.0
bpp::AbstractAutonomousSubstitutionProcess Class Referenceabstract

A partial implementation of the SubstitutionProcess interface. More...

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

+ Inheritance diagram for bpp::AbstractAutonomousSubstitutionProcess:
+ Collaboration diagram for bpp::AbstractAutonomousSubstitutionProcess:

Public Member Functions

void setPhyloTree (const PhyloTree &phyloTree)
 sets the ParametrizablePhyloTree. More...
 
const ParametrizablePhyloTreeparametrizablePhyloTree () const
 
std::shared_ptr< const ParametrizablePhyloTreegetParametrizablePhyloTree () const
 
bool hasRootFrequencySet () const
 
const FrequencySetInterfacerootFrequencySet () const
 
std::shared_ptr< const FrequencySetInterfacegetRootFrequencySet () const
 
FrequencySetInterfacerootFrequencySet ()
 
std::shared_ptr< FrequencySetInterfacegetRootFrequencySet ()
 
void setRootFrequencySet (std::shared_ptr< FrequencySetInterface > rootfrequency)
 set the RootFrequency. More...
 
ParameterList getRootFrequenciesParameters (bool independent) const
 Get the parameters corresponding to the root frequencies. More...
 
void fireParameterChanged (const ParameterList &pl)
 AbsractParametrizable interface. More...
 
std::shared_ptr< const ModelScenariogetModelScenario () const
 get the ModelScenario. More...
 
virtual void setModelScenario (std::shared_ptr< ModelScenario > modelScenario)=0
 set the ModelScenario. More...
 
virtual SubstitutionProcessInterfaceclone () const =0
 
virtual const StateMapInterfacestateMap () const =0
 
virtual std::shared_ptr< const StateMapInterfacegetStateMap () const =0
 
virtual bool isCompatibleWith (const AlignmentDataInterface &data) const =0
 
virtual size_t getNumberOfClasses () const =0
 
virtual size_t getNumberOfStates () const =0
 
virtual size_t getNumberOfModels () const =0
 
virtual std::vector< size_t > getModelNumbers () const =0
 
virtual const BranchModelInterfacemodel (size_t i) const =0
 
virtual const BranchModelInterfacemodel (unsigned int nodeId, size_t classIndex) const =0
 Get the substitution model corresponding to a certain branch, site pattern, and model class. More...
 
virtual std::shared_ptr< const BranchModelInterfacegetModel (size_t i) const =0
 
virtual std::shared_ptr< const BranchModelInterfacegetModel (unsigned int nodeId, size_t classIndex) const =0
 Get the substitution model corresponding to a certain branch, site pattern, and model class. More...
 
virtual const std::vector< unsigned int > getNodesWithModel (size_t i) const =0
 Get a list of nodes id for which the given model is associated. More...
 
virtual size_t getModelNumberForNode (unsigned int nodeId) const =0
 Get the number of the model associated to a particular node id. More...
 
virtual std::shared_ptr< const BranchModelInterfacegetModelForNode (unsigned int nodeId) const =0
 Get the model associated to a particular node id. More...
 
virtual const DiscreteDistributionInterfacerateDistribution () const =0
 Get the rate distribution. More...
 
virtual DiscreteDistributionInterfacerateDistribution ()=0
 Get the rate distribution. More...
 
virtual std::shared_ptr< const DiscreteDistributionInterfacegetRateDistribution () const =0
 Get a pointer to the rate distribution (or null if there is no rate distribution). More...
 
virtual std::shared_ptr< DiscreteDistributionInterfacegetRateDistribution ()=0
 Get a pointer to the rate distribution (or null if there is no rate distribution). More...
 
virtual ParameterList getSubstitutionModelParameters (bool independent) const =0
 Methods to retrieve the parameters of specific objects. More...
 
virtual ParameterList getRateDistributionParameters (bool independent) const =0
 
virtual ParameterList getBranchLengthParameters (bool independent) const =0
 
virtual ParameterList getNonDerivableParameters () const =0
 
virtual const std::vector< double > & getRootFrequencies () const =0
 Get the values of the frequencies for each state in the alphabet at the root node. More...
 
virtual double getProbabilityForModel (size_t classIndex) const =0
 
virtual Vdouble getClassProbabilities () const =0
 
virtual double getRateForModel (size_t classIndex) const =0
 
virtual size_t getNumberOfIndependentParameters () const=0
 
virtual void aliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)=0
 
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual const ParameterListgetIndependentParameters () const=0
 
virtual std::vector< std::string > getAlias (const std::string &name) const=0
 
virtual std::map< std::string, std::string > getAliases () const=0
 
virtual bool hasParameter (const std::string &name) const=0
 
virtual const ParameterListgetParameters () const=0
 
virtual const Parameterparameter (const std::string &name) const=0
 
virtual double getParameterValue (const std::string &name) const=0
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
virtual void setParameterValue (const std::string &name, double value)=0
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
virtual void removeConstraint (const std::string &name)=0
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
virtual size_t getNumberOfParameters () const=0
 
virtual void setNamespace (const std::string &prefix)=0
 
virtual std::string getNamespace () const=0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
size_t getNumberOfClasses () const
 
size_t getNumberOfStates () const
 
std::shared_ptr< const AlphabetgetAlphabet () const
 
bool isCompatibleWith (const AlignmentDataInterface &data) const
 
ParameterList getNonDerivableParameters () const
 get NonDerivable parameters More...
 
virtual Clonableclone () const=0
 
size_t getNumberOfIndependentParameters () const
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
const ParameterListgetIndependentParameters () const
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
void setNamespace (const std::string &prefix)
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
bool hasIndependentParameter (const std::string &name) const
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
std::string getFrom (const std::string &name) const
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 

Protected Member Functions

 AbstractAutonomousSubstitutionProcess (std::shared_ptr< const PhyloTree > tree=0, std::shared_ptr< FrequencySetInterface > rootFrequencies=0, const std::string &prefix="")
 Builds using an optional pointer towards a PhyloTree. More...
 
 AbstractAutonomousSubstitutionProcess (std::shared_ptr< ParametrizablePhyloTree > tree, std::shared_ptr< FrequencySetInterface > rootFrequencies=0, const std::string &prefix="")
 Builds using a pointer towards a ParametrizablePhyloTree. This pointer will be owned by the AbstractAutonomousSubstitutionProcess. More...
 
 AbstractAutonomousSubstitutionProcess (const AbstractAutonomousSubstitutionProcess &asp)
 
AbstractAutonomousSubstitutionProcessoperator= (const AbstractAutonomousSubstitutionProcess &asp)
 
virtual ParameterListgetParameters_ ()=0
 
ParameterListgetParameters_ () override
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 

Protected Attributes

std::shared_ptr< ParametrizablePhyloTreepTree_
 
std::shared_ptr< FrequencySetInterfacerootFrequencies_
 Root frequencies. More...
 
std::shared_ptr< ModelScenariomodelScenario_
 

Private Attributes

ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 

Detailed Description

A partial implementation of the SubstitutionProcess interface.

This class OWNS a pointer toward a ParametrizableTree object, as well as convenient arrays for storing previously computed probabilities.

Definition at line 23 of file AbstractAutonomousSubstitutionProcess.h.

Constructor & Destructor Documentation

◆ AbstractAutonomousSubstitutionProcess() [1/3]

AbstractAutonomousSubstitutionProcess::AbstractAutonomousSubstitutionProcess ( std::shared_ptr< const PhyloTree tree = 0,
std::shared_ptr< FrequencySetInterface rootFrequencies = 0,
const std::string &  prefix = "" 
)
protected

Builds using an optional pointer towards a PhyloTree.

If the pointer is non-null, a ParametrizablePhyloTree will be built from this PhyloTree, and owned by the AbstractAutonomousSubstitutionProcess.

Definition at line 10 of file AbstractAutonomousSubstitutionProcess.cpp.

References bpp::AbstractParameterAliasable::addParameters_(), rootFrequencies_, and setPhyloTree().

◆ AbstractAutonomousSubstitutionProcess() [2/3]

AbstractAutonomousSubstitutionProcess::AbstractAutonomousSubstitutionProcess ( std::shared_ptr< ParametrizablePhyloTree tree,
std::shared_ptr< FrequencySetInterface rootFrequencies = 0,
const std::string &  prefix = "" 
)
protected

Builds using a pointer towards a ParametrizablePhyloTree. This pointer will be owned by the AbstractAutonomousSubstitutionProcess.

Definition at line 25 of file AbstractAutonomousSubstitutionProcess.cpp.

References bpp::AbstractParameterAliasable::addParameters_(), and rootFrequencies_.

◆ AbstractAutonomousSubstitutionProcess() [3/3]

AbstractAutonomousSubstitutionProcess::AbstractAutonomousSubstitutionProcess ( const AbstractAutonomousSubstitutionProcess asp)
protected

Definition at line 39 of file AbstractAutonomousSubstitutionProcess.cpp.

Member Function Documentation

◆ clone()

◆ fireParameterChanged()

◆ getAlphabet()

◆ getBranchLengthParameters()

◆ getClassProbabilities()

virtual Vdouble bpp::SubstitutionProcessInterface::getClassProbabilities ( ) const
pure virtualinherited

◆ getModel() [1/2]

virtual std::shared_ptr<const BranchModelInterface> bpp::SubstitutionProcessInterface::getModel ( size_t  i) const
pure virtualinherited

◆ getModel() [2/2]

virtual std::shared_ptr<const BranchModelInterface> bpp::SubstitutionProcessInterface::getModel ( unsigned int  nodeId,
size_t  classIndex 
) const
pure virtualinherited

Get the substitution model corresponding to a certain branch, site pattern, and model class.

Parameters
nodeIdThe id of the node.
classIndexThe model class index.
Returns
A shared pointer toward the model with given index.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ getModelForNode()

virtual std::shared_ptr<const BranchModelInterface> bpp::SubstitutionProcessInterface::getModelForNode ( unsigned int  nodeId) const
pure virtualinherited

Get the model associated to a particular node id.

Parameters
nodeIdThe id of the query node.
Returns
A pointer toward the corresponding model.
Exceptions
ExceptionIf no model is found for this node.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ getModelNumberForNode()

virtual size_t bpp::SubstitutionProcessInterface::getModelNumberForNode ( unsigned int  nodeId) const
pure virtualinherited

Get the number of the model associated to a particular node id.

Parameters
nodeIdThe id of the query node.
Returns
The number of the model associated to the given node.
Exceptions
ExceptionIf no model is found for this node.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ getModelNumbers()

virtual std::vector<size_t> bpp::SubstitutionProcessInterface::getModelNumbers ( ) const
pure virtualinherited

◆ getModelScenario()

std::shared_ptr<const ModelScenario> bpp::AbstractAutonomousSubstitutionProcess::getModelScenario ( ) const
inlinevirtual

◆ getNodesWithModel()

virtual const std::vector<unsigned int> bpp::SubstitutionProcessInterface::getNodesWithModel ( size_t  i) const
pure virtualinherited

Get a list of nodes id for which the given model is associated.

Parameters
iThe index of the model in the set.
Returns
A vector with the ids of the node associated to this model.
Exceptions
IndexOutOfBoundsExceptionIf the index is not valid.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

Referenced by bpp::OneProcessSequenceSubstitutionMapping::setBranchedModelSet_(), and bpp::SingleProcessSubstitutionMapping::setBranchedModelSet_().

◆ getNonDerivableParameters() [1/2]

ParameterList AbstractSubstitutionProcess::getNonDerivableParameters ( ) const
virtualinherited

get NonDerivable parameters

Implements bpp::SubstitutionProcessInterface.

Reimplemented in bpp::SubstitutionProcessCollectionMember.

Definition at line 10 of file AbstractSubstitutionProcess.cpp.

References bpp::ParameterList::includeParameters().

◆ getNonDerivableParameters() [2/2]

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

◆ getNumberOfClasses() [1/2]

size_t bpp::AbstractSubstitutionProcess::getNumberOfClasses ( ) const
inlinevirtualinherited

◆ getNumberOfClasses() [2/2]

virtual size_t bpp::SubstitutionProcessInterface::getNumberOfClasses ( ) const
pure virtualinherited

◆ getNumberOfModels()

virtual size_t bpp::SubstitutionProcessInterface::getNumberOfModels ( ) const
pure virtualinherited

◆ getNumberOfStates() [1/2]

size_t bpp::AbstractSubstitutionProcess::getNumberOfStates ( ) const
inlinevirtualinherited

◆ getNumberOfStates() [2/2]

virtual size_t bpp::SubstitutionProcessInterface::getNumberOfStates ( ) const
pure virtualinherited

◆ getParametrizablePhyloTree()

◆ getProbabilityForModel()

virtual double bpp::SubstitutionProcessInterface::getProbabilityForModel ( size_t  classIndex) const
pure virtualinherited
Returns
The probability associated to the given model class.
Parameters
classIndexThe model class index.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

Referenced by bpp::RewardMappingTools::computeRewardVectors().

◆ getRateDistribution() [1/2]

virtual std::shared_ptr<const DiscreteDistributionInterface> bpp::SubstitutionProcessInterface::getRateDistribution ( ) const
pure virtualinherited

◆ getRateDistribution() [2/2]

virtual std::shared_ptr<DiscreteDistributionInterface> bpp::SubstitutionProcessInterface::getRateDistribution ( )
pure virtualinherited

Get a pointer to the rate distribution (or null if there is no rate distribution).

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ getRateDistributionParameters()

◆ getRateForModel()

virtual double bpp::SubstitutionProcessInterface::getRateForModel ( size_t  classIndex) const
pure virtualinherited
Returns
The substitution rate associated to the given model class.
Parameters
classIndexThe model class index.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ getRootFrequencies()

virtual const std::vector<double>& bpp::SubstitutionProcessInterface::getRootFrequencies ( ) 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.

Returns
A vector with ancestral frequencies for each state in the alphabet;

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ getRootFrequenciesParameters()

ParameterList bpp::AbstractAutonomousSubstitutionProcess::getRootFrequenciesParameters ( bool  independent) const
inlinevirtual

Get the parameters corresponding to the root frequencies.

Returns
The parameters corresponding to the root frequencies.

Implements bpp::SubstitutionProcessInterface.

Definition at line 130 of file AbstractAutonomousSubstitutionProcess.h.

References hasRootFrequencySet(), and rootFrequencies_.

◆ getRootFrequencySet() [1/2]

std::shared_ptr<FrequencySetInterface> bpp::AbstractAutonomousSubstitutionProcess::getRootFrequencySet ( )
inlinevirtual
Returns
A pointer toward rhe set of parametrized root frequencies.

Implements bpp::SubstitutionProcessInterface.

Definition at line 106 of file AbstractAutonomousSubstitutionProcess.h.

References rootFrequencies_.

◆ getRootFrequencySet() [2/2]

std::shared_ptr<const FrequencySetInterface> bpp::AbstractAutonomousSubstitutionProcess::getRootFrequencySet ( ) const
inlinevirtual

◆ getStateMap()

virtual std::shared_ptr<const StateMapInterface> bpp::SubstitutionProcessInterface::getStateMap ( ) const
pure virtualinherited

◆ getSubstitutionModelParameters()

virtual ParameterList bpp::SubstitutionProcessInterface::getSubstitutionModelParameters ( bool  independent) const
pure virtualinherited

◆ hasRootFrequencySet()

bool bpp::AbstractAutonomousSubstitutionProcess::hasRootFrequencySet ( ) const
inlinevirtual

◆ isCompatibleWith() [1/2]

bool bpp::AbstractSubstitutionProcess::isCompatibleWith ( const AlignmentDataInterface data) const
inlinevirtualinherited

◆ isCompatibleWith() [2/2]

virtual bool bpp::SubstitutionProcessInterface::isCompatibleWith ( const AlignmentDataInterface data) const
pure virtualinherited

◆ model() [1/2]

◆ model() [2/2]

virtual const BranchModelInterface& bpp::SubstitutionProcessInterface::model ( unsigned int  nodeId,
size_t  classIndex 
) const
pure virtualinherited

Get the substitution model corresponding to a certain branch, site pattern, and model class.

Parameters
nodeIdThe id of the node.
classIndexThe model class index.
Returns
the model with given index.

Implemented in bpp::SubstitutionProcessCollectionMember, bpp::SimpleSubstitutionProcess, bpp::RateAcrossSitesSubstitutionProcess, and bpp::NonHomogeneousSubstitutionProcess.

◆ operator=()

◆ parametrizablePhyloTree()

const ParametrizablePhyloTree& bpp::AbstractAutonomousSubstitutionProcess::parametrizablePhyloTree ( ) const
inlinevirtual

Implements bpp::SubstitutionProcessInterface.

Definition at line 73 of file AbstractAutonomousSubstitutionProcess.h.

References pTree_.

◆ rateDistribution() [1/2]

virtual const DiscreteDistributionInterface& bpp::SubstitutionProcessInterface::rateDistribution ( ) const
pure virtualinherited

◆ rateDistribution() [2/2]

virtual DiscreteDistributionInterface& bpp::SubstitutionProcessInterface::rateDistribution ( )
pure virtualinherited

◆ rootFrequencySet() [1/2]

FrequencySetInterface& bpp::AbstractAutonomousSubstitutionProcess::rootFrequencySet ( )
inlinevirtual
Returns
The set of parametrized root frequencies.

Implements bpp::SubstitutionProcessInterface.

Definition at line 101 of file AbstractAutonomousSubstitutionProcess.h.

References rootFrequencies_.

◆ rootFrequencySet() [2/2]

const FrequencySetInterface& bpp::AbstractAutonomousSubstitutionProcess::rootFrequencySet ( ) const
inlinevirtual

◆ setModelScenario()

virtual void bpp::AbstractAutonomousSubstitutionProcess::setModelScenario ( std::shared_ptr< ModelScenario modelScenario)
pure virtual

◆ setPhyloTree()

void AbstractAutonomousSubstitutionProcess::setPhyloTree ( const PhyloTree phyloTree)
virtual

◆ setRootFrequencySet()

void bpp::AbstractAutonomousSubstitutionProcess::setRootFrequencySet ( std::shared_ptr< FrequencySetInterface rootfrequency)
inlinevirtual

set the RootFrequency.

Parameters
rootfrequencyThe root frequencies to be associated with this instance.

Implements bpp::AutonomousSubstitutionProcessInterface.

Definition at line 116 of file AbstractAutonomousSubstitutionProcess.h.

References bpp::AbstractParameterAliasable::addParameters_(), bpp::ParameterList::deleteParameters(), bpp::AbstractParameterAliasable::getParameters_(), and rootFrequencies_.

◆ stateMap()

virtual const StateMapInterface& bpp::SubstitutionProcessInterface::stateMap ( ) const
pure virtualinherited

Member Data Documentation

◆ modelScenario_

◆ pTree_

std::shared_ptr<ParametrizablePhyloTree> bpp::AbstractAutonomousSubstitutionProcess::pTree_
protected

◆ rootFrequencies_

std::shared_ptr<FrequencySetInterface> bpp::AbstractAutonomousSubstitutionProcess::rootFrequencies_
protected

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