5 #ifndef BPP_PHYL_LIKELIHOOD_SUBSTITUTIONPROCESSCOLLECTION_H
6 #define BPP_PHYL_LIKELIHOOD_SUBSTITUTIONPROCESSCOLLECTION_H
19 #include "../Model/FrequencySet/FrequencySet.h"
20 #include "../Model/SubstitutionModel.h"
113 std::map<size_t, std::shared_ptr<SubstitutionProcessCollectionMember>>
mSubProcess_;
169 void addParametrizable(std::shared_ptr<Parametrizable> parametrizable,
size_t parametrizableIndex,
bool withParameters =
true);
171 void replaceParametrizable(std::shared_ptr<Parametrizable> parametrizable,
size_t parametrizableIndex,
bool withParameters =
true);
181 void addModel(std::shared_ptr<BranchModelInterface>
model,
size_t modelIndex)
191 void addFrequencies(std::shared_ptr<FrequencySetInterface> frequencies,
size_t frequenciesIndex)
201 void addDistribution(std::shared_ptr<DiscreteDistributionInterface> distribution,
size_t distributionIndex)
205 if (distributionIndex >= 10000)
206 mVConstDist_[distributionIndex / 10000 - 1].push_back(distributionIndex % 10000);
210 void addTree(std::shared_ptr<ParametrizablePhyloTree>
tree,
size_t treeIndex)
220 void addScenario(std::shared_ptr<ModelScenario> scen,
size_t scenIndex)
241 std::shared_ptr<BranchModelInterface>
getModel(
size_t modelIndex)
243 return std::dynamic_pointer_cast<BranchModelInterface>(
modelColl_[modelIndex]);
246 std::shared_ptr<const BranchModelInterface>
getModel(
size_t modelIndex)
const
248 return std::dynamic_pointer_cast<const BranchModelInterface>(
modelColl_[modelIndex]);
288 return *(std::dynamic_pointer_cast<const FrequencySetInterface>(
freqColl_[frequenciesIndex]));
296 std::shared_ptr<const FrequencySetInterface>
getFrequencySet(
size_t frequenciesIndex)
const
343 std::shared_ptr<ParametrizablePhyloTree>
getTree(
size_t treeIndex)
345 return std::dynamic_pointer_cast<ParametrizablePhyloTree>(
treeColl_[treeIndex]);
348 std::shared_ptr<const ParametrizablePhyloTree>
getTree(
size_t treeIndex)
const
350 return std::dynamic_pointer_cast<const ParametrizablePhyloTree>(
treeColl_[treeIndex]);
387 std::vector<size_t> vkeys;
391 vkeys.push_back(it.first);
424 std::vector<size_t> vn;
428 vn.push_back(it->first);
481 void aliasParameters(std::map<std::string, std::string>& unparsedParams,
bool verbose);
499 void addSubstitutionProcess(
size_t nProc, std::map<
size_t, std::vector<unsigned int>> mModBr,
size_t nTree,
size_t nRate,
size_t nFreq);
512 void addSubstitutionProcess(
size_t nProc, std::map<
size_t, std::vector<unsigned int>> mModBr,
size_t nTree,
size_t nRate);
564 return *(it->second);
const ParameterList & getIndependentParameters() const
Interface for all Branch models.
Parametrize a set of state frequencies.
virtual ParameterList getCommonParametersWith(const ParameterList ¶ms) const
PhyloTree with Parametrizable Phylo Branches. They SHARE their branch length parameters.
Collection of Substitution Process, which owns all the necessary objects: Substitution models,...
std::vector< size_t > getRateDistributionNumbers() const
ParametrizableCollection< DiscreteDistributionInterface > distColl_
std::shared_ptr< const ParametrizablePhyloTree > getTree(size_t treeIndex) const
void setNamespace(const std::string &prefix)
std::shared_ptr< const BranchModelInterface > getModel(size_t modelIndex) const
ParameterList getRootFrequenciesParameters(size_t nFreq, bool independent) const
Get the parameters associated to the root frequencies(s).
std::map< size_t, std::shared_ptr< SubstitutionProcessCollectionMember > > mSubProcess_
FrequencySetInterface & frequencySet(size_t frequenciesIndex)
Get a FrequencySet from the collection.
SubstitutionProcessCollection & operator=(const SubstitutionProcessCollection &set)
DiscreteDistributionInterface & rateDistribution(size_t distributionIndex)
ParametrizableCollection< BranchModelInterface > modelColl_
std::vector< size_t > getSubstitutionProcessNumbers() const
std::vector< size_t > getModelNumbers() const
Get the numbers of the specified objects from the collections.
std::map< size_t, std::vector< size_t > > mDistToSubPro_
std::map< size_t, std::shared_ptr< ModelScenario > > mModelScenario_
SubstitutionProcessCollection * clone() const
void replaceFrequencies(std::shared_ptr< FrequencySetInterface > frequencies, size_t frequenciesIndex)
void addScenario(std::shared_ptr< ModelScenario > scen, size_t scenIndex)
bool hasModelNumber(size_t n) const
std::map< size_t, std::vector< size_t > > mModelToSubPro_
void replaceTree(std::shared_ptr< ParametrizablePhyloTree > tree, size_t treeIndex)
size_t getNumberOfSubstitutionProcess() const
Methods to retrieve Substitution Process.
const BranchModelInterface & model(size_t modelIndex) const
const SubstitutionProcessCollectionMember & substitutionProcess(size_t i) const
ParameterList getNonDerivableParameters() const
Get the Non-derivable parameters.
void fireParameterChanged(const ParameterList ¶meters)
AbstractParameterAliasable functions, redirected towards the process members.
std::shared_ptr< const ModelScenario > getModelScenario(size_t numPath) const
Get a ModelScenario from the set.
const DiscreteDistributionInterface & rateDistribution(size_t distributionIndex) const
bool hasTreeNumber(size_t n) const
ParameterList getRateDistributionParameters(size_t nRate, bool independent) const
Get the parameters associated to the rate distribution(s).
std::shared_ptr< FrequencySetInterface > getFrequencySet(size_t frequenciesIndex)
size_t getModelIndex(std::shared_ptr< BranchModelInterface > model) const
Return the number of a BranchModel in the collection.
BranchModelInterface & model(size_t modelIndex)
Get a BranchModel from the collection.
std::shared_ptr< const FrequencySetInterface > getFrequencySet(size_t frequenciesIndex) const
void addFrequencies(std::shared_ptr< FrequencySetInterface > frequencies, size_t frequenciesIndex)
void clear()
Resets all the information contained in this object.
SubstitutionProcessCollectionMember & substitutionProcess(size_t i)
std::shared_ptr< DiscreteDistributionInterface > getRateDistribution(size_t distributionIndex)
Get a DiscreteDistribution from the collection.
void replaceParametrizable(std::shared_ptr< Parametrizable > parametrizable, size_t parametrizableIndex, bool withParameters=true)
ParametrizableCollection< FrequencySetInterface > freqColl_
std::vector< size_t > getScenarioNumbers() const
virtual ~SubstitutionProcessCollection()
ParameterList getBranchLengthParameters(size_t nTree, bool independent) const
bool hasFrequenciesNumber(size_t n) const
ParameterList getSubstitutionModelParameters(size_t nMod, bool independent) const
Get the parameters associated to substitution model(s).
void addOnePerBranchSubstitutionProcess(size_t nProc, size_t nMod, size_t nTree, size_t nRate, size_t nFreq, const std::vector< std::string > &sharedParameterNames)
ParameterList getSubstitutionProcessParameters(size_t nProc, bool independent) const
Get the parameters associated to substitution process(es).
void aliasParameters(const std::string &p1, const std::string &p2)
ParameterList getRateDistributionParameters(bool independent) const
ParameterList getRootFrequenciesParameters(bool independent) const
std::vector< size_t > getFrequenciesNumbers() const
bool hasModelScenario(size_t numPath) const
checks if the set has a ModelScenario
std::map< size_t, std::vector< size_t > > mTreeToSubPro_
std::shared_ptr< const SubstitutionProcessCollectionMember > getSubstitutionProcess(size_t i) const
void unaliasParameters(const std::string &p1, const std::string &p2)
std::shared_ptr< BranchModelInterface > getModel(size_t modelIndex)
bool hasModel(std::shared_ptr< BranchModelInterface > model) const
Return if a BranchModel is in the collection.
bool hasSubstitutionProcessNumber(size_t n) const
ParameterList getBranchLengthParameters(bool independent) const
Methods to retrieve parameters.
SubstitutionProcessCollection()
Create empty collections.
ParametrizableCollection< ParametrizablePhyloTree > treeColl_
std::shared_ptr< const DiscreteDistributionInterface > getRateDistribution(size_t distributionIndex) const
void replaceModel(std::shared_ptr< BranchModelInterface > model, size_t modelIndex)
bool hasDistributionNumber(size_t n) const
ParameterList getSubstitutionModelParameters(bool independent) const
void addDistribution(std::shared_ptr< DiscreteDistributionInterface > distribution, size_t distributionIndex)
void addModel(std::shared_ptr< BranchModelInterface > model, size_t modelIndex)
specific methods to add specific objects.
void addParametrizable(std::shared_ptr< Parametrizable > parametrizable, size_t parametrizableIndex, bool withParameters=true)
Add a new parametrizable to the matching collection with a given number.
void addSubstitutionProcess(size_t nProc, std::map< size_t, std::vector< unsigned int >> mModBr, size_t nTree, size_t nRate, size_t nFreq)
ParameterList getSubstitutionProcessParameters() const
std::vector< size_t > getTreeNumbers() const
const ParametrizablePhyloTree & tree(size_t treeIndex) const
const FrequencySetInterface & frequencySet(size_t frequenciesIndex) const
std::shared_ptr< SubstitutionProcessCollectionMember > getSubstitutionProcess(size_t i)
std::map< size_t, std::vector< size_t > > mVConstDist_
std::shared_ptr< ParametrizablePhyloTree > getTree(size_t treeIndex)
void addTree(std::shared_ptr< ParametrizablePhyloTree > tree, size_t treeIndex)
std::shared_ptr< ModelScenario > getModelScenario(size_t numPath)
std::map< size_t, std::vector< size_t > > mFreqToSubPro_
ParametrizablePhyloTree & tree(size_t treeIndex)
Get a tree from the set.
Defines the basic types of data flow nodes.