48 const GeneticCode* gCode,
50 const std::string& prefix,
52 AbstractParameterAliasable(prefix),
54 hasParametrizedRates_(paramRates),
60 for (i = 0; i < 3; i++)
68 addParameters_(pmod->getParameters());
71 for (i = 0; i < 3; i++)
80 for (i = 0; i < 2; i++)
82 addParameter_(
new Parameter(prefix +
"relrate" + TextTools::toString(i + 1), 1.0 / static_cast<double>(3 - i), &Parameter::PROP_CONSTRAINT_EX));
88 const GeneticCode* gCode,
92 const std::string& prefix,
94 AbstractParameterAliasable(prefix),
96 hasParametrizedRates_(paramRates),
101 if ((pmod1 == pmod2) || (pmod2 == pmod3) || (pmod1 == pmod3))
103 for (
size_t i = 0; i < 3; ++i)
111 addParameters_(pmod1->getParameters());
118 VSubMod_[0]->enableEigenDecomposition(0);
119 addParameters_(pmod1->getParameters());
124 VSubMod_[1]->enableEigenDecomposition(0);
125 addParameters_(pmod2->getParameters());
130 VSubMod_[2]->enableEigenDecomposition(0);
131 addParameters_(pmod3->getParameters());
135 for (
size_t i = 0; i < 3; ++i)
143 for (
int i = 0; i < 2; ++i)
145 addParameter_(
new Parameter(prefix +
"relrate" + TextTools::toString(i + 1), 1.0 / (3.0 - i), &Parameter::PROP_CONSTRAINT_EX));
157 for (k = nbmod - 1; k > 0; k--)
160 for (i = 0; i < k; i++)
162 x *= 1 - getParameterValue(
"relrate" + TextTools::toString(i + 1));
165 x *= getParameterValue(
"relrate" + TextTools::toString(k + 1));
178 for (i = 0; i < salph; i++)
180 for (j = 0; j < salph; j++)
182 if (
gCode_->isStop(static_cast<int>(i)) ||
gCode_->isStop(static_cast<int>(j)))
bool enableEigenDecomposition()
Tell if eigenValues and Vectors must be computed.
AbstractCodonSubstitutionModel(const GeneticCode *gCode, NucleotideSubstitutionModel *pmod, const std::string &st, bool paramRates=false)
Build a new AbstractCodonSubstitutionModel object from a pointer to a NucleotideSubstitutionModel.
This class implements a state map where all resolved states are modeled.
std::vector< double > Vrate_
virtual size_t getNumberOfStates() const
Get the number of states.
virtual void enableEigenDecomposition(bool yn)=0
Set if eigenValues and Vectors must be computed.
bool hasParametrizedRates_
boolean for the parametrization of the position relative rates. Default : false.
void updateMatrices()
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
Abstract Basal class for words of substitution models.
RowMatrix< double > generator_
The generator matrix of the model.
Specialisation interface for nucleotide substitution model.
void completeMatrices()
Method inherited from AbstractWordSubstitutionModel.
void updateMatrices()
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
const GeneticCode * gCode_
std::vector< std::string > VnestedPrefix_
virtual double getCodonsMulRate(size_t i, size_t j) const
Method inherited from CodonSubstitutionModel.
std::vector< SubstitutionModel * > VSubMod_