bpp-phyl3  3.0.0
bpp::NonHomogeneousSubstitutionProcess Class Referenceabstract

Substitution process manager for non-homogeneous / non-reversible models of evolution. More...

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

+ Inheritance diagram for bpp::NonHomogeneousSubstitutionProcess:
+ Collaboration diagram for bpp::NonHomogeneousSubstitutionProcess:

Public Member Functions

 NonHomogeneousSubstitutionProcess (std::shared_ptr< DiscreteDistributionInterface > rdist, std::shared_ptr< const PhyloTree > tree=0, std::shared_ptr< FrequencySetInterface > rootFreqs=0)
 Create a model set according to the specified alphabet and root frequencies. Stationarity is not assumed. More...
 
 NonHomogeneousSubstitutionProcess (std::shared_ptr< DiscreteDistributionInterface > rdist, std::shared_ptr< ParametrizablePhyloTree > tree, std::shared_ptr< FrequencySetInterface > rootFreqs=0)
 Create a model set according to the specified alphabet and root frequencies. Stationarity is not assumed. More...
 
 NonHomogeneousSubstitutionProcess (const NonHomogeneousSubstitutionProcess &set)
 
NonHomogeneousSubstitutionProcessoperator= (const NonHomogeneousSubstitutionProcess &set)
 
virtual ~NonHomogeneousSubstitutionProcess ()
 
NonHomogeneousSubstitutionProcessclone () const override
 
void clear ()
 Resets all the information contained in this object. More...
 
void fireParameterChanged (const ParameterList &parameters) override
 
const StateMapInterfacestateMap () const override
 
std::shared_ptr< const StateMapInterfacegetStateMap () const override
 
size_t getNumberOfModels () const override
 
bool hasMixedTransitionModel () const
 
void setModelScenario (std::shared_ptr< ModelScenario > modelscenario) override
 Set the modelPath, after checking it is valid (ie modelpath has only the model of the process). More...
 
std::vector< size_t > getModelNumbers () const override
 
const BranchModelInterfacemodel (size_t n) const override
 
std::shared_ptr< const BranchModelInterfacegetModel (size_t n) const override
 
std::shared_ptr< const BranchModelInterfacegetModel (size_t n)
 
size_t getModelNumberForNode (unsigned int nodeId) const override
 Get the number of the model associated to a particular node id. More...
 
std::shared_ptr< const BranchModelInterfacegetModelForNode (unsigned int nodeId) const override
 Get the model associated to a particular node id. More...
 
const std::vector< unsigned int > getNodesWithModel (size_t i) const override
 Get a list of nodes id for which the given model is associated. More...
 
void addModel (std::shared_ptr< BranchModelInterface > model, const std::vector< unsigned int > &nodesId)
 Add a new model to the set, and set relationships with nodes and params. More...
 
void setModel (std::shared_ptr< BranchModelInterface > model, size_t modelIndex)
 Change a given model. More...
 
void setModelToNode (size_t modelIndex, unsigned int nodeNumber)
 Associate an existing model with a given node. More...
 
void listModelNames (std::ostream &out=std::cout) const
 list all model names. More...
 
ParameterList getBranchLengthParameters (bool independent) const override
 
ParameterList getRateDistributionParameters (bool independent) const override
 Get the parameters attached to the rate distribution. More...
 
const DiscreteDistributionInterfacerateDistribution () const override
 Get the rate distribution. More...
 
DiscreteDistributionInterfacerateDistribution () override
 Get the rate distribution. More...
 
std::shared_ptr< const DiscreteDistributionInterfacegetRateDistribution () const override
 Get a pointer to the rate distribution (or null if there is no rate distribution). More...
 
std::shared_ptr< DiscreteDistributionInterfacegetRateDistribution () override
 Get a pointer to the rate distribution (or null if there is no rate distribution). More...
 
ParameterList getSubstitutionModelParameters (bool independent) const override
 Get the INDEPENDENT parameters corresponding to the models. More...
 
bool isFullySetUp (bool throwEx=true) const
 Check if the model set is fully specified for a given tree. More...
 
void setPhyloTree (const PhyloTree &phyloTree)
 sets the ParametrizablePhyloTree. More...
 
const ParametrizablePhyloTreeparametrizablePhyloTree () const
 
std::shared_ptr< const ParametrizablePhyloTreegetParametrizablePhyloTree () const
 
bool hasRootFrequencySet () const
 
const FrequencySetInterfacerootFrequencySet () const
 
FrequencySetInterfacerootFrequencySet ()
 
std::shared_ptr< const FrequencySetInterfacegetRootFrequencySet () const
 
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...
 
std::shared_ptr< const ModelScenariogetModelScenario () const
 get the ModelScenario. More...
 
virtual bool isCompatibleWith (const AlignmentDataInterface &data) const =0
 
bool isCompatibleWith (const AlignmentDataInterface &data) const
 
virtual size_t getNumberOfClasses () const =0
 
size_t getNumberOfClasses () const
 
virtual size_t getNumberOfStates () const =0
 
size_t getNumberOfStates () const
 
virtual ParameterList getNonDerivableParameters () const =0
 
ParameterList getNonDerivableParameters () const
 get NonDerivable parameters More...
 
virtual size_t getNumberOfIndependentParameters () const=0
 
size_t getNumberOfIndependentParameters () const
 
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
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
virtual const ParameterListgetIndependentParameters () const=0
 
const ParameterListgetIndependentParameters () const
 
virtual std::vector< std::string > getAlias (const std::string &name) const=0
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const=0
 
virtual std::map< std::string, std::string > getAliases () const
 
virtual bool hasParameter (const std::string &name) const=0
 
bool hasParameter (const std::string &name) const override
 
virtual const ParameterListgetParameters () const=0
 
const ParameterListgetParameters () const override
 
virtual const Parameterparameter (const std::string &name) const=0
 
const Parameterparameter (const std::string &name) const override
 
virtual double getParameterValue (const std::string &name) const=0
 
double getParameterValue (const std::string &name) const override
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
void setAllParametersValues (const ParameterList &parameters) override
 
virtual void setParameterValue (const std::string &name, double value)=0
 
void setParameterValue (const std::string &name, double value) override
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
void setParametersValues (const ParameterList &parameters) override
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
bool matchParametersValues (const ParameterList &parameters) override
 
virtual void removeConstraint (const std::string &name)=0
 
void removeConstraint (const std::string &name) override
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
virtual size_t getNumberOfParameters () const=0
 
size_t getNumberOfParameters () const override
 
virtual void setNamespace (const std::string &prefix)=0
 
void setNamespace (const std::string &prefix)
 
virtual std::string getNamespace () const=0
 
std::string getNamespace () const override
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 
std::shared_ptr< const AlphabetgetAlphabet () const
 
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

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

std::vector< std::shared_ptr< BranchModelInterface > > modelSet_
 Contains all models used in this tree. More...
 
std::shared_ptr< DiscreteDistributionInterfacerDist_
 Rate Distribution. More...
 
std::map< unsigned int, size_t > nodeToModel_
 Contains for each node in a tree the index of the corresponding model in modelSet_. More...
 
std::map< size_t, std::vector< unsigned int > > modelToNodes_
 
std::vector< ParameterListmodelParameters_
 Parameters for each model in the set. More...
 
ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 

Check function.

const std::vector< double > & getRootFrequencies () const override
 
const BranchModelInterfacemodel (unsigned int nodeId, size_t classIndex) const override
 Get the substitution model corresponding to a certain branch, site pattern, and model class. More...
 
std::shared_ptr< const BranchModelInterfacegetModel (unsigned int nodeId, size_t classIndex) const override
 Get the substitution model corresponding to a certain branch, site pattern, and model class. More...
 
double getProbabilityForModel (size_t classIndex) const override
 
Vdouble getClassProbabilities () const override
 
double getRateForModel (size_t classIndex) const override
 
bool checkOrphanNodes (bool throwEx) const
 
bool checkUnknownNodes (bool throwEx) const
 
static std::unique_ptr< AutonomousSubstitutionProcessInterfacecreateHomogeneousSubstitutionProcess (std::shared_ptr< BranchModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rdist, std::shared_ptr< PhyloTree > tree, std::shared_ptr< FrequencySetInterface > rootFreqs=0, std::shared_ptr< ModelScenario > scenario=0)
 Create a NonHomogeneousSubstitutionProcess object, corresponding to the homogeneous case. More...
 
static std::unique_ptr< NonHomogeneousSubstitutionProcesscreateNonHomogeneousSubstitutionProcess (std::shared_ptr< BranchModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rdist, std::shared_ptr< PhyloTree > tree, std::shared_ptr< FrequencySetInterface > rootFreqs, const std::vector< std::string > &globalParameterNames, std::shared_ptr< ModelScenario > scenario=0)
 Create a NonHomogeneousSubstitutionProcess object, with one model per branch. More...
 

Detailed Description

Substitution process manager for non-homogeneous / non-reversible models of evolution.

This class contains a set of substitution models, and their assignment toward the branches of a phylogenetic tree. Each branch in the tree corresponds to a model in the set, but a susbstitution model may correspond to several branches. The particular case where all branches point toward a unique model is the homogeneous case.

This class also deals with the parameters associated to the models. The models may have their own parameters or share some of them. To deal with this issue, the NonHomogeneousSubstitutionProcess class contains its own parameter list and an index which tells to which models these parameters apply to. Since parameters in a list must have unique names, the names are suffixed with numbers according to the order of the model in the list.

To track the relationships between names in the list and names in each model, the parameter list is duplicated in modelParameters_. The user only act on parameters_, the fireParameterChanged function, automatically called, will update the modelParameters_ field.

In the non-homogeneous and homogeneous non-reversible cases, the likelihood depends on the position of the root. The states frequencies at the root of the tree are hence distinct parameters. These are accounted by a FrequencySet object, managed by the NonHomogeneousSubstitutionProcess class. The corresponding parameters, if any, are added at the beginning of the global parameter list.

If the heterogenity of the model does not affect the equilibrium frequencies, the model can be considered as stationary. In such a model, the process is supposed to be at equilibrium all along the trees, including at the root. Whether a model should be considered as stationary or not is left to the user. If the "assume stationarity" option is set when building the set, then no FrequencySet object is used, but the frequencies are taken to be the same as the one at the first model in the set. Nothing hence prevents you to build a "supposedly stationary model which actually is not", so be careful!!

This class provides several methods to specify which model and/or which parameter is associated to which branch/clade. Several check points are provided, but some are probably missing due to the large set of possible models that this class allows to build, so be careful!

Definition at line 78 of file NonHomogeneousSubstitutionProcess.h.

Constructor & Destructor Documentation

◆ NonHomogeneousSubstitutionProcess() [1/3]

bpp::NonHomogeneousSubstitutionProcess::NonHomogeneousSubstitutionProcess ( std::shared_ptr< DiscreteDistributionInterface rdist,
std::shared_ptr< const PhyloTree tree = 0,
std::shared_ptr< FrequencySetInterface rootFreqs = 0 
)
inline

Create a model set according to the specified alphabet and root frequencies. Stationarity is not assumed.

Parameters
rdistThe DiscreteDistribution for the rates
treethe phylo tree tree
rootFreqsThe frequencies at root node. The underlying object will be owned by this instance ( = 0 if stationary)

Definition at line 113 of file NonHomogeneousSubstitutionProcess.h.

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

Referenced by clone().

◆ NonHomogeneousSubstitutionProcess() [2/3]

bpp::NonHomogeneousSubstitutionProcess::NonHomogeneousSubstitutionProcess ( std::shared_ptr< DiscreteDistributionInterface rdist,
std::shared_ptr< ParametrizablePhyloTree tree,
std::shared_ptr< FrequencySetInterface rootFreqs = 0 
)
inline

Create a model set according to the specified alphabet and root frequencies. Stationarity is not assumed.

Parameters
rdistThe DiscreteDistribution for the rates
treethe parametrizable tree
rootFreqsThe frequencies at root node. The underlying object will be owned by this instance ( = 0 if stationary)

Definition at line 137 of file NonHomogeneousSubstitutionProcess.h.

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

◆ NonHomogeneousSubstitutionProcess() [3/3]

NonHomogeneousSubstitutionProcess::NonHomogeneousSubstitutionProcess ( const NonHomogeneousSubstitutionProcess set)

◆ ~NonHomogeneousSubstitutionProcess()

virtual bpp::NonHomogeneousSubstitutionProcess::~NonHomogeneousSubstitutionProcess ( )
inlinevirtual

Definition at line 157 of file NonHomogeneousSubstitutionProcess.h.

References clear().

Member Function Documentation

◆ addModel()

void NonHomogeneousSubstitutionProcess::addModel ( std::shared_ptr< BranchModelInterface model,
const std::vector< unsigned int > &  nodesId 
)

Add a new model to the set, and set relationships with nodes and params.

Parameters
modelA pointer toward a susbstitution model, that will added to the set. Warning! The set will now be the owner of the pointer, and will destroy it if needed! Copy the model first if you don't want it to be lost!
nodesIdthe set of nodes in the tree that points toward this model. This will override any previous affectation.
Exceptions
Exceptionin case of error:
  • if the new model does not match the alphabet
  • if the new model does not have the same number of states than existing ones
  • etc.

Definition at line 89 of file NonHomogeneousSubstitutionProcess.cpp.

References bpp::AbstractParameterAliasable::addParameter_(), bpp::ParameterList::clone(), bpp::AbstractSubstitutionProcess::getAlphabet(), bpp::BranchModelInterface::getAlphabet(), bpp::ParameterAliasable::getIndependentParameters(), bpp::Parameter::getName(), bpp::AbstractSubstitutionProcess::getNumberOfStates(), bpp::BranchModelInterface::getNumberOfStates(), model(), modelParameters_, modelSet_, modelToNodes_, nodeToModel_, bpp::Parameter::setName(), bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ checkOrphanNodes()

bool NonHomogeneousSubstitutionProcess::checkOrphanNodes ( bool  throwEx) const
protected

◆ checkUnknownNodes()

bool NonHomogeneousSubstitutionProcess::checkUnknownNodes ( bool  throwEx) const
protected

◆ clear()

void NonHomogeneousSubstitutionProcess::clear ( )

Resets all the information contained in this object.

Definition at line 68 of file NonHomogeneousSubstitutionProcess.cpp.

References modelParameters_, modelSet_, nodeToModel_, rDist_, and bpp::AbstractParameterAliasable::resetParameters_().

Referenced by operator=(), and ~NonHomogeneousSubstitutionProcess().

◆ clone()

NonHomogeneousSubstitutionProcess* bpp::NonHomogeneousSubstitutionProcess::clone ( ) const
inlineoverridevirtual

◆ createHomogeneousSubstitutionProcess()

unique_ptr< AutonomousSubstitutionProcessInterface > NonHomogeneousSubstitutionProcess::createHomogeneousSubstitutionProcess ( std::shared_ptr< BranchModelInterface model,
std::shared_ptr< DiscreteDistributionInterface rdist,
std::shared_ptr< PhyloTree tree,
std::shared_ptr< FrequencySetInterface rootFreqs = 0,
std::shared_ptr< ModelScenario scenario = 0 
)
static

Create a NonHomogeneousSubstitutionProcess object, corresponding to the homogeneous case.

Static methods to create "simply" NonHomogeneousSubstitutionProcess.

This class is mainly for testing purpose.

Parameters
modelThe model to use.
rdistThe rate distribution
treeThe tree to use for the construction of the set.
rootFreqsA FrequencySet object to parametrize root frequencies (0 if stationary).
scenario(optional) the scenario used (in case of Mixed Models)

Definition at line 284 of file NonHomogeneousSubstitutionProcess.cpp.

References bpp::BranchModelInterface::alphabet(), bpp::BranchModelInterface::getAlphabet(), bpp::Alphabet::getAlphabetType(), and model().

◆ createNonHomogeneousSubstitutionProcess()

unique_ptr< NonHomogeneousSubstitutionProcess > NonHomogeneousSubstitutionProcess::createNonHomogeneousSubstitutionProcess ( std::shared_ptr< BranchModelInterface model,
std::shared_ptr< DiscreteDistributionInterface rdist,
std::shared_ptr< PhyloTree tree,
std::shared_ptr< FrequencySetInterface rootFreqs,
const std::vector< std::string > &  globalParameterNames,
std::shared_ptr< ModelScenario scenario = 0 
)
static

Create a NonHomogeneousSubstitutionProcess object, with one model per branch.

All branches share the same type of model, but allow one set of parameters per branch. This is also possible to specify some parameters to be common to all branches.

Parameters
modelThe model to use.
rdistThe rate distribution
rootFreqsA FrequencySet object to parametrize root frequencies.
treeThe tree to use for the construction of the set.
globalParameterNamesCommon parameters for all branches. All other parameters will be considered distinct for all branches.
scenario(optional) the scenario used (in case of Mixed Models)

Definition at line 314 of file NonHomogeneousSubstitutionProcess.cpp.

References bpp::ParameterList::addParameter(), bpp::BranchModelInterface::alphabet(), bpp::BranchModelInterface::clone(), bpp::ParameterList::deleteParameter(), bpp::BranchModelInterface::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::ParameterAliasable::getIndependentParameters(), bpp::StringTokenizer::hasMoreToken(), bpp::ParameterList::hasParameter(), model(), bpp::StringTokenizer::nextToken(), bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ fireParameterChanged()

void NonHomogeneousSubstitutionProcess::fireParameterChanged ( const ParameterList parameters)
overridevirtual

To be called when a parameter has changed. Depending on parameters, this will actualize the rootFrequencies_ vector or the corresponding models in the set.

Parameters
parametersThe modified parameters.

Reimplemented from bpp::AbstractAutonomousSubstitutionProcess.

Definition at line 164 of file NonHomogeneousSubstitutionProcess.cpp.

References bpp::AbstractAutonomousSubstitutionProcess::fireParameterChanged(), bpp::AbstractParameterAliasable::getParameterValue(), modelParameters_, modelSet_, rDist_, and bpp::TextTools::toString().

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractSubstitutionProcess::getAlphabet ( ) const
inlineinherited

◆ getBranchLengthParameters()

ParameterList bpp::NonHomogeneousSubstitutionProcess::getBranchLengthParameters ( bool  independent) const
inlineoverridevirtual

◆ getClassProbabilities()

Vdouble bpp::NonHomogeneousSubstitutionProcess::getClassProbabilities ( ) const
inlineoverridevirtual
Returns
The vector of the probabilities associated to the classes.

Implements bpp::SubstitutionProcessInterface.

Definition at line 434 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ getModel() [1/3]

std::shared_ptr<const BranchModelInterface> bpp::NonHomogeneousSubstitutionProcess::getModel ( size_t  n)
inline

Definition at line 234 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_.

◆ getModel() [2/3]

std::shared_ptr<const BranchModelInterface> bpp::NonHomogeneousSubstitutionProcess::getModel ( size_t  i) const
inlineoverridevirtual
Returns
A shared pointer toward the model with given index.

Implements bpp::SubstitutionProcessInterface.

Definition at line 228 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_.

Referenced by hasMixedTransitionModel(), and bpp::PhylogeneticsApplicationTools::printParameters().

◆ getModel() [3/3]

std::shared_ptr<const BranchModelInterface> bpp::NonHomogeneousSubstitutionProcess::getModel ( unsigned int  nodeId,
size_t  classIndex 
) const
inlineoverridevirtual

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.

Implements bpp::SubstitutionProcessInterface.

Definition at line 422 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_, and nodeToModel_.

◆ getModelForNode()

std::shared_ptr<const BranchModelInterface> bpp::NonHomogeneousSubstitutionProcess::getModelForNode ( unsigned int  nodeId) const
inlineoverridevirtual

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.

Implements bpp::SubstitutionProcessInterface.

Definition at line 263 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_, nodeToModel_, and bpp::TextTools::toString().

◆ getModelNumberForNode()

size_t bpp::NonHomogeneousSubstitutionProcess::getModelNumberForNode ( unsigned int  nodeId) const
inlineoverridevirtual

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

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

Implements bpp::SubstitutionProcessInterface.

Definition at line 248 of file NonHomogeneousSubstitutionProcess.h.

References nodeToModel_, and bpp::TextTools::toString().

◆ getModelNumbers()

std::vector<size_t> bpp::NonHomogeneousSubstitutionProcess::getModelNumbers ( ) const
inlineoverridevirtual
Returns
The current indexes of models used in the process

Implements bpp::SubstitutionProcessInterface.

Definition at line 215 of file NonHomogeneousSubstitutionProcess.h.

References getNumberOfModels().

◆ getModelScenario()

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

◆ getNodesWithModel()

const std::vector<unsigned int> bpp::NonHomogeneousSubstitutionProcess::getNodesWithModel ( size_t  i) const
inlineoverridevirtual

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

Parameters
iThe number of the model in the set (ie the index in the set, plus 1).
Returns
A vector with the ids of the node associated to this model.
Exceptions
IndexOutOfBoundsExceptionIf the index is not valid.

Implements bpp::SubstitutionProcessInterface.

Definition at line 278 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_, and modelToNodes_.

Referenced by bpp::PhylogeneticsApplicationTools::printParameters().

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

size_t bpp::NonHomogeneousSubstitutionProcess::getNumberOfModels ( ) const
inlineoverridevirtual
Returns
The current number of distinct substitution models in this set.

Implements bpp::SubstitutionProcessInterface.

Definition at line 199 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_.

Referenced by getModelNumbers(), hasMixedTransitionModel(), and bpp::PhylogeneticsApplicationTools::printParameters().

◆ getNumberOfStates() [1/2]

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

◆ getNumberOfStates() [2/2]

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

◆ getParametrizablePhyloTree()

◆ getProbabilityForModel()

double bpp::NonHomogeneousSubstitutionProcess::getProbabilityForModel ( size_t  classIndex) const
inlineoverridevirtual
Returns
The probability associated to the given model class.
Parameters
classIndexThe model class index.

Implements bpp::SubstitutionProcessInterface.

Definition at line 427 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ getRateDistribution() [1/2]

std::shared_ptr<const DiscreteDistributionInterface> bpp::NonHomogeneousSubstitutionProcess::getRateDistribution ( ) const
inlineoverridevirtual

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

Implements bpp::SubstitutionProcessInterface.

Definition at line 359 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ getRateDistribution() [2/2]

std::shared_ptr<DiscreteDistributionInterface> bpp::NonHomogeneousSubstitutionProcess::getRateDistribution ( )
inlineoverridevirtual

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

Implements bpp::SubstitutionProcessInterface.

Definition at line 364 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ getRateDistributionParameters()

ParameterList bpp::NonHomogeneousSubstitutionProcess::getRateDistributionParameters ( bool  independent) const
inlineoverridevirtual

Get the parameters attached to the rate distribution.

Implements bpp::SubstitutionProcessInterface.

Definition at line 340 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ getRateForModel()

double bpp::NonHomogeneousSubstitutionProcess::getRateForModel ( size_t  classIndex) const
inlineoverridevirtual
Returns
The substitution rate associated to the given model class.
Parameters
classIndexThe model class index.

Implements bpp::SubstitutionProcessInterface.

Definition at line 449 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ getRootFrequencies()

const std::vector<double>& bpp::NonHomogeneousSubstitutionProcess::getRootFrequencies ( ) const
inlineoverridevirtual

◆ getRootFrequenciesParameters()

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

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 bpp::AbstractAutonomousSubstitutionProcess::hasRootFrequencySet(), and bpp::AbstractAutonomousSubstitutionProcess::rootFrequencies_.

◆ getRootFrequencySet() [1/2]

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

Implements bpp::SubstitutionProcessInterface.

Definition at line 106 of file AbstractAutonomousSubstitutionProcess.h.

References bpp::AbstractAutonomousSubstitutionProcess::rootFrequencies_.

◆ getRootFrequencySet() [2/2]

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

◆ getStateMap()

std::shared_ptr<const StateMapInterface> bpp::NonHomogeneousSubstitutionProcess::getStateMap ( ) const
inlineoverridevirtual

Implements bpp::SubstitutionProcessInterface.

Definition at line 188 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_.

◆ getSubstitutionModelParameters()

ParameterList NonHomogeneousSubstitutionProcess::getSubstitutionModelParameters ( bool  independent) const
overridevirtual

◆ hasMixedTransitionModel()

bool NonHomogeneousSubstitutionProcess::hasMixedTransitionModel ( ) const
Returns
True iff there is a MixedTransitionModel in the NonHomogeneousSubstitutionProcess

Definition at line 259 of file NonHomogeneousSubstitutionProcess.cpp.

References getModel(), and getNumberOfModels().

◆ hasRootFrequencySet()

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

◆ 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

◆ isFullySetUp()

bool bpp::NonHomogeneousSubstitutionProcess::isFullySetUp ( bool  throwEx = true) const
inline

Check if the model set is fully specified for a given tree.

This include:

  • that each node as a model set up,
  • that each model in the set is attributed to a node,
  • all nodes ids in the set refer to an existing node in the tree.
Parameters
throwExTell if an exception have to be thrown in case of test not passed.

Definition at line 384 of file NonHomogeneousSubstitutionProcess.h.

References checkOrphanNodes(), and checkUnknownNodes().

◆ listModelNames()

void NonHomogeneousSubstitutionProcess::listModelNames ( std::ostream &  out = std::cout) const

list all model names.

Definition at line 151 of file NonHomogeneousSubstitutionProcess.cpp.

References modelSet_, and modelToNodes_.

◆ model() [1/2]

const BranchModelInterface& bpp::NonHomogeneousSubstitutionProcess::model ( size_t  i) const
inlineoverridevirtual

◆ model() [2/2]

const BranchModelInterface& bpp::NonHomogeneousSubstitutionProcess::model ( unsigned int  nodeId,
size_t  classIndex 
) const
inlineoverridevirtual

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.

Implements bpp::SubstitutionProcessInterface.

Definition at line 417 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_, and nodeToModel_.

◆ operator=()

◆ parametrizablePhyloTree()

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

◆ rateDistribution() [1/2]

const DiscreteDistributionInterface& bpp::NonHomogeneousSubstitutionProcess::rateDistribution ( ) const
inlineoverridevirtual

Get the rate distribution.

Exceptions
NullPointerExceptionif there is no associated rate distribution.

Implements bpp::SubstitutionProcessInterface.

Definition at line 345 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

Referenced by bpp::PhylogeneticsApplicationTools::printParameters().

◆ rateDistribution() [2/2]

DiscreteDistributionInterface& bpp::NonHomogeneousSubstitutionProcess::rateDistribution ( )
inlineoverridevirtual

Get the rate distribution.

Exceptions
NullPointerExceptionif there is no associated rate distribution.

Implements bpp::SubstitutionProcessInterface.

Definition at line 352 of file NonHomogeneousSubstitutionProcess.h.

References rDist_.

◆ rootFrequencySet() [1/2]

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

Implements bpp::SubstitutionProcessInterface.

Definition at line 101 of file AbstractAutonomousSubstitutionProcess.h.

References bpp::AbstractAutonomousSubstitutionProcess::rootFrequencies_.

◆ rootFrequencySet() [2/2]

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

◆ setModel()

void NonHomogeneousSubstitutionProcess::setModel ( std::shared_ptr< BranchModelInterface model,
size_t  modelIndex 
)

Change a given model.

The new model will be copied and will replace the old one. All previous associations will be kept the same.

Parameters
modelA pointer toward a susbstitution model, that will added to the set. Warning! The set will now be the owner of the pointer, and will destroy it if needed! Copy the model first if you don't want it to be lost!
modelIndexThe index of the existing model to replace.

Definition at line 120 of file NonHomogeneousSubstitutionProcess.cpp.

References bpp::AbstractParameterAliasable::addParameter_(), bpp::ParameterList::clone(), bpp::AbstractParameterAliasable::deleteParameter_(), bpp::AbstractSubstitutionProcess::getAlphabet(), bpp::BranchModelInterface::getAlphabet(), bpp::ParameterAliasable::getIndependentParameters(), bpp::Parameter::getName(), bpp::AbstractSubstitutionProcess::getNumberOfStates(), bpp::BranchModelInterface::getNumberOfStates(), model(), modelParameters_, modelSet_, bpp::Parameter::setName(), bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ setModelScenario()

void NonHomogeneousSubstitutionProcess::setModelScenario ( std::shared_ptr< ModelScenario modelscenario)
overridevirtual

Set the modelPath, after checking it is valid (ie modelpath has only the model of the process).

Implements bpp::AbstractAutonomousSubstitutionProcess.

Definition at line 270 of file NonHomogeneousSubstitutionProcess.cpp.

References bpp::AbstractAutonomousSubstitutionProcess::modelScenario_, and modelSet_.

◆ setModelToNode()

void NonHomogeneousSubstitutionProcess::setModelToNode ( size_t  modelIndex,
unsigned int  nodeNumber 
)

Associate an existing model with a given node.

If the node was was previously associated to a model, the old association is deleted. If other nodes are associated to this model, the association is conserved.

Parameters
modelIndexThe position of the model in the set.
nodeNumberThe id of the corresponding node.

Definition at line 78 of file NonHomogeneousSubstitutionProcess.cpp.

References nodeToModel_.

◆ setPhyloTree()

◆ setRootFrequencySet()

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

◆ stateMap()

const StateMapInterface& bpp::NonHomogeneousSubstitutionProcess::stateMap ( ) const
inlineoverridevirtual
Returns
The state map associated with the models of this process

Implements bpp::SubstitutionProcessInterface.

Definition at line 180 of file NonHomogeneousSubstitutionProcess.h.

References modelSet_.

Member Data Documentation

◆ modelParameters_

std::vector<ParameterList> bpp::NonHomogeneousSubstitutionProcess::modelParameters_
private

Parameters for each model in the set.

Definition at line 102 of file NonHomogeneousSubstitutionProcess.h.

Referenced by addModel(), clear(), fireParameterChanged(), getSubstitutionModelParameters(), operator=(), and setModel().

◆ modelScenario_

◆ modelSet_

std::vector<std::shared_ptr<BranchModelInterface> > bpp::NonHomogeneousSubstitutionProcess::modelSet_
private

◆ modelToNodes_

std::map<size_t, std::vector<unsigned int> > bpp::NonHomogeneousSubstitutionProcess::modelToNodes_
mutableprivate

◆ nodeToModel_

std::map<unsigned int, size_t> bpp::NonHomogeneousSubstitutionProcess::nodeToModel_
mutableprivate

Contains for each node in a tree the index of the corresponding model in modelSet_.

Definition at line 96 of file NonHomogeneousSubstitutionProcess.h.

Referenced by addModel(), checkOrphanNodes(), clear(), getModel(), getModelForNode(), getModelNumberForNode(), model(), operator=(), and setModelToNode().

◆ pTree_

◆ rDist_

◆ rootFrequencies_


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