10 #include "../MixtureOfASubstitutionModel.h"
20 std::shared_ptr<const GeneticCode> gc,
21 std::unique_ptr<CodonFrequencySetInterface> codonFreqs,
29 YNGP_M(neutral ?
"YNGP_M8a." :
"YNGP_M8."),
37 auto pbdd = make_unique<BetaDiscreteDistribution>(nclass, 2, 2);
39 vector<double> val = {
neutral_ ? 1. : 2. };
40 vector<double> prob = { 1. };
41 auto psdd = make_unique<SimpleDiscreteDistribution>(val, std::move(prob));
43 vector<unique_ptr<DiscreteDistributionInterface>> v_distr;
44 v_distr.push_back(std::move(pbdd));
45 v_distr.push_back(std::move(psdd));
51 auto pmodd = make_unique<MixtureOfDiscreteDistributions>(v_distr, prob);
53 map<string, unique_ptr<DiscreteDistributionInterface>> mpdd;
54 mpdd[
"omega"] = std::move(pmodd);
56 auto yn98 = make_unique<YN98>(gc, std::move(codonFreqs));
66 for (
size_t i = 0; i < pl.
size(); ++i)
93 if (it.second !=
"omegas")
95 mixedModelPtr_->parameter(st).hasConstraint() ? std::shared_ptr<ConstraintInterface>(
mixedModelPtr_->parameter(st).getConstraint()->clone()) : 0));
106 if ((gc->areSynonymous(supportedChars[
synfrom_], supportedChars[
synto_]))
115 if (
synto_ == gc->getSourceAlphabet()->getSize())
116 throw Exception(
"Impossible to find synonymous codons");
131 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_
virtual void updateMatrices_()
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 const ParameterList & getParameters() 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_M8(std::shared_ptr< const GeneticCode > gc, std::unique_ptr< CodonFrequencySetInterface > codonFreqs, unsigned int nbclass, bool neutral=false)
Constructor that requires the number of classes of the BetaDiscreteDistribution.
void updateMatrices_() override
bool neutral_
If parameter omega=1.
std::string getName() const override
Get the name of the model.
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