bpp-phyl3 3.0.0
LG10_EX_EHO.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: The Bio++ Development Group
2//
3// SPDX-License-Identifier: CECILL-2.1
4
6
7#include "../FrequencySet/ProteinFrequencySet.h"
8#include "../MixtureOfSubstitutionModels.h"
9#include "LG10_EX_EHO.h"
10
11using namespace bpp;
12using namespace std;
13
14/******************************************************************************/
15
16LG10_EX_EHO::LG10_EX_EHO(shared_ptr<const ProteicAlphabet> alpha) :
17 AbstractParameterAliasable("LG10_EX_EHO."),
18 AbstractWrappedModel("LG10_EX_EHO."),
19 AbstractWrappedTransitionModel("LG10_EX_EHO."),
21 AbstractBiblioTransitionModel("LG10_EX_EHO."),
23{
24 // build the submodel
25
26 vector<unique_ptr<TransitionModelInterface>> vpSM;
27 vpSM.push_back(make_unique<LG10_EX_EHO::EmbeddedModel>(alpha, "BUR_EXT"));
28 vpSM.push_back(make_unique<LG10_EX_EHO::EmbeddedModel>(alpha, "BUR_HEL"));
29 vpSM.push_back(make_unique<LG10_EX_EHO::EmbeddedModel>(alpha, "BUR_OTH"));
30 vpSM.push_back(make_unique<LG10_EX_EHO::EmbeddedModel>(alpha, "EXP_EXT"));
31 vpSM.push_back(make_unique<LG10_EX_EHO::EmbeddedModel>(alpha, "EXP_HEL"));
32 vpSM.push_back(make_unique<LG10_EX_EHO::EmbeddedModel>(alpha, "EXP_OTH"));
33
34 Vdouble vrate, vproba;
35
36 for (auto& vi : vpSM)
37 {
38 vproba.push_back((dynamic_cast<LG10_EX_EHO::EmbeddedModel&>(*vi)).getProportion());
39 vrate.push_back(vi->getRate());
40 }
41
42 mixedModelPtr_.reset(new MixtureOfSubstitutionModels(alpha, vpSM, vproba, vrate));
43
44 string name, st;
45 ParameterList pl = mixedModelPtr_->getParameters();
46 for (unsigned int i = 0; i < pl.size(); ++i)
47 {
48 name = pl[i].getName();
50 st = mixedModelPtr_->getParameterNameWithoutNamespace(name);
51 mapParNamesFromPmodel_[name] = st;
52 addParameter_(new Parameter("LG10_EX_EHO." + st,
53 mixedModelPtr_->getParameterValue(st),
54 mixedModelPtr_->parameter(st).hasConstraint() ? std::shared_ptr<ConstraintInterface>(mixedModelPtr_->parameter(st).getConstraint()->clone()) : 0));
55 }
56
58}
59
60/**************** sub model classes ********************/
61
63 shared_ptr<const ProteicAlphabet> alpha,
64 string name) :
66 AbstractReversibleProteinSubstitutionModel(alpha, make_shared<CanonicalStateMap>(alpha, false), name),
67 proportion_(1),
68 name_(name)
69{
70#include "__LG10_EX_EHOExchangeabilityCode"
71#include "__LG10_EX_EHOFrequenciesCode"
72#include "__LG10_EX_EHORatesProps"
74}
Abstract class for mixture models based on the bibliography.
std::unique_ptr< MixedTransitionModelInterface > mixedModelPtr_
Partial implementation of the SubstitutionModel interface for models that are set for matching the bi...
std::map< std::string, std::string > mapParNamesFromPmodel_
Tools to make the link between the Parameters of the object and those of pmixmodel_.
void addParameter_(Parameter *parameter)
Specialisation abstract class for reversible protein substitution model.
virtual void updateMatrices_() override
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
Abstract class of Wrapping model class, where all methods are redirected from model().
This class implements a state map where all resolved states are modeled.
Definition: StateMap.h:168
EmbeddedModel(std::shared_ptr< const ProteicAlphabet > alpha, string name)
Definition: LG10_EX_EHO.cpp:62
size_t size() const
virtual void addParameter(const Parameter &param)
Defines the basic types of data flow nodes.
std::vector< double > Vdouble