|
bpp-phyl
2.1.0
|
00001 // 00002 // File: LLG08_EX3.cpp 00003 // Created by: Laurent Gueguen 00004 // Created on: jeudi 21 octobre 2010, à 13h 50 00005 // 00006 00007 /* 00008 Copyright or © or Copr. Bio++ Development Team, (November 16, 2004) 00009 This software is a computer program whose purpose is to provide classes 00010 for phylogenetic data analysis. 00011 00012 This software is governed by the CeCILL license under French law and 00013 abiding by the rules of distribution of free software. You can use, 00014 modify and/ or redistribute the software under the terms of the CeCILL 00015 license as circulated by CEA, CNRS and INRIA at the following URL 00016 "http://www.cecill.info". 00017 00018 As a counterpart to the access to the source code and rights to copy, 00019 modify and redistribute granted by the license, users are provided only 00020 with a limited warranty and the software's author, the holder of the 00021 economic rights, and the successive licensors have only limited 00022 liability. 00023 00024 In this respect, the user's attention is drawn to the risks associated 00025 with loading, using, modifying and/or developing or reproducing the 00026 software by the user in light of its specific status of free software, 00027 that may mean that it is complicated to manipulate, and that also 00028 therefore means that it is reserved for developers and experienced 00029 professionals having in-depth computer knowledge. Users are therefore 00030 encouraged to load and test the software's suitability as regards their 00031 requirements in conditions enabling the security of their systems and/or 00032 data to be ensured and, more generally, to use and operate it in the 00033 same conditions as regards security. 00034 00035 The fact that you are presently reading this means that you have had 00036 knowledge of the CeCILL license and that you accept its terms. 00037 */ 00038 00039 #include "LLG08_EX3.h" 00040 #include "../FrequenciesSet/ProteinFrequenciesSet.h" 00041 00042 #include <Bpp/Numeric/Prob/SimpleDiscreteDistribution.h> 00043 00044 using namespace bpp; 00045 00046 using namespace std; 00047 00048 /******************************************************************************/ 00049 00050 LLG08_EX3::LLG08_EX3(const ProteicAlphabet* alpha) : 00051 AbstractBiblioMixedSubstitutionModel("LLG08_EX3."), 00052 pmixmodel_(0) 00053 { 00054 // build the submodel 00055 00056 vector<SubstitutionModel*> vpSM; 00057 vpSM.push_back(new LLG08_EX3::EmbeddedModel(alpha, "Buried")); 00058 vpSM.push_back(new LLG08_EX3::EmbeddedModel(alpha, "Intermediate")); 00059 vpSM.push_back(new LLG08_EX3::EmbeddedModel(alpha, "HExposed")); 00060 00061 Vdouble vrate, vproba; 00062 00063 for (unsigned int i = 0; i < vpSM.size(); i++) 00064 { 00065 vproba.push_back((dynamic_cast<LLG08_EX3::EmbeddedModel*>(vpSM[i]))->getProportion()); 00066 vrate.push_back(vpSM[i]->getRate()); 00067 } 00068 00069 pmixmodel_.reset(new MixtureOfSubstitutionModels(alpha, vpSM, vproba, vrate)); 00070 00071 string name, st; 00072 ParameterList pl = pmixmodel_->getParameters(); 00073 for (size_t i = 0; i < pl.size(); i++) 00074 { 00075 name = pl[i].getName(); 00076 lParPmodel_.addParameter(Parameter(pl[i])); 00077 st = pmixmodel_->getParameterNameWithoutNamespace(name); 00078 mapParNamesFromPmodel_[name] = st; 00079 addParameter_(new Parameter("LLG08_EX3." + st, 00080 pmixmodel_->getParameterValue(st), 00081 pmixmodel_->getParameter(st).hasConstraint() ? pmixmodel_->getParameter(st).getConstraint()->clone() : 0, true)); 00082 } 00083 00084 updateMatrices(); 00085 } 00086 00087 LLG08_EX3::LLG08_EX3(const LLG08_EX3& mod2) : AbstractBiblioMixedSubstitutionModel(mod2), 00088 pmixmodel_(new MixtureOfSubstitutionModels(*mod2.pmixmodel_)) 00089 {} 00090 00091 LLG08_EX3& LLG08_EX3::operator=(const LLG08_EX3& mod2) 00092 { 00093 AbstractBiblioMixedSubstitutionModel::operator=(mod2); 00094 00095 pmixmodel_.reset(new MixtureOfSubstitutionModels(*mod2.pmixmodel_)); 00096 00097 return *this; 00098 } 00099 00100 LLG08_EX3::~LLG08_EX3() {} 00101 00102 /**************** sub model classes */ // //////// 00103 00104 LLG08_EX3::EmbeddedModel::EmbeddedModel(const ProteicAlphabet* alpha, string name) : 00105 AbstractParameterAliasable(name), 00106 AbstractSubstitutionModel(alpha, name), 00107 AbstractReversibleSubstitutionModel(alpha, name), 00108 proportion_(1), 00109 name_(name) 00110 { 00111 #include "__LLG08_EX3ExchangeabilityCode" 00112 #include "__LLG08_EX3FrequenciesCode" 00113 #include "__LLG08_EX3RatesProps" 00114 updateMatrices(); 00115 } 00116 00117