bpp-phyl3  3.0.0
bpp::AbstractCodonAAFitnessSubstitutionModel Class Referenceabstract

Abstract class for modelling of ratios of substitution rates between codons, whatever they are synonymous or not. More...

#include <Bpp/Phyl/Model/Codon/AbstractCodonAAFitnessSubstitutionModel.h>

+ Inheritance diagram for bpp::AbstractCodonAAFitnessSubstitutionModel:
+ Collaboration diagram for bpp::AbstractCodonAAFitnessSubstitutionModel:

Public Member Functions

 AbstractCodonAAFitnessSubstitutionModel (std::shared_ptr< FrequencySetInterface > pfitset, std::shared_ptr< const GeneticCode > pgencode, const std::string &prefix)
 
 AbstractCodonAAFitnessSubstitutionModel (const AbstractCodonAAFitnessSubstitutionModel &model)
 
AbstractCodonAAFitnessSubstitutionModeloperator= (const AbstractCodonAAFitnessSubstitutionModel &model)
 
AbstractCodonAAFitnessSubstitutionModelclone () const override
 
virtual ~AbstractCodonAAFitnessSubstitutionModel ()
 
void fireParameterChanged (const ParameterList &parameters) override
 
void setFreq (std::map< int, double > &frequencies) override
 
const CodonFrequencySetInterfacecodonFrequencySet () const override
 
bool hasCodonFrequencySet () const override
 
void setNamespace (const std::string &prefix) override
 
double getCodonsMulRate (size_t i, size_t j) const override
 Returns the multiplicative rate specific to two codons specified by their number. The respective generator rate is this rate multiplied by the rate defined by the model defined on nucleotides. More...
 
const FrequencySetInterfaceaaFitness () const
 
std::shared_ptr< const FrequencySetInterfacegetAAFitness () const
 
void addNsParameter ()
 
virtual size_t getNumberOfIndependentParameters () const=0
 
virtual void aliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)=0
 
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0
 
virtual const ParameterListgetIndependentParameters () const=0
 
virtual std::vector< std::string > getAlias (const std::string &name) const=0
 
virtual std::map< std::string, std::string > getAliases () const=0
 
virtual bool hasParameter (const std::string &name) const=0
 
virtual const ParameterListgetParameters () const=0
 
virtual const Parameterparameter (const std::string &name) const=0
 
virtual double getParameterValue (const std::string &name) const=0
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 
virtual void setParameterValue (const std::string &name, double value)=0
 
virtual void setParametersValues (const ParameterList &parameters)=0
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 
virtual void removeConstraint (const std::string &name)=0
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 
virtual size_t getNumberOfParameters () const=0
 
virtual std::string getNamespace () const=0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const=0
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () const
 
size_t getNumberOfIndependentParameters () const
 
void aliasParameters (const std::string &p1, const std::string &p2)
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
std::string getFrom (const std::string &name) const
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 
void setAllParametersValues (const ParameterList &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) override
 
void removeConstraint (const std::string &name) override
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 
size_t getNumberOfParameters () const override
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 

Protected Member Functions

virtual ParameterListgetParameters_ ()=0
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 

Private Attributes

std::shared_ptr< FrequencySetInterfacepfitset_
 
std::shared_ptr< const GeneticCodepgencode_
 
std::string fitName_
 
std::shared_ptr< const StateMapInterfacestateMap_
 
std::shared_ptr< const StateMapInterfaceprotStateMap_
 
double Ns_
 The Ns of the model (default: 1), The generator (and all its vectorial components) is independent of the rate, since it should be normalized. More...
 
ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 

Detailed Description

Abstract class for modelling of ratios of substitution rates between codons, whatever they are synonymous or not.

Author
Laurent Guéguen

The fitness of an amino acid is a value between 0 and 1 defining the relative advantage of an amino acid, compared to others. If an amino acid $i$ has a fitness $\phi_i$ and another one ( $j$) has a fitness $\phi_j$, the substitution rate from codon $i$ to codon $j$ is multiplied by

\[-\frac{\log\left((\frac{\phi_i}{\phi_j})^{s}\right)}{1-\left(\frac{\phi_i}{\phi_j}\right)^{s}}\]

where $s$ is a positive Ns coefficient (default value: 1).

The set of fitnesses is implemented through a Protein FrequencySet object. The parameters are named "fit_NameOfTheParameterInTheFrequencySet".

Definition at line 38 of file AbstractCodonAAFitnessSubstitutionModel.h.

Constructor & Destructor Documentation

◆ AbstractCodonAAFitnessSubstitutionModel() [1/2]

AbstractCodonAAFitnessSubstitutionModel::AbstractCodonAAFitnessSubstitutionModel ( std::shared_ptr< FrequencySetInterface pfitset,
std::shared_ptr< const GeneticCode pgencode,
const std::string &  prefix 
)

◆ AbstractCodonAAFitnessSubstitutionModel() [2/2]

bpp::AbstractCodonAAFitnessSubstitutionModel::AbstractCodonAAFitnessSubstitutionModel ( const AbstractCodonAAFitnessSubstitutionModel model)
inline

Definition at line 66 of file AbstractCodonAAFitnessSubstitutionModel.h.

◆ ~AbstractCodonAAFitnessSubstitutionModel()

AbstractCodonAAFitnessSubstitutionModel::~AbstractCodonAAFitnessSubstitutionModel ( )
virtual

Definition at line 30 of file AbstractCodonAAFitnessSubstitutionModel.cpp.

Member Function Documentation

◆ aaFitness()

const FrequencySetInterface& bpp::AbstractCodonAAFitnessSubstitutionModel::aaFitness ( ) const
inline

Definition at line 119 of file AbstractCodonAAFitnessSubstitutionModel.h.

References pfitset_.

◆ addNsParameter()

void bpp::AbstractCodonAAFitnessSubstitutionModel::addNsParameter ( )
inline

◆ clone()

AbstractCodonAAFitnessSubstitutionModel* bpp::AbstractCodonAAFitnessSubstitutionModel::clone ( ) const
inlineoverridevirtual

◆ codonFrequencySet()

const CodonFrequencySetInterface& bpp::AbstractCodonAAFitnessSubstitutionModel::codonFrequencySet ( ) const
inlineoverridevirtual

◆ fireParameterChanged()

void AbstractCodonAAFitnessSubstitutionModel::fireParameterChanged ( const ParameterList parameters)
overridevirtual

◆ getAAFitness()

std::shared_ptr<const FrequencySetInterface> bpp::AbstractCodonAAFitnessSubstitutionModel::getAAFitness ( ) const
inline

Definition at line 121 of file AbstractCodonAAFitnessSubstitutionModel.h.

References pfitset_.

◆ getCodonsMulRate()

double AbstractCodonAAFitnessSubstitutionModel::getCodonsMulRate ( size_t  ,
size_t   
) const
overridevirtual

Returns the multiplicative rate specific to two codons specified by their number. The respective generator rate is this rate multiplied by the rate defined by the model defined on nucleotides.

Implements bpp::CoreCodonSubstitutionModelInterface.

Definition at line 48 of file AbstractCodonAAFitnessSubstitutionModel.cpp.

References bpp::log(), Ns_, pfitset_, pgencode_, bpp::pow(), protStateMap_, and stateMap_.

◆ hasCodonFrequencySet()

bool bpp::AbstractCodonAAFitnessSubstitutionModel::hasCodonFrequencySet ( ) const
inlineoverridevirtual

◆ operator=()

AbstractCodonAAFitnessSubstitutionModel& bpp::AbstractCodonAAFitnessSubstitutionModel::operator= ( const AbstractCodonAAFitnessSubstitutionModel model)
inline

◆ setFreq()

void AbstractCodonAAFitnessSubstitutionModel::setFreq ( std::map< int, double > &  frequencies)
overridevirtual

◆ setNamespace()

void bpp::AbstractCodonAAFitnessSubstitutionModel::setNamespace ( const std::string &  prefix)
inlineoverridevirtual

Member Data Documentation

◆ fitName_

std::string bpp::AbstractCodonAAFitnessSubstitutionModel::fitName_
private

◆ Ns_

double bpp::AbstractCodonAAFitnessSubstitutionModel::Ns_
private

The Ns of the model (default: 1), The generator (and all its vectorial components) is independent of the rate, since it should be normalized.

Definition at line 58 of file AbstractCodonAAFitnessSubstitutionModel.h.

Referenced by fireParameterChanged(), getCodonsMulRate(), and operator=().

◆ pfitset_

std::shared_ptr<FrequencySetInterface> bpp::AbstractCodonAAFitnessSubstitutionModel::pfitset_
private

◆ pgencode_

std::shared_ptr<const GeneticCode> bpp::AbstractCodonAAFitnessSubstitutionModel::pgencode_
private

Definition at line 45 of file AbstractCodonAAFitnessSubstitutionModel.h.

Referenced by getCodonsMulRate(), and operator=().

◆ protStateMap_

std::shared_ptr<const StateMapInterface> bpp::AbstractCodonAAFitnessSubstitutionModel::protStateMap_
private

Definition at line 51 of file AbstractCodonAAFitnessSubstitutionModel.h.

Referenced by getCodonsMulRate(), and operator=().

◆ stateMap_

std::shared_ptr<const StateMapInterface> bpp::AbstractCodonAAFitnessSubstitutionModel::stateMap_
private

Definition at line 49 of file AbstractCodonAAFitnessSubstitutionModel.h.

Referenced by getCodonsMulRate(), and operator=().


The documentation for this class was generated from the following files: