42 #include <Bpp/Numeric/NumConstants.h> 43 #include <Bpp/Numeric/Prob/SimpleDiscreteDistribution.h> 58 throw Exception(
"At least one omega is necessary in the YNGKP_M3 model");
62 vector<double> v1, v2;
64 for (
unsigned int i = 1; i < nbOmega; i++)
66 v1.push_back(0.5 + 0.5 * i);
69 for (
unsigned int i = 0; i < nbOmega; i++)
71 v2.push_back(1. / nbOmega);
74 SimpleDiscreteDistribution* psdd =
new SimpleDiscreteDistribution(v1, v2, NumConstants::MILLI());
76 map<string, DiscreteDistribution*> mpdd;
79 YN98* yn98 =
new YN98(gc, codonFreqs);
86 ParameterList pl =
pmixmodel_->getParameters();
87 for (
size_t i = 0; i < pl.size(); ++i)
93 for (
size_t i = 0; i < v.size(); ++i)
100 for (
size_t i = 1; i < nbOmega; ++i)
102 mapParNamesFromPmodel_[
"YN98.omega_Simple.theta" + TextTools::toString(i)] =
"theta" + TextTools::toString(i);
107 for (
size_t i = 1; i < nbOmega; ++i)
109 mapParNamesFromPmodel_[
"YN98.omega_Simple.V" + TextTools::toString(i + 1)] =
"delta" + TextTools::toString(i);
117 st =
pmixmodel_->getParameterNameWithoutNamespace(it->first);
118 if (it->second.substr(0, 5) !=
"delta")
119 addParameter_(
new Parameter(
"YNGKP_M3." + it->second,
pmixmodel_->getParameterValue(st),
120 pmixmodel_->getParameter(st).hasConstraint() ?
pmixmodel_->getParameter(st).getConstraint()->clone() : 0,
true));
123 for (
size_t i = 1; i < nbOmega; ++i)
125 addParameter_(
new Parameter(
"YNGKP_M3.delta" + TextTools::toString(i), 0.5,
new IntervalConstraint(NumConstants::MILLI(), 999,
true,
true, NumConstants::MILLI()),
true));
133 if (gc->areSynonymous(supportedChars[
synfrom_], supportedChars[
synto_])
142 if (
synto_ == supportedChars.size())
143 throw Exception(
"Impossible to find synonymous codons");
151 synfrom_(mod2.synfrom_),
170 for (
unsigned int i = 0; i <
lParPmodel_.size(); i++)
176 size_t ind = TextTools::to<size_t>(
lParPmodel_[i].getName().substr(19));
177 double x = getParameterValue(
"omega0");
178 for (
unsigned j = 1; j < ind; j++)
180 x += getParameterValue(
"delta" + TextTools::toString(j));
198 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_.
size_t synfrom_
indexes of 2 codons between which the substitution is synonymous, to set a basis to the homogeneizati...
ParameterList lParPmodel_
Abstract class for mixture models based on the bibliography.
std::string getName() const
Get the name of the model.
Parametrize a set of state frequencies.
const std::vector< int > & getAlphabetStates() const
std::auto_ptr< MixtureOfASubstitutionModel > pmixmodel_
AbstractBiblioMixedSubstitutionModel & operator=(const AbstractBiblioMixedSubstitutionModel &model)
The Yang and Nielsen (1998) substitution model for codons.
const FrequenciesSet * getFrequenciesSet() const
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
The Yang et al (2000) M3 substitution model for codons.
Substitution models defined as a mixture of nested substitution models.
YNGKP_M3 & operator=(const YNGKP_M3 &)
YNGKP_M3(const GeneticCode *gc, FrequenciesSet *codonFreqs, unsigned int nclass=3)