bpp-phyl3  3.0.0
InMixedSubstitutionModel.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 using namespace bpp;
8 using namespace std;
9 
10 /******************************************************************************/
11 
13  unique_ptr<MixedTransitionModelInterface> mixedModel,
14  const std::string& subModelName,
15  const std::string& mixtDesc) :
16  AbstractParameterAliasable(mixedModel->getNamespace()),
17  AbstractWrappedModel(mixedModel->getNamespace()),
18  AbstractWrappedTransitionModel(mixedModel->getNamespace()),
19  AbstractWrappedSubstitutionModel(mixedModel->getNamespace()),
20  mixedModelPtr_(std::move(mixedModel)),
21  subModelNumber_(0),
22  mixtName_(mixtDesc)
23 {
24  Vuint vn = mixedModelPtr_->getSubmodelNumbers(subModelName);
25  subModelNumber_ = (size_t)vn[0];
26  addParameters_(mixedModelPtr_->getParameters());
27 }
28 
29 
31  unique_ptr<MixedTransitionModelInterface> mixedModel,
32  size_t subModelNumber,
33  const std::string& mixtDesc) :
34  AbstractParameterAliasable(mixedModel->getNamespace()),
35  AbstractWrappedModel(mixedModel->getNamespace()),
36  AbstractWrappedTransitionModel(mixedModel->getNamespace()),
37  AbstractWrappedSubstitutionModel(mixedModel->getNamespace()),
38  mixedModelPtr_(std::move(mixedModel)),
39  subModelNumber_(subModelNumber),
40  mixtName_(mixtDesc)
41 {
42  if (subModelNumber >= mixedModelPtr_->getNumberOfModels())
43  throw ParameterNotFoundException("InMixedSubstitutionModel::InMixedSubstitutionModel : bad model number", TextTools::toString(subModelNumber));
44 
45  addParameters_(mixedModelPtr_->getParameters());
46 }
47 
48 
49 /******************************************************************************/
50 
56  mixedModelPtr_(fmsm.mixedModelPtr_->clone()),
57  subModelNumber_(fmsm.subModelNumber_),
58  mixtName_(fmsm.mixtName_)
59 {}
60 
61 
62 /******************************************************************************/
63 
65 {
67 
68  mixedModelPtr_.reset(fmsm.mixedModelPtr_->clone());
70  mixtName_ = fmsm.mixtName_;
71 
72  return *this;
73 }
void addParameters_(const ParameterList &parameters)
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
Abstract class of Wrapping model class, where all methods are redirected from model().
SubModel taken from a MixedTransitionModel, kept in the context of the MixedTransitionModel (see From...
size_t subModelNumber_
the number of the submodel
std::string mixtName_
The name of the mixture model (for io purpose).
InMixedSubstitutionModel & operator=(const InMixedSubstitutionModel &fmsm)
std::unique_ptr< MixedTransitionModelInterface > mixedModelPtr_
The MixedOfTransitionModels.
std::string toString(T t)
Defines the basic types of data flow nodes.
std::vector< unsigned int > Vuint