14 std::shared_ptr<const GeneticCode> gCode,
15 std::unique_ptr<NucleotideSubstitutionModelInterface> pmod,
16 vector<std::unique_ptr<CoreCodonSubstitutionModelInterface>>& vpmodel,
24 for (
auto& model : vpmodel)
29 if (model->hasCodonFrequencySet())
32 throw Exception(
"CodonAdHocSubstitutionModel::CodonAdHocSubstitutionModel : two sub models with FrequencySet");
34 freqSet_ = unique_ptr<CodonFrequencySetInterface>(model->codonFrequencySet().clone());
37 vModel_.push_back(std::move(model));
45 std::shared_ptr<const GeneticCode> gCode,
46 std::unique_ptr<NucleotideSubstitutionModelInterface> pmod1,
47 std::unique_ptr<NucleotideSubstitutionModelInterface> pmod2,
48 std::unique_ptr<NucleotideSubstitutionModelInterface> pmod3,
49 vector<std::unique_ptr<CoreCodonSubstitutionModelInterface>>& vpmodel,
50 const std::string& name) :
57 for (
auto& model : vpmodel)
62 if (model->hasCodonFrequencySet())
65 throw Exception(
"CodonAdHocSubstitutionModel::CodonAdHocSubstitutionModel : two sub models with FrequencySet");
67 freqSet_ = unique_ptr<CodonFrequencySetInterface>(model->codonFrequencySet().clone());
71 vModel_.push_back(std::move(model));
88 vModel_.emplace_back(mod->clone());
93 if (mod->hasCodonFrequencySet())
96 throw Exception(
"CodonAdHocSubstitutionModel::CodonAdHocSubstitutionModel : two sub models with FrequencySet");
98 freqSet_ = unique_ptr<CodonFrequencySetInterface>(mod->codonFrequencySet().clone());
112 for (
auto& mod : model.
vModel_)
114 vModel_.emplace_back(mod->clone());
119 if (mod->hasCodonFrequencySet())
122 throw Exception(
"CodonAdHocSubstitutionModel::CodonAdHocSubstitutionModel : two sub models with FrequencySet");
124 freqSet_ = unique_ptr<CodonFrequencySetInterface>(mod->codonFrequencySet().clone());
135 model->setFreq(frequencies);
144 model->matchParametersValues(parameters);
157 x *= model->getCodonsMulRate(i, j);
Abstract class for substitution models on codons.
AbstractCodonSubstitutionModel & operator=(const AbstractCodonSubstitutionModel &model)
void updateMatrices_() override
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
void setNamespace(const std::string &prefix) override
void addParameters_(const ParameterList ¶meters)
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
bool computeFrequencies() const
virtual void fireParameterChanged(const ParameterList ¶meters) override
Tells the model that a parameter value has changed.
Class for substitution models of codons with several layers of codon models.
double getCodonsMulRate(size_t i, size_t j) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
void fireParameterChanged(const ParameterList ¶meterlist) override
Tells the model that a parameter value has changed.
CodonAdHocSubstitutionModel(std::shared_ptr< const GeneticCode > gCode, std::unique_ptr< NucleotideSubstitutionModelInterface > pmod, std::vector< std::unique_ptr< CoreCodonSubstitutionModelInterface >> &vpmodel, const std::string &name)
Build a new CodonAdHocSubstitutionModel object from a pointer to NucleotideSubstitutionModel.
std::vector< std::unique_ptr< CoreCodonSubstitutionModelInterface > > vModel_
void setFreq(std::map< int, double > &frequencies) override
Estimation of the parameters of the models so that the equilibrium frequencies match the given ones.
std::unique_ptr< CodonFrequencySetInterface > freqSet_
optional FrequencySet if model is defined through a FrequencySet.
CodonAdHocSubstitutionModel & operator=(const CodonAdHocSubstitutionModel &model)
virtual bool matchParametersValues(const ParameterList ¶meters)=0
Defines the basic types of data flow nodes.