bpp-phyl3  3.0.0
AbstractCodonCpGSubstitutionModel.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 
8 
9 using namespace bpp;
10 
11 using namespace std;
12 
13 /******************************************************************************/
14 
16  std::shared_ptr<const CodonAlphabet> alphabet,
17  const std::string& prefix) :
19  rho_(1),
20  stateMap_(new CanonicalStateMap(alphabet, false))
21 {
22  addParameter_(new Parameter(prefix + "rho", 1, std::make_shared<IntervalConstraint>(NumConstants::SMALL(), 999, true, true)));
23 }
24 
26 {
27  rho_ = getParameterValue("rho");
28 }
29 
31 {
32  int si(stateMap_->getAlphabetStateAsInt(i)), sj(stateMap_->getAlphabetStateAsInt(j));
33 
34  return ((si % 16 == 7 && (si - sj == 2 || sj - si == 8)) || ((si - 1) / 4 == 6 && (si - sj == 8 || (sj - si == 32)))) ? rho_ : 1;
35 }
std::shared_ptr< const StateMapInterface > stateMap_
double getCodonsMulRate(size_t i, size_t j) const override
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
void fireParameterChanged(const ParameterList &parameters) override
AbstractCodonCpGSubstitutionModel(std::shared_ptr< const CodonAlphabet > alphabet, const std::string &prefix)
Build a new AbstractCodonCpGSubstitutionModel object from a pointer to NucleotideSubstitutionModel.
void addParameter_(Parameter *parameter)
double getParameterValue(const std::string &name) const override
This class implements a state map where all resolved states are modeled.
Definition: StateMap.h:168
static double SMALL()
Defines the basic types of data flow nodes.