5 #ifndef BPP_PHYL_LIKELIHOOD_RATEACROSSSITESSUBSTITUTIONPROCESS_H
6 #define BPP_PHYL_LIKELIHOOD_RATEACROSSSITESSUBSTITUTIONPROCESS_H
23 std::shared_ptr<BranchModelInterface>
model_;
24 std::shared_ptr<DiscreteDistributionInterface>
rDist_;
28 std::shared_ptr<BranchModelInterface>
model,
29 std::shared_ptr<DiscreteDistributionInterface> rdist,
30 std::shared_ptr<const PhyloTree> tree =
nullptr,
31 std::shared_ptr<FrequencySetInterface> rootFrequencies =
nullptr);
34 std::shared_ptr<BranchModelInterface>
model,
35 std::shared_ptr<DiscreteDistributionInterface> rdist,
36 std::shared_ptr<ParametrizablePhyloTree> tree,
37 std::shared_ptr<FrequencySetInterface> rootFrequencies =
nullptr);
53 return std::vector<size_t>(1, 1);
61 std::shared_ptr<const StateMapInterface>
getStateMap()
const override
63 return model_->getStateMap();
71 std::shared_ptr<const BranchModelInterface>
getModel(
size_t n)
const override
81 std::shared_ptr<const BranchModelInterface>
getModel(
unsigned int nodeId,
size_t classIndex)
const override
88 throw Exception(
"RateAcrossSitesSubstitutionProcess::getNodesWithModel not finished. Ask developers.");
97 std::shared_ptr<const BranchModelInterface>
getModelForNode(
unsigned int nodeId)
const override
105 throw NullPointerException(
"RateAcrossSitesSubstitutionProcess::rateDistribution. No associated rate distribution.");
112 throw NullPointerException(
"RateAcrossSitesSubstitutionProcess::rateDistribution. No associated rate distribution.");
128 return independent ?
model_->getIndependentParameters() :
model_->getParameters();
133 return independent ?
rDist_->getIndependentParameters() :
rDist_->getParameters();
148 if (std::dynamic_pointer_cast<const TransitionModelInterface>(
model_))
149 return std::dynamic_pointer_cast<const TransitionModelInterface>(
model_)->getFrequencies();
151 throw Exception(
"SimpleSubstitutionProcess::getRootFrequencies not possible with a non Transition Model.");
167 if (classIndex >=
rDist_->getNumberOfCategories())
169 return rDist_->getProbability(classIndex);
176 for (
size_t i = 0; i <
rDist_->getNumberOfCategories(); ++i)
178 vProb.push_back(
rDist_->getProbability(i));
186 if (classIndex >=
rDist_->getNumberOfCategories())
188 return rDist_->getCategory(classIndex);
A partial implementation of the SubstitutionProcess interface.
bool hasRootFrequencySet() const
std::shared_ptr< const FrequencySetInterface > getRootFrequencySet() const
std::shared_ptr< const ParametrizablePhyloTree > getParametrizablePhyloTree() const
Interface for all Branch models.
void setModelScenario(std::shared_ptr< ModelScenario > modelpath) override
Set the modelPath, after checking it is valid (ie modelpath has only the model of the process).
RateAcrossSitesSubstitutionProcess * clone() const override
const std::vector< double > & getRootFrequencies() const override
Get the values of the frequencies for each state in the alphabet at the root node.
RateAcrossSitesSubstitutionProcess & operator=(const RateAcrossSitesSubstitutionProcess &rassp)
void fireParameterChanged(const ParameterList &pl) override
AbsractParametrizable interface.
size_t getNumberOfModels() const override
const std::vector< unsigned int > getNodesWithModel(size_t i) const override
Get a list of nodes id for which the given model is associated.
std::shared_ptr< DiscreteDistributionInterface > rDist_
double getProbabilityForModel(size_t classIndex) const override
std::shared_ptr< BranchModelInterface > model_
ParameterList getBranchLengthParameters(bool independent) const override
std::shared_ptr< const DiscreteDistributionInterface > getRateDistribution() const override
Get a pointer to the rate distribution (or null if there is no rate distribution).
const DiscreteDistributionInterface & rateDistribution() const override
Get the rate distribution.
DiscreteDistributionInterface & rateDistribution() override
Get the rate distribution.
const BranchModelInterface & model(unsigned int nodeId, size_t classIndex) const override
Get the substitution model corresponding to a certain branch, site pattern, and model class.
std::shared_ptr< const BranchModelInterface > getModel(size_t n) const override
std::vector< size_t > getModelNumbers() const override
Vdouble getClassProbabilities() const override
std::shared_ptr< const BranchModelInterface > getModelForNode(unsigned int nodeId) const override
Get the model associated to a particular node id.
const StateMapInterface & stateMap() const override
std::shared_ptr< const BranchModelInterface > getModel(unsigned int nodeId, size_t classIndex) const override
Get the substitution model corresponding to a certain branch, site pattern, and model class.
std::shared_ptr< const StateMapInterface > getStateMap() const override
std::shared_ptr< DiscreteDistributionInterface > getRateDistribution() override
Get a pointer to the rate distribution (or null if there is no rate distribution).
const BranchModelInterface & model(size_t n) const override
ParameterList getSubstitutionModelParameters(bool independent) const override
Methods to retrieve the parameters of specific objects.
RateAcrossSitesSubstitutionProcess(std::shared_ptr< BranchModelInterface > model, std::shared_ptr< DiscreteDistributionInterface > rdist, std::shared_ptr< const PhyloTree > tree=nullptr, std::shared_ptr< FrequencySetInterface > rootFrequencies=nullptr)
size_t getModelNumberForNode(unsigned int nodeId) const override
Get the number of the model associated to a particular node id.
double getRateForModel(size_t classIndex) const override
ParameterList getRateDistributionParameters(bool independent) const override
Map the states of a given alphabet which have a model state.
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
std::vector< unsigned int > Vuint