bpp-phyl3  3.0.0
bpp::FullPerAACodonFrequencySet Class Referenceabstract

FrequencySet integrating ProteinFrequencySet inside CodonFrequencySet. In this case, FrequencieSet defined inside each amino acid is parametrized as a FullFrequencySet. Hence there are 61-20=41 parameters in addition of the parameters of the ProteinFrequencySet. More...

#include <Bpp/Phyl/Model/FrequencySet/CodonFrequencySet.h>

+ Inheritance diagram for bpp::FullPerAACodonFrequencySet:
+ Collaboration diagram for bpp::FullPerAACodonFrequencySet:

Public Member Functions

 FullPerAACodonFrequencySet (std::shared_ptr< const GeneticCode > gencode, std::unique_ptr< ProteinFrequencySetInterface > ppfs, unsigned short method=1)
 Create a new FullPerAACodonFrequencySet object. More...
 
 FullPerAACodonFrequencySet (std::shared_ptr< const GeneticCode > gencode, unsigned short method=1)
 Construction with fixed uniform frequencies on the amino acids. The stop codon frequencies are null. More...
 
 FullPerAACodonFrequencySet (const FullPerAACodonFrequencySet &ffs)
 
FullPerAACodonFrequencySetoperator= (const FullPerAACodonFrequencySet &ffs)
 
virtual ~FullPerAACodonFrequencySet ()
 
FullPerAACodonFrequencySetclone () const override
 
std::shared_ptr< const CodonAlphabetgetCodonAlphabet () const override
 
std::shared_ptr< const GeneticCodegetGeneticCode () const override
 
void setFrequencies (const std::vector< double > &frequencies) override
 the given frequencies are normalized such thaat the sum of the frequencies on the non-stop codons equals 1. More...
 
void setNamespace (const std::string &prefix) override
 
bool hasProteinFrequencySet () const
 
const ProteinFrequencySetInterfaceproteinFrequencySet () const
 
unsigned short getMethod () const
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const =0
 
virtual const Alphabetalphabet () const =0
 
virtual const StateMapInterfacestateMap () const =0
 
virtual std::shared_ptr< const StateMapInterfacegetStateMap () const =0
 
virtual const VdoublegetFrequencies () const =0
 
virtual const std::map< int, double > getAlphabetStatesFrequencies () const =0
 
virtual void setFrequenciesFromAlphabetStatesFrequencies (const std::map< int, double > &frequencies)=0
 Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1. More...
 
virtual std::string getName () const =0
 
virtual size_t getNumberOfFrequencies () const =0
 
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
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 
const Alphabetalphabet () const override
 
const StateMapInterfacestateMap () const override
 
std::shared_ptr< const StateMapInterfacegetStateMap () const override
 
const VdoublegetFrequencies () const override
 
const std::map< int, double > getAlphabetStatesFrequencies () const override
 
void setFrequenciesFromAlphabetStatesFrequencies (const std::map< int, double > &frequencies) override
 Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1. More...
 
size_t getNumberOfFrequencies () const override
 
std::string getName () const override
 
void normalize ()
 
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)
 
const ParameterListgetIndependentParameters () const
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
bool hasParameter (const std::string &name) const override
 
const ParameterListgetParameters () const override
 
const Parameterparameter (const std::string &name) const override
 
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
 
bool hasIndependentParameter (const std::string &name) const
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 
ParameterList getFromParameters (const ParameterList &pl) const
 
std::string getFrom (const std::string &name) const
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 

Static Public Member Functions

static std::unique_ptr< CodonFrequencySetInterfacegetFrequencySetForCodons (short option, std::shared_ptr< const GeneticCode > gCode, const std::string &mgmtStopCodon="quadratic", unsigned short method=1)
 A helper function that provide frequencies set for codon models according to PAML option. More...
 

Static Public Attributes

static const short F0 = 0
 
static const short F1X4 = 1
 
static const short F3X4 = 2
 
static const short F61 = 3
 
static std::shared_ptr< IntervalConstraintFREQUENCE_CONSTRAINT_SMALL
 
static std::shared_ptr< IntervalConstraintFREQUENCE_CONSTRAINT_MILLI
 
static std::shared_ptr< IntervalConstraintFREQUENCE_CONSTRAINT_CENTI
 

Protected Member Functions

void fireParameterChanged (const ParameterList &parameters) override
 
virtual ParameterListgetParameters_ ()=0
 
std::vector< double > & getFrequencies_ ()
 
double & getFreq_ (size_t i)
 
const double & getFreq_ (size_t i) const
 
void setFrequencies_ (const std::vector< double > &frequencies)
 
ParameterListgetParameters_ () override
 
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
 

Private Member Functions

void updateFrequencies_ ()
 

Private Attributes

std::shared_ptr< const GeneticCodepgc_
 
std::unique_ptr< ProteinFrequencySetInterfaceppfs_
 
std::vector< SimplexvS_
 vector of the simplexes, one for each AA More...
 
std::shared_ptr< const Alphabetalphabet_
 
std::shared_ptr< const StateMapInterfacestateMap_
 
std::vector< double > freq_
 
std::string name_
 
ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 

Detailed Description

FrequencySet integrating ProteinFrequencySet inside CodonFrequencySet. In this case, FrequencieSet defined inside each amino acid is parametrized as a FullFrequencySet. Hence there are 61-20=41 parameters in addition of the parameters of the ProteinFrequencySet.

The parametrization depends on the method used. Default method is 1 (ie global ratio).

See also
Simplex

Definition at line 255 of file CodonFrequencySet.h.

Constructor & Destructor Documentation

◆ FullPerAACodonFrequencySet() [1/3]

FullPerAACodonFrequencySet::FullPerAACodonFrequencySet ( std::shared_ptr< const GeneticCode gencode,
std::unique_ptr< ProteinFrequencySetInterface ppfs,
unsigned short  method = 1 
)

Create a new FullPerAACodonFrequencySet object.

Parameters
gencodeThe genetic code to use.
ppfsThe protein frequencies to use. The codon frequencies set will own the instance of the protein frequencies set.
methodthe method used for parametrization.

Definition at line 149 of file CodonFrequencySet.cpp.

References bpp::AbstractParameterAliasable::addParameters_(), bpp::Simplex::getParameters(), pgc_, ppfs_, bpp::Simplex::setNamespace(), updateFrequencies_(), and vS_.

Referenced by clone().

◆ FullPerAACodonFrequencySet() [2/3]

FullPerAACodonFrequencySet::FullPerAACodonFrequencySet ( std::shared_ptr< const GeneticCode gencode,
unsigned short  method = 1 
)

Construction with fixed uniform frequencies on the amino acids. The stop codon frequencies are null.

Parameters
gencodeThe genetic code to use.
methodthe method used for parametrization.

Definition at line 181 of file CodonFrequencySet.cpp.

References bpp::AbstractParameterAliasable::addParameters_(), bpp::Simplex::getParameters(), pgc_, ppfs_, bpp::Simplex::setNamespace(), updateFrequencies_(), and vS_.

◆ FullPerAACodonFrequencySet() [3/3]

FullPerAACodonFrequencySet::FullPerAACodonFrequencySet ( const FullPerAACodonFrequencySet ffs)

Definition at line 208 of file CodonFrequencySet.cpp.

References updateFrequencies_().

◆ ~FullPerAACodonFrequencySet()

virtual bpp::FullPerAACodonFrequencySet::~FullPerAACodonFrequencySet ( )
inlinevirtual

Definition at line 299 of file CodonFrequencySet.h.

Member Function Documentation

◆ alphabet() [1/2]

virtual const Alphabet& bpp::FrequencySetInterface::alphabet ( ) const
pure virtualinherited
Returns
The alphabet associated to this set.

Implemented in bpp::AbstractFrequencySet.

◆ alphabet() [2/2]

const Alphabet& bpp::AbstractFrequencySet::alphabet ( ) const
inlineoverridevirtualinherited
Returns
The alphabet associated to this set.

Implements bpp::FrequencySetInterface.

Definition at line 142 of file FrequencySet.h.

References bpp::AbstractFrequencySet::alphabet_.

◆ clone()

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

Implements bpp::CodonFrequencySetInterface.

Definition at line 301 of file CodonFrequencySet.h.

References FullPerAACodonFrequencySet().

◆ fireParameterChanged()

void FullPerAACodonFrequencySet::fireParameterChanged ( const ParameterList parameters)
overrideprotectedvirtual

Reimplemented from bpp::AbstractParameterAliasable.

Definition at line 227 of file CodonFrequencySet.cpp.

References ppfs_, updateFrequencies_(), and vS_.

◆ getAlphabet() [1/2]

◆ getAlphabet() [2/2]

◆ getAlphabetStatesFrequencies() [1/2]

virtual const std::map<int, double> bpp::FrequencySetInterface::getAlphabetStatesFrequencies ( ) const
pure virtualinherited
Returns
The frequencies of each alphabet states according to this model.

Implemented in bpp::AbstractFrequencySet.

◆ getAlphabetStatesFrequencies() [2/2]

const std::map< int, double > AbstractFrequencySet::getAlphabetStatesFrequencies ( ) const
overridevirtualinherited
Returns
The frequencies of each alphabet states according to this model.

Implements bpp::FrequencySetInterface.

Definition at line 57 of file FrequencySet.cpp.

◆ getCodonAlphabet()

std::shared_ptr<const CodonAlphabet> bpp::FullPerAACodonFrequencySet::getCodonAlphabet ( ) const
inlineoverridevirtual

Implements bpp::CodonFrequencySetInterface.

Definition at line 304 of file CodonFrequencySet.h.

References bpp::AbstractFrequencySet::getAlphabet().

Referenced by setFrequencies().

◆ getFreq_() [1/2]

◆ getFreq_() [2/2]

const double& bpp::AbstractFrequencySet::getFreq_ ( size_t  i) const
inlineprotectedinherited

Definition at line 180 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

◆ getFrequencies() [1/2]

◆ getFrequencies() [2/2]

const Vdouble& bpp::AbstractFrequencySet::getFrequencies ( ) const
inlineoverridevirtualinherited
Returns
The frequencies values of the set.

Implements bpp::FrequencySetInterface.

Definition at line 148 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by bpp::MvaFrequencySet::updateFrequencies().

◆ getFrequencies_()

std::vector<double>& bpp::AbstractFrequencySet::getFrequencies_ ( )
inlineprotectedinherited

Definition at line 178 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by bpp::UserFrequencySet::readFromFile_().

◆ getFrequencySetForCodons()

unique_ptr< CodonFrequencySetInterface > CodonFrequencySetInterface::getFrequencySetForCodons ( short  option,
std::shared_ptr< const GeneticCode gCode,
const std::string &  mgmtStopCodon = "quadratic",
unsigned short  method = 1 
)
staticinherited

A helper function that provide frequencies set for codon models according to PAML option.

Parameters
optionA code describing the option, one of F61, F1X4 or F3X4.
gCodeThe genetic code to use. The underlying codon alphabet object will be passed to the FrequencySet instance.
mgmtStopCodonthe optional way the frequencies assigned to the stop codons are redistributed to the other codons, with F1X4 and F3X4 options. The available values are:
  • uniform : each stop frequency is distributed evenly
  • linear : each stop frequency is distributed to the neighbour codons (ie 1 substitution away), in proportion to each target codon frequency.
  • quadratic (default): each stop frequency is distributed to the neighbour codons (ie 1 substitution away), in proportion to the square of each target codon frequency.
methodThe parametrization used for F61. Default method is 1 (ie global ratio).
See also
Simplex

Definition at line 641 of file CodonFrequencySet.cpp.

References bpp::CodonFrequencySetInterface::F0, bpp::CodonFrequencySetInterface::F1X4, bpp::CodonFrequencySetInterface::F3X4, and bpp::CodonFrequencySetInterface::F61.

Referenced by bpp::BppOFrequencySetFormat::readFrequencySet().

◆ getGeneticCode()

std::shared_ptr<const GeneticCode> bpp::FullPerAACodonFrequencySet::getGeneticCode ( ) const
inlineoverridevirtual
Returns
The associated genetic code.

Implements bpp::CodonFrequencySetInterface.

Definition at line 309 of file CodonFrequencySet.h.

References pgc_.

◆ getMethod()

unsigned short bpp::FullPerAACodonFrequencySet::getMethod ( ) const
inline

Definition at line 329 of file CodonFrequencySet.h.

References vS_.

◆ getName() [1/2]

virtual std::string bpp::FrequencySetInterface::getName ( ) const
pure virtualinherited

◆ getName() [2/2]

std::string bpp::AbstractFrequencySet::getName ( ) const
inlineoverridevirtualinherited

◆ getNumberOfFrequencies() [1/2]

virtual size_t bpp::FrequencySetInterface::getNumberOfFrequencies ( ) const
pure virtualinherited
Returns
The number of frequencies in the set. This is equivalent to getStateMap().getNumberOfModelStates().

Implemented in bpp::AbstractFrequencySet.

◆ getNumberOfFrequencies() [2/2]

size_t bpp::AbstractFrequencySet::getNumberOfFrequencies ( ) const
inlineoverridevirtualinherited
Returns
The number of frequencies in the set. This is equivalent to getStateMap().getNumberOfModelStates().

Implements bpp::FrequencySetInterface.

Definition at line 163 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by bpp::FromModelFrequencySet::setFrequencies(), bpp::FixedFrequencySet::setFrequencies(), and bpp::UserFrequencySet::setFrequencies().

◆ getStateMap() [1/2]

virtual std::shared_ptr<const StateMapInterface> bpp::FrequencySetInterface::getStateMap ( ) const
pure virtualinherited
Returns
A shared_ptr toward the mapping of model states with alphabet states.

Implemented in bpp::AbstractFrequencySet.

◆ getStateMap() [2/2]

std::shared_ptr<const StateMapInterface> bpp::AbstractFrequencySet::getStateMap ( ) const
inlineoverridevirtualinherited
Returns
A shared_ptr toward the mapping of model states with alphabet states.

Implements bpp::FrequencySetInterface.

Definition at line 146 of file FrequencySet.h.

References bpp::AbstractFrequencySet::stateMap_.

◆ hasProteinFrequencySet()

bool bpp::FullPerAACodonFrequencySet::hasProteinFrequencySet ( ) const
inline

Definition at line 319 of file CodonFrequencySet.h.

References ppfs_.

◆ normalize()

void bpp::AbstractFrequencySet::normalize ( )
inlineinherited

Definition at line 167 of file FrequencySet.h.

References bpp::AbstractFrequencySet::freq_.

Referenced by updateFrequencies_().

◆ operator=()

FullPerAACodonFrequencySet & FullPerAACodonFrequencySet::operator= ( const FullPerAACodonFrequencySet ffs)

Definition at line 217 of file CodonFrequencySet.cpp.

References bpp::AbstractFrequencySet::operator=(), pgc_, ppfs_, and vS_.

◆ proteinFrequencySet()

const ProteinFrequencySetInterface& bpp::FullPerAACodonFrequencySet::proteinFrequencySet ( ) const
inline

Definition at line 324 of file CodonFrequencySet.h.

References ppfs_.

◆ setFrequencies()

void FullPerAACodonFrequencySet::setFrequencies ( const std::vector< double > &  frequencies)
overridevirtual

the given frequencies are normalized such thaat the sum of the frequencies on the non-stop codons equals 1.

Implements bpp::FrequencySetInterface.

Definition at line 255 of file CodonFrequencySet.cpp.

References getCodonAlphabet(), bpp::AbstractParameterAliasable::getParameters(), bpp::AbstractParameterAliasable::matchParametersValues(), pgc_, ppfs_, updateFrequencies_(), and vS_.

◆ setFrequencies_()

◆ setFrequenciesFromAlphabetStatesFrequencies() [1/2]

void AbstractFrequencySet::setFrequenciesFromAlphabetStatesFrequencies ( const std::map< int, double > &  frequencies)
overridevirtualinherited

Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1.

In this implementation, all model states with the same alphabet state are given the same frequency.

Parameters
frequenciesThe set of frequencies to match.

Implements bpp::FrequencySetInterface.

Definition at line 28 of file FrequencySet.cpp.

◆ setFrequenciesFromAlphabetStatesFrequencies() [2/2]

virtual void bpp::FrequencySetInterface::setFrequenciesFromAlphabetStatesFrequencies ( const std::map< int, double > &  frequencies)
pure virtualinherited

Set the Frequencies from the one of the map which keys match with a letter of the Alphabet. The frequencies are normalized so that the matching values sum 1.

Parameters
frequenciesThe set of frequencies to match.

Implemented in bpp::AbstractFrequencySet.

Referenced by bpp::BppOFrequencySetFormat::initialize_().

◆ setNamespace()

void FullPerAACodonFrequencySet::setNamespace ( const std::string &  prefix)
overridevirtual

◆ stateMap() [1/2]

virtual const StateMapInterface& bpp::FrequencySetInterface::stateMap ( ) const
pure virtualinherited
Returns
The mapping of model states with alphabet states.

Implemented in bpp::AbstractFrequencySet.

◆ stateMap() [2/2]

const StateMapInterface& bpp::AbstractFrequencySet::stateMap ( ) const
inlineoverridevirtualinherited

◆ updateFrequencies_()

void FullPerAACodonFrequencySet::updateFrequencies_ ( )
private

Member Data Documentation

◆ alphabet_

std::shared_ptr<const Alphabet> bpp::AbstractFrequencySet::alphabet_
privateinherited

◆ F0

const short CodonFrequencySetInterface::F0 = 0
staticinherited

◆ F1X4

const short CodonFrequencySetInterface::F1X4 = 1
staticinherited

◆ F3X4

const short CodonFrequencySetInterface::F3X4 = 2
staticinherited

◆ F61

const short CodonFrequencySetInterface::F61 = 3
staticinherited

◆ freq_

◆ FREQUENCE_CONSTRAINT_CENTI

std::shared_ptr< IntervalConstraint > FrequencySetInterface::FREQUENCE_CONSTRAINT_CENTI
staticinherited

◆ FREQUENCE_CONSTRAINT_MILLI

std::shared_ptr< IntervalConstraint > FrequencySetInterface::FREQUENCE_CONSTRAINT_MILLI
staticinherited

Definition at line 91 of file FrequencySet.h.

◆ FREQUENCE_CONSTRAINT_SMALL

std::shared_ptr< IntervalConstraint > FrequencySetInterface::FREQUENCE_CONSTRAINT_SMALL
staticinherited

◆ name_

std::string bpp::AbstractFrequencySet::name_
privateinherited

◆ pgc_

std::shared_ptr<const GeneticCode> bpp::FullPerAACodonFrequencySet::pgc_
private

◆ ppfs_

◆ stateMap_

std::shared_ptr<const StateMapInterface> bpp::AbstractFrequencySet::stateMap_
privateinherited

◆ vS_

std::vector<Simplex> bpp::FullPerAACodonFrequencySet::vS_
private

vector of the simplexes, one for each AA

Definition at line 266 of file CodonFrequencySet.h.

Referenced by fireParameterChanged(), FullPerAACodonFrequencySet(), getMethod(), operator=(), setFrequencies(), setNamespace(), and updateFrequencies_().


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