8
Copyright or © or Copr. CNRS, (November 16, 2004)
9
This software is a computer program whose purpose is to provide classes
10
for phylogenetic data analysis.
12
This software is governed by the CeCILL license under French law and
13
abiding by the rules of distribution of free software. You can use,
14
modify and/ or redistribute the software under the terms of the CeCILL
15
license as circulated by CEA, CNRS and INRIA at the following URL
16
"http://www.cecill.info".
18
As a counterpart to the access to the source code and rights to copy,
19
modify and redistribute granted by the license, users are provided only
20
with a limited warranty and the software's author, the holder of the
21
economic rights, and the successive licensors have only limited
24
In this respect, the user's attention is drawn to the risks associated
25
with loading, using, modifying and/or developing or reproducing the
26
software by the user in light of its specific status of free software,
27
that may mean that it is complicated to manipulate, and that also
28
therefore means that it is reserved for developers and experienced
29
professionals having in-depth computer knowledge. Users are therefore
30
encouraged to load and test the software's suitability as regards their
31
requirements in conditions enabling the security of their systems and/or
32
data to be ensured and, more generally, to use and operate it in the
33
same conditions as regards security.
35
The fact that you are presently reading this means that you have had
36
knowledge of the CeCILL license and that you accept its terms.
8
Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
9
This software is a computer program whose purpose is to provide classes
10
for phylogenetic data analysis.
12
This software is governed by the CeCILL license under French law and
13
abiding by the rules of distribution of free software. You can use,
14
modify and/ or redistribute the software under the terms of the CeCILL
15
license as circulated by CEA, CNRS and INRIA at the following URL
16
"http://www.cecill.info".
18
As a counterpart to the access to the source code and rights to copy,
19
modify and redistribute granted by the license, users are provided only
20
with a limited warranty and the software's author, the holder of the
21
economic rights, and the successive licensors have only limited
24
In this respect, the user's attention is drawn to the risks associated
25
with loading, using, modifying and/or developing or reproducing the
26
software by the user in light of its specific status of free software,
27
that may mean that it is complicated to manipulate, and that also
28
therefore means that it is reserved for developers and experienced
29
professionals having in-depth computer knowledge. Users are therefore
30
encouraged to load and test the software's suitability as regards their
31
requirements in conditions enabling the security of their systems and/or
32
data to be ensured and, more generally, to use and operate it in the
33
same conditions as regards security.
35
The fact that you are presently reading this means that you have had
36
knowledge of the CeCILL license and that you accept its terms.
40
41
#include "FrequenciesSet.h"
42
#include <Bpp/Numeric/NumConstants.h>
42
44
using namespace bpp;
46
48
/******************************************************************************/
48
50
YN98::YN98(const GeneticCode* gc, FrequenciesSet* codonFreqs) :
49
AbstractReversibleSubstitutionModel(gc->getSourceAlphabet(), "YN98."),
50
pmodel_(gc, codonFreqs), mapParNamesFromPmodel_(), lParPmodel_()
51
AbstractBiblioSubstitutionModel("YN98."),
52
pmodel_(new CodonDistanceFrequenciesSubstitutionModel(gc, new K80(dynamic_cast<const CodonAlphabet*>(gc->getSourceAlphabet())->getNucleicAlphabet()), codonFreqs))
52
54
addParameter_(Parameter("YN98.kappa", 1, &Parameter::R_PLUS_STAR));
53
addParameter_(Parameter("YN98.omega", 1, &Parameter::R_PLUS_STAR));//new IncludingInterval(0.0001, 999), true));
55
addParameter_(Parameter("YN98.omega", 1, new IncludingInterval(NumConstants::SMALL, 999), true));
55
pmodel_.setNamespace("YN98.");
57
pmodel_->setNamespace("YN98.");
56
58
addParameters_(codonFreqs->getParameters());
58
lParPmodel_.addParameters(pmodel_.getParameters());
60
vector<std::string> v=pmodel_.getFreq().getParameters().getParameterNames();
62
for (unsigned int i=0;i<v.size();i++)
63
mapParNamesFromPmodel_[v[i]]=getParameterNameWithoutNamespace(v[i]);
65
mapParNamesFromPmodel_["YN98.123_K80.kappa"]="kappa";
66
mapParNamesFromPmodel_["YN98.beta"]="omega";
60
lParPmodel_.addParameters(pmodel_->getParameters());
62
vector<std::string> v = pmodel_->getFreq().getParameters().getParameterNames();
64
for (size_t i = 0; i < v.size(); i++)
66
mapParNamesFromPmodel_[v[i]] = getParameterNameWithoutNamespace(v[i]);
68
mapParNamesFromPmodel_["YN98.123_K80.kappa"] = "kappa";
69
mapParNamesFromPmodel_["YN98.beta"] = "omega";
71
void YN98::updateMatrices()
73
for (unsigned int i=0;i<lParPmodel_.size();i++){
74
lParPmodel_[i].setValue(getParameter(mapParNamesFromPmodel_[lParPmodel_[i].getName()]).getValue());}
76
pmodel_.matchParametersValues(lParPmodel_);
79
void YN98::setFreq(std::map<int, double>& m)
82
matchParametersValues(pmodel_.getParameters());
85
void YN98::addRateParameter(){
86
AbstractSubstitutionModel::addRateParameter();
87
pmodel_.addRateParameter();
88
mapParNamesFromPmodel_["YN98.rate"]="rate";
90
lParPmodel_.addParameters(pmodel_.getParameters());
75
YN98::YN98(const YN98& yn98) : AbstractBiblioSubstitutionModel(yn98),
76
pmodel_(new CodonDistanceFrequenciesSubstitutionModel(*yn98.pmodel_))
79
YN98& YN98::operator=(const YN98& yn98)
81
AbstractBiblioSubstitutionModel::operator=(yn98);
82
pmodel_ = new CodonDistanceFrequenciesSubstitutionModel(*yn98.pmodel_);