|
bpp-phyl
2.1.0
|
Substitution models manager for non-homogeneous / non-reversible models of evolution. More...
#include <Bpp/Phyl/Model/SubstitutionModelSet.h>
Inheritance diagram for bpp::SubstitutionModelSet:
Collaboration diagram for bpp::SubstitutionModelSet:Public Member Functions | |
| SubstitutionModelSet (const Alphabet *alpha) | |
| Create a model set according to the specified alphabet. Stationarity is assumed. More... | |
| SubstitutionModelSet (const Alphabet *alpha, FrequenciesSet *rootFreqs) | |
| Create a model set according to the specified alphabet and root frequencies. Stationarity is not assumed. More... | |
| void | clear () |
| Resets all the information contained in this object. More... | |
| void | setRootFrequencies (FrequenciesSet *rootFreqs) |
| Sets a given FrequenciesSet for root frequencies. More... | |
| SubstitutionModelSet (const SubstitutionModelSet &set) | |
| SubstitutionModelSet & | operator= (const SubstitutionModelSet &set) |
| virtual | ~SubstitutionModelSet () |
| SubstitutionModelSet * | clone () const |
| size_t | getNumberOfStates () const throw (Exception) |
| Get the number of states associated to this model set. More... | |
| size_t | getParameterIndex (const std::string &name) const throw (ParameterNotFoundException) |
| Get the index of a given parameter in the list of all parameters. More... | |
| std::string | getParameterModelName (const std::string &name) const throw (ParameterNotFoundException, Exception) |
| Get the model name of a given parameter in the list of all parameters. More... | |
| virtual void | fireParameterChanged (const ParameterList ¶meters) |
| size_t | getNumberOfModels () const |
| bool | hasMixedSubstitutionModel () const |
| const SubstitutionModel * | getModel (size_t i) const throw (IndexOutOfBoundsException) |
| Get one model from the set knowing its index. More... | |
| SubstitutionModel * | getModel (size_t i) throw (IndexOutOfBoundsException) |
| size_t | getModelIndexForNode (int nodeId) const throw (Exception) |
| Get the index in the set of the model associated to a particular node id. More... | |
| const SubstitutionModel * | getModelForNode (int nodeId) const throw (Exception) |
| Get the model associated to a particular node id. More... | |
| SubstitutionModel * | getModelForNode (int nodeId) throw (Exception) |
| const std::vector< int > & | getNodesWithModel (size_t i) const throw (IndexOutOfBoundsException) |
| Get a list of nodes id for which the given model is associated. More... | |
| std::vector< int > | getNodesWithParameter (const std::string &name) const throw (ParameterNotFoundException) |
| std::vector< size_t > | getModelsWithParameter (const std::string &name) const throw (ParameterNotFoundException) |
| void | addModel (SubstitutionModel *model, const std::vector< int > &nodesId, const std::vector< std::string > &newParams) throw (Exception) |
| Add a new model to the set, and set relationships with nodes and params. More... | |
| void | setModel (SubstitutionModel *model, size_t modelIndex) throw (Exception, IndexOutOfBoundsException) |
| Change a given model. More... | |
| void | setModelToNode (size_t modelIndex, int nodeNumber) throw (IndexOutOfBoundsException) |
| Associate an existing model with a given node. More... | |
| void | setParameterToModel (size_t parameterIndex, size_t modelIndex) throw (IndexOutOfBoundsException) |
| Assign a parameter to a model. More... | |
| void | unsetParameterToModel (size_t parameterIndex, size_t modelIndex) throw (IndexOutOfBoundsException, Exception) |
| Unset a given parameter to the specified model. More... | |
| void | addParameter (const Parameter ¶meter, const std::vector< int > &nodesId) throw (Exception) |
| Add a parameter to the list, and link it to specified existing nodes. More... | |
| void | addParameters (const ParameterList ¶meters, const std::vector< int > &nodesId) throw (Exception) |
| Add several parameters to the list, and link them to specified existing nodes. More... | |
| void | removeParameter (const std::string &name) throw (ParameterNotFoundException) |
| Remove a parameter from the list, and unset it to all linked nodes and models. More... | |
| void | removeModel (size_t modelIndex) throw (Exception) |
| Remove a model from the set, and all corresponding parameters. More... | |
| void | listModelNames (std::ostream &out=std::cout) const |
| const FrequenciesSet * | getRootFrequenciesSet () const |
| std::vector< double > | getRootFrequencies () const |
| ParameterList | getRootFrequenciesParameters () const |
| Get the parameters corresponding to the root frequencies. More... | |
| ParameterList | getNodeParameters () const |
| Get the parameters corresponding attached to the nodes of the tree. More... | |
| ParameterList | getModelParameters (size_t modelIndex) const |
| Get the parameters attached to a Model. More... | |
| const Alphabet * | getAlphabet () const |
| bool | isFullySetUpFor (const Tree &tree, bool throwEx=true) const throw (Exception) |
| Check if the model set is fully specified for a given tree. More... | |
| void | setNamespace (const std::string &prefix) |
| const ParameterList & | getIndependentParameters () const |
| size_t | getNumberOfIndependentParameters () const |
| void | aliasParameters (const std::string &p1, const std::string &p2) |
| void | unaliasParameters (const std::string &p1, const std::string &p2) |
| std::vector< std::string > | getAlias (const std::string &name) const |
| bool | hasParameter (const std::string &name) const |
| const ParameterList & | getParameters () const |
| const Parameter & | getParameter (const std::string &name) const |
| double | getParameterValue (const std::string &name) const |
| void | setAllParametersValues (const ParameterList ¶meters) |
| void | setParameterValue (const std::string &name, double value) |
| void | setParametersValues (const ParameterList ¶meters) |
| bool | matchParametersValues (const ParameterList ¶meters) |
| size_t | getNumberOfParameters () const |
| std::string | getNamespace () const |
| std::string | getParameterNameWithoutNamespace (const std::string &name) const |
Protected Member Functions | |
| void | updateRootFrequencies () |
| void | addParameter_ (Parameter *parameter) |
| void | addParameters_ (const ParameterList ¶meters) |
| void | deleteParameter_ (size_t index) |
| void | resetParameters_ () |
| Parameter & | getParameter_ (const std::string &name) |
| Parameter & | getParameter_ (size_t index) |
| const Parameter & | getParameter_ (size_t index) const |
| Parameter & | getParameterWithNamespace_ (const std::string &name) |
| const Parameter & | getParameterWithNamespace_ (const std::string &name) const |
| ParameterList & | getParameters_ () |
Check function. | |
| bool | checkOrphanModels (bool throwEx) const throw (Exception) |
| bool | checkOrphanParameters (bool throwEx) const throw (Exception) |
| bool | checkOrphanNodes (const Tree &tree, bool throwEx) const throw (Exception) |
| bool | checkUnknownNodes (const Tree &tree, bool throwEx) const throw (Exception) |
Protected Attributes | |
| const Alphabet * | alphabet_ |
| A pointer toward the common alphabet to all models in the set. More... | |
| size_t | nbStates_ |
| std::vector< SubstitutionModel * > | modelSet_ |
| Contains all models used in this tree. More... | |
Private Attributes | |
| std::auto_ptr< FrequenciesSet > | rootFrequencies_ |
| Root frequencies. More... | |
| std::map< 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 < int > > | modelToNodes_ |
| std::vector< std::vector < size_t > > | paramToModels_ |
| Contains for each parameter in the list the indexes of the corresponding models in modelSet_ that share this parameter. More... | |
| std::map< std::string, size_t > | paramNamesCount_ |
| std::vector< std::string > | modelParameterNames_ |
| Contains for each parameter in the list the corresponding name in substitution models. More... | |
| std::vector< ParameterList > | modelParameters_ |
| Parameters for each model in the set. More... | |
| bool | stationarity_ |
Substitution models manager for non-homogeneous / non-reversible models of evolution.
This class contains a set of substitution models, and their assigment 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. In the homogeneous case, the parameter list is the same as the list in susbstitution model. When two models at least are specified, these models may have their own parameters or share some of them. To deal with this issue, the SubstitutionModelSet 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, duplicated names are numbered according to the order 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. Theses are accounted by a FrequenciesSet objet, managed by the SubstitutionModelSet class. The corresponding parameters, if any, are added at the begining 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 "asumme stationarity" option is set when building the set, then no FrequenciesSet 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 "supposingly 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 carefull!
Definition at line 99 of file SubstitutionModelSet.h.
|
inline |
Create a model set according to the specified alphabet. Stationarity is assumed.
| alpha | The alphabet to use for this set. |
Definition at line 157 of file SubstitutionModelSet.h.
Referenced by clone().
|
inline |
Create a model set according to the specified alphabet and root frequencies. Stationarity is not assumed.
| alpha | The alphabet to use for this set. |
| rootFreqs | The frequencies at root node. The underlying object will be owned by this instance. |
Definition at line 180 of file SubstitutionModelSet.h.
References setRootFrequencies().
| SubstitutionModelSet::SubstitutionModelSet | ( | const SubstitutionModelSet & | set | ) |
Definition at line 49 of file SubstitutionModelSet.cpp.
References modelSet_.
|
inlinevirtual |
Definition at line 216 of file SubstitutionModelSet.h.
| void SubstitutionModelSet::addModel | ( | SubstitutionModel * | model, |
| const std::vector< int > & | nodesId, | ||
| const std::vector< std::string > & | newParams | ||
| ) | throw (Exception) |
Add a new model to the set, and set relationships with nodes and params.
| model | A 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! |
| nodesId | the set of nodes in the tree that points toward this model. This will override any previous affectation. |
| newParams | The names of the parameters that have to be added to the global list. These parameters will only be affected to this susbstitution model. You can use the setParameterToModel function to assign this parameter to an additional model, and the unsetParameterToModel to remove the relationship with this model for instance. Parameters not specified in newParams will be ignored, unless you manually assign them to another parameter with setParameterToModel. |
| Exception | in case of error:
|
Definition at line 157 of file SubstitutionModelSet.cpp.
References bpp::Parameter::clone(), and bpp::TextTools::toString().
Referenced by bpp::SubstitutionModelSetTools::createHomogeneousModelSet(), bpp::SubstitutionModelSetTools::createNonHomogeneousModelSet(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
| void SubstitutionModelSet::addParameter | ( | const Parameter & | parameter, |
| const std::vector< int > & | nodesId | ||
| ) | throw (Exception) |
Add a parameter to the list, and link it to specified existing nodes.
| parameter | The parameter to add. Its name must match model parameter names. |
| nodesId | The list of ids of the nodes to link with these parameters. Nodes must have a corresponding model in the set. |
| Exception | If one of the above requirement is not true. |
Definition at line 288 of file SubstitutionModelSet.cpp.
References bpp::Parameter::clone(), bpp::TextTools::toString(), and bpp::TextTools::toString().
| void SubstitutionModelSet::addParameters | ( | const ParameterList & | parameters, |
| const std::vector< int > & | nodesId | ||
| ) | throw (Exception) |
Add several parameters to the list, and link them to specified existing nodes.
| parameters | The list of parameters to add. Its name must match model parameter names. |
| nodesId | The list of ids of the nodes to link with these parameters. Nodes must have a corresponding model in the set. |
| Exception | If one of the above requirement is not true. |
Definition at line 309 of file SubstitutionModelSet.cpp.
References bpp::ParameterList::size(), bpp::ParameterList::size(), bpp::TextTools::toString(), and bpp::TextTools::toString().
Referenced by bpp::SubstitutionModelSetTools::createNonHomogeneousModelSet().
|
protected |
Definition at line 396 of file SubstitutionModelSet.cpp.
References bpp::VectorTools::contains(), bpp::MapTools::getValues(), and bpp::TextTools::toString().
Referenced by isFullySetUpFor().
|
protected |
Definition at line 425 of file SubstitutionModelSet.cpp.
References bpp::TextTools::toString().
Referenced by isFullySetUpFor().
|
protected |
Definition at line 411 of file SubstitutionModelSet.cpp.
Referenced by isFullySetUpFor().
|
protected |
Definition at line 441 of file SubstitutionModelSet.cpp.
References bpp::VectorTools::contains(), and bpp::TextTools::toString().
Referenced by isFullySetUpFor().
| void SubstitutionModelSet::clear | ( | ) |
Resets all the information contained in this object.
Definition at line 96 of file SubstitutionModelSet.cpp.
References modelParameterNames_, modelParameters_, modelSet_, modelSet_, modelSet_, nbStates_, nodeToModel_, paramNamesCount_, paramToModels_, bpp::AbstractParameterAliasable::resetParameters_(), rootFrequencies_, and stationarity_.
Referenced by bpp::MixedSubstitutionModelSet::clear(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
|
inlinevirtual |
Implements bpp::Clonable.
Definition at line 226 of file SubstitutionModelSet.h.
References SubstitutionModelSet().
|
virtual |
To be called when a parameter has changed. Depending on parameters, this will actualize the _initialFrequencies vector or the corresponding models in the set.
| parameters | The modified parameters. |
Reimplemented from bpp::AbstractParameterAliasable.
Reimplemented in bpp::MixedSubstitutionModelSet.
Definition at line 366 of file SubstitutionModelSet.cpp.
References bpp::AbstractParameterAliasable::getNumberOfParameters(), bpp::AbstractParameterAliasable::getNumberOfParameters(), bpp::AbstractParameterAliasable::getParameter_(), modelParameterNames_, modelParameterNames_, modelParameterNames_, modelParameterNames_, modelParameters_, modelParameters_, modelParameters_, modelParameters_, modelSet_, paramToModels_, rootFrequencies_, stationarity_, and updateRootFrequencies().
Referenced by bpp::MixedSubstitutionModelSet::fireParameterChanged().
|
inline |
Definition at line 541 of file SubstitutionModelSet.h.
References alphabet_.
Referenced by bpp::NonHomogeneousSequenceSimulator::dSimulate().
|
inline |
Get one model from the set knowing its index.
| i | Index of the model in the set. |
Definition at line 301 of file SubstitutionModelSet.h.
References modelSet_, modelSet_, and modelSet_.
Referenced by bpp::MixedSubstitutionModelSet::complete(), bpp::MixedSubstitutionModelSet::complete(), bpp::PhylogeneticsApplicationTools::completeMixedSubstitutionModelSet(), bpp::MixedSubstitutionModelSet::computeHyperNodesProbabilities(), bpp::MixedSubstitutionModelSet::computeHyperNodesProbabilities(), bpp::AbstractNonHomogeneousTreeLikelihood::ConstNonHomogeneousSiteModelIterator::ConstNonHomogeneousSiteModelIterator(), bpp::MixedSubstitutionModelSet::getHyperNodeProbability(), bpp::HomogeneousSequenceSimulator::getSubstitutionModel(), hasMixedSubstitutionModel(), bpp::MixedSubstitutionModelSet::HyperNode::HyperNode(), bpp::PhylogeneticsApplicationTools::printParameters(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
|
inline |
Definition at line 307 of file SubstitutionModelSet.h.
|
inline |
Get the model associated to a particular node id.
| nodeId | The id of the query node. |
| Exception | If no model is found for this node. |
Definition at line 335 of file SubstitutionModelSet.h.
References modelSet_, nodeToModel_, nodeToModel_, and bpp::TextTools::toString().
Referenced by bpp::AbstractNonHomogeneousTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::RNonHomogeneousMixedTreeLikelihood::computeTransitionProbabilitiesForNode(), bpp::AbstractNonHomogeneousTreeLikelihood::getNewBranchModelIterator(), bpp::AbstractNonHomogeneousTreeLikelihood::getSubstitutionModelForNode(), bpp::AbstractNonHomogeneousTreeLikelihood::getSubstitutionModelForNode(), and bpp::NonHomogeneousSequenceSimulator::init().
|
inline |
Definition at line 342 of file SubstitutionModelSet.h.
References modelSet_, nodeToModel_, nodeToModel_, and bpp::TextTools::toString().
|
inline |
Get the index in the set of the model associated to a particular node id.
| nodeId | The id of the query node. |
| Exception | If no model is found for this node. |
Definition at line 320 of file SubstitutionModelSet.h.
References nodeToModel_, nodeToModel_, and bpp::TextTools::toString().
Referenced by bpp::RNonHomogeneousMixedTreeLikelihood::computeTransitionProbabilitiesForNode().
| ParameterList SubstitutionModelSet::getModelParameters | ( | size_t | modelIndex | ) | const |
Get the parameters attached to a Model.
| modelIndex | the index of the model in the set |
Definition at line 220 of file SubstitutionModelSet.cpp.
References bpp::ParameterList::addParameter(), modelParameterNames_, paramToModels_, rootFrequencies_, and stationarity_.
| vector< size_t > SubstitutionModelSet::getModelsWithParameter | ( | const std::string & | name | ) | const throw (ParameterNotFoundException) |
| name | The name of the parameter to look for. |
| ParameterNotFoundException | If no parameter with the specified name is found. |
Definition at line 144 of file SubstitutionModelSet.cpp.
Referenced by bpp::PhylogeneticsApplicationTools::printParameters(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
|
inline |
Get the parameters corresponding attached to the nodes of the tree.
That is, all the parameters without the root frequencies.
Definition at line 520 of file SubstitutionModelSet.h.
References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::getNumberOfParameters(), rootFrequencies_, and stationarity_.
Referenced by bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), and bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged().
|
inline |
Get a list of nodes id for which the given model is associated.
| i | The index of the model in the set. |
| IndexOutOfBoundsException | If the index is not valid. |
Definition at line 357 of file SubstitutionModelSet.h.
References modelSet_, modelSet_, and modelToNodes_.
Referenced by bpp::AbstractNonHomogeneousTreeLikelihood::ConstNonHomogeneousSiteModelIterator::ConstNonHomogeneousSiteModelIterator(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), and bpp::PhylogeneticsApplicationTools::printParameters().
| std::vector< int > SubstitutionModelSet::getNodesWithParameter | ( | const std::string & | name | ) | const throw (ParameterNotFoundException) |
| name | The name of the parameter to look for. |
| ParameterNotFoundException | If no parameter with the specified name is found. |
Definition at line 124 of file SubstitutionModelSet.cpp.
References bpp::VectorTools::append().
Referenced by bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), and bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged().
|
inline |
Definition at line 287 of file SubstitutionModelSet.h.
References modelSet_.
Referenced by bpp::MixedSubstitutionModelSet::addToHyperNode(), bpp::MixedSubstitutionModelSet::addToHyperNode(), bpp::MixedSubstitutionModelSet::complete(), bpp::MixedSubstitutionModelSet::computeHyperNodesProbabilities(), bpp::MixedSubstitutionModelSet::getHyperNodeProbability(), hasMixedSubstitutionModel(), bpp::MixedSubstitutionModelSet::HyperNode::HyperNode(), bpp::RNonHomogeneousMixedTreeLikelihood::init(), bpp::PhylogeneticsApplicationTools::printParameters(), bpp::PhylogeneticsApplicationTools::printParameters(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
|
inline |
Get the number of states associated to this model set.
| Exception | if no model is associated to the set. |
Definition at line 235 of file SubstitutionModelSet.h.
References nbStates_.
|
inline |
Get the index of a given parameter in the list of all parameters.
| name | The name of the parameter to look for. |
| ParameterNotFoundException | If no parameter with this name is found. |
Definition at line 247 of file SubstitutionModelSet.h.
References bpp::AbstractParameterAliasable::getNumberOfParameters(), and bpp::AbstractParameterAliasable::getParameter_().
Referenced by getParameterModelName(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
|
inline |
Get the model name of a given parameter in the list of all parameters.
| name | The name of the parameter to look for. |
| ParameterNotFoundException | If no parameter with this name is found. |
| Exception | If the parameter is not a 'model' parameter (that is, it is a root frequency parameter). |
Definition at line 264 of file SubstitutionModelSet.h.
References getParameterIndex(), modelParameterNames_, modelParameterNames_, rootFrequencies_, and stationarity_.
Referenced by bpp::PhylogeneticsApplicationTools::printParameters(), and bpp::PhylogeneticsApplicationTools::printParameters().
|
inline |
Definition at line 492 of file SubstitutionModelSet.h.
References modelSet_, rootFrequencies_, and stationarity_.
Referenced by bpp::AbstractNonHomogeneousTreeLikelihood::computeAllTransitionProbabilities(), bpp::NonHomogeneousSequenceSimulator::dSimulate(), bpp::NonHomogeneousSequenceSimulator::dSimulate(), bpp::DRNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousTreeLikelihood::fireParameterChanged(), bpp::RNonHomogeneousMixedTreeLikelihood::fireParameterChanged(), bpp::NonHomogeneousSequenceSimulator::simulate(), bpp::NonHomogeneousSequenceSimulator::simulate(), and bpp::NonHomogeneousSequenceSimulator::simulate().
|
inline |
Get the parameters corresponding to the root frequencies.
Definition at line 505 of file SubstitutionModelSet.h.
References rootFrequencies_, and stationarity_.
Referenced by bpp::AbstractNonHomogeneousTreeLikelihood::getRootFrequenciesParameters(), and bpp::PhylogeneticsApplicationTools::printParameters().
|
inline |
Definition at line 487 of file SubstitutionModelSet.h.
References rootFrequencies_.
Referenced by bpp::PhylogeneticsApplicationTools::printParameters().
| bool SubstitutionModelSet::hasMixedSubstitutionModel | ( | ) | const |
Definition at line 462 of file SubstitutionModelSet.cpp.
References getModel(), and getNumberOfModels().
Referenced by bpp::PhylogeneticsApplicationTools::getSubstitutionModelSet().
|
inline |
Check if the model set is fully specified for a given tree.
This include:
| tree | The tree to check. |
| throwEx | Tell if an exception have to be thrown in case of test not passed. |
Definition at line 555 of file SubstitutionModelSet.h.
References checkOrphanModels(), checkOrphanNodes(), checkOrphanParameters(), and checkUnknownNodes().
Referenced by bpp::RNonHomogeneousMixedTreeLikelihood::RNonHomogeneousMixedTreeLikelihood(), and bpp::RNonHomogeneousMixedTreeLikelihood::RNonHomogeneousMixedTreeLikelihood().
| void SubstitutionModelSet::listModelNames | ( | std::ostream & | out = std::cout | ) | const |
Definition at line 240 of file SubstitutionModelSet.cpp.
References modelSet_, modelSet_, modelToNodes_, and modelToNodes_.
| SubstitutionModelSet & SubstitutionModelSet::operator= | ( | const SubstitutionModelSet & | set | ) |
Definition at line 70 of file SubstitutionModelSet.cpp.
References alphabet_, modelParameterNames_, modelParameters_, modelSet_, modelSet_, modelSet_, modelToNodes_, nbStates_, nodeToModel_, bpp::AbstractParameterAliasable::operator=(), paramNamesCount_, paramToModels_, rootFrequencies_, rootFrequencies_, rootFrequencies_, stationarity_, and stationarity_.
Referenced by bpp::MixedSubstitutionModelSet::operator=().
| void SubstitutionModelSet::removeModel | ( | size_t | modelIndex | ) | throw (Exception) |
Remove a model from the set, and all corresponding parameters.
| modelIndex | The index of the model in the set. |
| Exception | if a parameter becomes orphan because of the removal. |
Definition at line 201 of file SubstitutionModelSet.cpp.
| void SubstitutionModelSet::removeParameter | ( | const std::string & | name | ) | throw (ParameterNotFoundException) |
Remove a parameter from the list, and unset it to all linked nodes and models.
| name | The name of the parameter to remove. |
| ParameterNotFoundException | If no parameter with the given name is found in the list. |
Definition at line 342 of file SubstitutionModelSet.cpp.
| void SubstitutionModelSet::setModel | ( | SubstitutionModel * | model, |
| size_t | modelIndex | ||
| ) | throw (Exception, IndexOutOfBoundsException) |
Change a given model.
The new model will be copied and will replace the old one. All previous associations will be kept the same.
| model | A 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! |
| modelIndex | The index of the existing model to replace. |
Definition at line 191 of file SubstitutionModelSet.cpp.
|
inline |
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.
| modelIndex | The position of the model in the set. |
| nodeNumber | The id of the corresponding node. |
Definition at line 421 of file SubstitutionModelSet.h.
References nodeToModel_, nodeToModel_, and nodeToModel_.
| void SubstitutionModelSet::setParameterToModel | ( | size_t | parameterIndex, |
| size_t | modelIndex | ||
| ) | throw (IndexOutOfBoundsException) |
Assign a parameter to a model.
| parameterIndex | The index of the parameter in the list. |
| modelIndex | The index of the model in the list. |
| IndexOutOfBoundsException | If one of the index is not valid. |
Definition at line 253 of file SubstitutionModelSet.cpp.
References bpp::VectorTools::contains(), and bpp::TextTools::toString().
Referenced by bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().
| void SubstitutionModelSet::setRootFrequencies | ( | FrequenciesSet * | rootFreqs | ) |
Sets a given FrequenciesSet for root frequencies.
| rootFreqs | The FrequenciesSet for root frequencies. |
Definition at line 115 of file SubstitutionModelSet.cpp.
References bpp::AbstractParameterAliasable::addParameters_(), rootFrequencies_, and stationarity_.
Referenced by bpp::SubstitutionModelSetTools::createHomogeneousModelSet(), bpp::SubstitutionModelSetTools::createNonHomogeneousModelSet(), bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet(), and SubstitutionModelSet().
| void SubstitutionModelSet::unsetParameterToModel | ( | size_t | parameterIndex, |
| size_t | modelIndex | ||
| ) | throw (IndexOutOfBoundsException, Exception) |
Unset a given parameter to the specified model.
| parameterIndex | The index of the parameter in the list. |
| modelIndex | The index of the model in the list. |
| IndexOutOfBoundsException | If one of the index is not valid. |
| Exception | If the pseicified parameter is not currently associated to the specified model. |
Definition at line 271 of file SubstitutionModelSet.cpp.
References bpp::VectorTools::contains(), and bpp::TextTools::toString().
|
inlineprotected |
Set rootFrequencies_ from parameters.
Definition at line 567 of file SubstitutionModelSet.h.
References rootFrequencies_, and stationarity_.
Referenced by fireParameterChanged().
|
protected |
A pointer toward the common alphabet to all models in the set.
Definition at line 106 of file SubstitutionModelSet.h.
Referenced by getAlphabet(), and operator=().
|
private |
Contains for each parameter in the list the corresponding name in substitution models.
Definition at line 137 of file SubstitutionModelSet.h.
Referenced by clear(), fireParameterChanged(), fireParameterChanged(), fireParameterChanged(), fireParameterChanged(), getModelParameters(), getParameterModelName(), getParameterModelName(), and operator=().
|
private |
Parameters for each model in the set.
The parameters_ field, inherited from AbstractSubstitutionModel contains all parameters, with unique names. To make the correspondance with parameters for each model in the set, we duplicate them in this array. In most cases, this is something like 'theta_1 <=> theta', 'theta_2 <=> theta', etc.
Definition at line 146 of file SubstitutionModelSet.h.
Referenced by clear(), fireParameterChanged(), fireParameterChanged(), fireParameterChanged(), fireParameterChanged(), and operator=().
|
protected |
Contains all models used in this tree.
Definition at line 113 of file SubstitutionModelSet.h.
Referenced by clear(), clear(), clear(), fireParameterChanged(), getModel(), getModel(), getModel(), getModel(), getModel(), getModel(), getModelForNode(), getModelForNode(), getNodesWithModel(), getNodesWithModel(), getNumberOfModels(), getRootFrequencies(), listModelNames(), listModelNames(), operator=(), operator=(), operator=(), SubstitutionModelSet(), ~SubstitutionModelSet(), and ~SubstitutionModelSet().
|
mutableprivate |
Definition at line 125 of file SubstitutionModelSet.h.
Referenced by getNodesWithModel(), listModelNames(), listModelNames(), and operator=().
|
protected |
Definition at line 108 of file SubstitutionModelSet.h.
Referenced by clear(), getNumberOfStates(), and operator=().
|
mutableprivate |
Contains for each node in a tree the index of the corresponding model in modelSet_.
Definition at line 124 of file SubstitutionModelSet.h.
Referenced by clear(), getModelForNode(), getModelForNode(), getModelForNode(), getModelForNode(), getModelIndexForNode(), getModelIndexForNode(), operator=(), setModelToNode(), setModelToNode(), and setModelToNode().
|
private |
Definition at line 132 of file SubstitutionModelSet.h.
Referenced by clear(), and operator=().
|
private |
Contains for each parameter in the list the indexes of the corresponding models in modelSet_ that share this parameter.
Definition at line 130 of file SubstitutionModelSet.h.
Referenced by clear(), fireParameterChanged(), getModelParameters(), and operator=().
|
private |
Root frequencies.
Definition at line 119 of file SubstitutionModelSet.h.
Referenced by clear(), fireParameterChanged(), getModelParameters(), getNodeParameters(), getParameterModelName(), getRootFrequencies(), getRootFrequenciesParameters(), getRootFrequenciesSet(), operator=(), operator=(), operator=(), setRootFrequencies(), setRootFrequencies(), and updateRootFrequencies().
|
private |
Definition at line 148 of file SubstitutionModelSet.h.
Referenced by clear(), fireParameterChanged(), getModelParameters(), getNodeParameters(), getParameterModelName(), getRootFrequencies(), getRootFrequenciesParameters(), operator=(), operator=(), setRootFrequencies(), and updateRootFrequencies().