8 #include "../MixtureOfASubstitutionModel.h"
18 shared_ptr<const GeneticCode> gc,
19 unique_ptr<CodonFrequencySetInterface> codonFreqs,
20 unsigned int nbOmega) :
29 throw Exception(
"At least one omega is necessary in the YNGP_M3 model");
33 vector<double> v1, v2;
35 for (
unsigned int i = 1; i < nbOmega; ++i)
37 v1.push_back(0.5 + 0.5 * i);
40 for (
unsigned int i = 0; i < nbOmega; ++i)
42 v2.push_back(1. / nbOmega);
45 auto psdd = make_unique<SimpleDiscreteDistribution>(v1, v2, 0.002);
47 map<string, unique_ptr<DiscreteDistributionInterface>> mpdd;
48 mpdd[
"omega"] = std::move(psdd);
50 auto yn98 = make_unique<YN98>(gc, std::move(codonFreqs));
60 for (
size_t i = 0; i < pl.
size(); ++i)
73 for (
size_t i = 1; i < nbOmega; ++i)
80 for (
size_t i = 1; i < nbOmega; ++i)
91 if (it.second.substr(0, 5) !=
"delta")
93 mixedModelPtr_->parameter(st).hasConstraint() ? shared_ptr<ConstraintInterface>(
mixedModelPtr_->parameter(st).getConstraint()->clone()) : 0));
96 for (
size_t i = 1; i < nbOmega; ++i)
106 if (gc->areSynonymous(supportedChars[
synfrom_], supportedChars[
synto_])
115 if (
synto_ == supportedChars.size())
116 throw Exception(
"Impossible to find synonymous codons");
130 if (np.size() > 19 && np[18] ==
'V')
132 size_t ind = TextTools::to<size_t>(np.substr(19));
134 for (
unsigned j = 1; j < ind; j++)
139 const auto parConst =
lParPmodel_[i].getConstraint();
140 lParPmodel_[i].setValue(parConst ? (parConst->isCorrect(x) ? x : parConst->getAcceptedLimit(x)) : x);
153 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)
const std::vector< int > & getAlphabetStates() const override
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
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.
YNGP_M3(std::shared_ptr< const GeneticCode > gc, std::unique_ptr< CodonFrequencySetInterface > codonFreqs, unsigned int nclass=3)
void updateMatrices_() override
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...
std::string toString(T t)
Defines the basic types of data flow nodes.
std::vector< double > Vdouble