3
// Created by: Laurent Gueguen
4
// Created on: jeudi 21 octobre 2010, à 13h 50
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.
39
#include "LLG08_EX3.h"
41
#include "FrequenciesSet.h"
43
#include <Bpp/Numeric/NumConstants.h>
44
#include <Bpp/Numeric/Prob/SimpleDiscreteDistribution.h>
50
/******************************************************************************/
52
LLG08_EX3::LLG08_EX3(const ProteicAlphabet* alpha) :
53
AbstractMixedSubstitutionModel(alpha, "LLG08_EX3."), pmixmodel_(0),
54
mapParNamesFromPmodel_(), lParPmodel_()
58
vector<SubstitutionModel*> vpSM;
59
vpSM.push_back(new LLG08_EX3::EmbeddedModel(alpha,"EX3_Buried"));
60
vpSM.push_back(new LLG08_EX3::EmbeddedModel(alpha,"EX3_Intermediate"));
61
vpSM.push_back(new LLG08_EX3::EmbeddedModel(alpha,"EX3_HExposed"));
63
Vdouble vrate, vproba;
65
for (unsigned int i=0;i<vpSM.size();i++){
66
vproba.push_back((dynamic_cast<LLG08_EX3::EmbeddedModel*> (vpSM[i]))->getProportion());
67
vrate.push_back(vpSM[i]->getRate());
70
pmixmodel_= new MixtureOfSubstitutionModels(alpha, vpSM, vproba, vrate);
73
ParameterList pl=pmixmodel_->getParameters();
74
for (unsigned int i=0;i<pl.size();i++){
76
lParPmodel_.addParameter(Parameter(pl[i]));
77
st=pmixmodel_->getParameterNameWithoutNamespace(name);
78
mapParNamesFromPmodel_[name]=st;
79
addParameter_(Parameter("LLG08_EX3."+st,
80
pmixmodel_->getParameterValue(st),
81
pmixmodel_->getParameter(st).hasConstraint()? pmixmodel_->getParameter(st).getConstraint()->clone():0,true));
87
LLG08_EX3::LLG08_EX3(const LLG08_EX3& mod2) : AbstractMixedSubstitutionModel(mod2),
88
pmixmodel_(new MixtureOfSubstitutionModels(*mod2.pmixmodel_)),
89
mapParNamesFromPmodel_(mod2.mapParNamesFromPmodel_),
90
lParPmodel_(mod2.lParPmodel_)
95
LLG08_EX3& LLG08_EX3::operator=(const LLG08_EX3& mod2)
97
AbstractMixedSubstitutionModel::operator=(mod2);
99
pmixmodel_=new MixtureOfSubstitutionModels(*mod2.pmixmodel_);
100
mapParNamesFromPmodel_=mod2.mapParNamesFromPmodel_;
101
lParPmodel_=mod2.lParPmodel_;
106
LLG08_EX3::~LLG08_EX3()
112
void LLG08_EX3::updateMatrices()
114
for (unsigned int i=0;i<lParPmodel_.size();i++)
115
if (hasParameter(mapParNamesFromPmodel_[lParPmodel_[i].getName()]))
116
lParPmodel_[i].setValue(getParameter(mapParNamesFromPmodel_[lParPmodel_[i].getName()]).getValue());
118
pmixmodel_->matchParametersValues(lParPmodel_);
121
void LLG08_EX3::setFreq(std::map<int,double>& m){
122
pmixmodel_->setFreq(m);
123
matchParametersValues(pmixmodel_->getParameters());
126
void LLG08_EX3::setVRates(Vdouble & vd){
127
pmixmodel_->setVRates(vd);
128
matchParametersValues(pmixmodel_->getParameters());
131
/**************** sub model classes *///////////
133
LLG08_EX3::EmbeddedModel::EmbeddedModel(const ProteicAlphabet* alpha, string name) :
134
AbstractReversibleSubstitutionModel(alpha, ""), proportion_(1), name_(name)
136
#include "__LLG08_EX3ExchangeabilityCode"
137
#include "__LLG08_EX3FrequenciesCode"
138
#include "__LLG08_EX3RatesProps"