5 #include "../MixtureOfASubstitutionModel.h"
20 shared_ptr<const GeneticCode> gc,
21 unique_ptr<CodonFrequencySetInterface> codonFreqs) :
30 vector<double> omega_initials, omega_frequencies_initials;
31 omega_initials.push_back(0.5); omega_initials.push_back(1); omega_initials.push_back(2);
32 omega_frequencies_initials.push_back(0.333333); omega_frequencies_initials.push_back(0.333333); omega_frequencies_initials.push_back(0.333334);
34 auto psdd = make_unique<SimpleDiscreteDistribution>(omega_initials, omega_frequencies_initials);
36 map<string, unique_ptr<DiscreteDistributionInterface>> mpdd;
37 mpdd[
"omega"] = std::move(psdd);
40 auto yn98 = make_unique<YN98>(gc, std::move(codonFreqs));
43 mixedModelPtr_ = make_unique<MixtureOfASubstitutionModel>(gc->getSourceAlphabet(), std::move(yn98), mpdd);
50 for (
size_t i = 0; i < pl.
size(); ++i)
80 if (it.second.substr(0, 5) !=
"omega" && it.second.substr(0, 5) !=
"p")
83 mixedModelPtr_->parameter(st).hasConstraint() ? std::shared_ptr<ConstraintInterface>(
mixedModelPtr_->parameter(st).getConstraint()->clone()) : 0));
110 if (gc->areSynonymous(supportedChars[
synfrom_], supportedChars[
synto_])
119 if (
synto_ == supportedChars.size())
120 throw Exception(
"Impossible to find synonymous codons");
135 if (np.size() > 19 && np[18] ==
'V')
141 ind = TextTools::to<int>(np.substr(19)) - 1;
148 omega =
pow(omega, k);
157 omega =
pow (omega, k);
166 omega =
pow (omega, k);
186 for (
unsigned int i = 0; i <
mixedModelPtr_->getNumberOfModels(); ++i)
const MixedTransitionModelInterface & mixedModel() const
std::unique_ptr< MixedTransitionModelInterface > mixedModelPtr_
const FrequencySetInterface & frequencySet() const override
Partial implementation of the SubstitutionModel interface for models that are set for matching the bi...
std::map< std::string, std::string > mapParNamesFromPmodel_
Tools to make the link between the Parameters of the object and those of pmixmodel_.
ParameterList lParPmodel_
void addParameter_(Parameter *parameter)
Abstract class of Wrapping model class, where all methods are redirected from model().
const SubstitutionModelInterface & subNModel(size_t i) const
virtual std::vector< std::string > getParameterNames() const
virtual void addParameter(const Parameter ¶m)
virtual std::string getParameterNameWithoutNamespace(const std::string &name) const=0
virtual double getParameterValue(const std::string &name) const=0
virtual const ParameterList & getParameters() const=0
virtual const Parameter & parameter(const std::string &name) const=0
void updateMatrices_() override
RELAX(std::shared_ptr< const GeneticCode > gc, std::unique_ptr< CodonFrequencySetInterface > codonFreqs)
virtual double Qij(size_t i, size_t j) const =0
A method for computing all necessary matrices.
virtual bool computeFrequencies() const =0
The Yang and Nielsen (1998) substitution model for codons.
Abstract generic class for The Yang et al (2000) M substitution models for codons....
const MixtureOfASubstitutionModel * mixedSubModelPtr_
size_t synfrom_
indexes of 2 codons states between which the substitution is synonymous, to set a basis to the homoge...
Defines the basic types of data flow nodes.
std::vector< double > Vdouble
ExtendedFloat pow(const ExtendedFloat &ef, double exp)