42 #include <Bpp/Numeric/Prob/MixtureOfDiscreteDistributions.h> 43 #include <Bpp/Numeric/Prob/SimpleDiscreteDistribution.h> 44 #include <Bpp/Numeric/Prob/BetaDiscreteDistribution.h> 45 #include <Bpp/Text/TextTools.h> 60 throw Exception(
"Bad number of classes for model YNGKP_M8: " + TextTools::toString(nclass));
64 BetaDiscreteDistribution* pbdd =
new BetaDiscreteDistribution(nclass, 2, 2);
66 vector<double> val; val.push_back(2);
67 vector<double> prob; prob.push_back(1);
68 SimpleDiscreteDistribution* psdd =
new SimpleDiscreteDistribution(val, prob);
70 vector<DiscreteDistribution*> v_distr;
71 v_distr.push_back(pbdd); v_distr.push_back(psdd);
72 prob.clear(); prob.push_back(0.5); prob.push_back(0.5);
74 MixtureOfDiscreteDistributions* pmodd =
new MixtureOfDiscreteDistributions(v_distr, prob);
76 map<string, DiscreteDistribution*> mpdd;
77 mpdd[
"omega"] = pmodd;
79 YN98* yn98 =
new YN98(gc, codonFreqs);
86 ParameterList pl =
pmixmodel_->getParameters();
87 for (
size_t i = 0; i < pl.size(); i++)
94 for (
size_t i = 0; i < v.size(); i++)
110 st =
pmixmodel_->getParameterNameWithoutNamespace(it->first);
111 if (it->second !=
"omegas")
112 addParameter_(
new Parameter(
"YNGKP_M8." + it->second,
pmixmodel_->getParameterValue(st),
113 pmixmodel_->getParameter(st).hasConstraint() ?
pmixmodel_->getParameter(st).getConstraint()->clone() : 0,
true));
116 addParameter_(
new Parameter(
"YNGKP_M8.omegas", 2.,
new IntervalConstraint(1, 1,
false),
true));
123 if ((gc->areSynonymous(supportedChars[
synfrom_], supportedChars[
synto_]))
132 if (
synto_ == gc->getSourceAlphabet()->getSize())
133 throw Exception(
"Impossible to find synonymous codons");
141 synfrom_(mod2.synfrom_),
166 for (
unsigned int i = 0; i <
pmixmodel_->getNumberOfModels(); i++)
std::map< std::string, std::string > mapParNamesFromPmodel_
Tools to make the link between the Parameters of the object and those of pmixmodel_.
ParameterList lParPmodel_
Abstract class for mixture models based on the bibliography.
virtual void updateMatrices()
Parametrize a set of state frequencies.
const std::vector< int > & getAlphabetStates() const
size_t synfrom_
indexes of 2 codons between which the substitution is synonymous, to set a basis to the homogeneizati...
AbstractBiblioMixedSubstitutionModel & operator=(const AbstractBiblioMixedSubstitutionModel &model)
YNGKP_M8 & operator=(const YNGKP_M8 &)
const FrequenciesSet * getFrequenciesSet() const
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
The Yang and Nielsen (1998) substitution model for codons.
The Yang et al (2000) M8 substitution model for codons.
Substitution models defined as a mixture of nested substitution models.
std::auto_ptr< MixtureOfASubstitutionModel > pmixmodel_
YNGKP_M8(const GeneticCode *gc, FrequenciesSet *codonFreqs, unsigned int nbclass)