bpp-phyl  2.2.0
bpp::FullPerAACodonFrequenciesSet Class Referenceabstract

FrequenciesSet integrating ProteinFrequenciesSet inside CodonFrequenciesSet. In this case, FrequencieSet defined inside each amino acid is parametrized as a FullFrequenciesSet. Hence there are 61-20=41 parameters in addition of the parameters of the ProteinFrequenciesSet. More...

#include <Bpp/Phyl/Model/FrequenciesSet/CodonFrequenciesSet.h>

+ Inheritance diagram for bpp::FullPerAACodonFrequenciesSet:
+ Collaboration diagram for bpp::FullPerAACodonFrequenciesSet:

Public Member Functions

 FullPerAACodonFrequenciesSet (const GeneticCode *gencode, ProteinFrequenciesSet *ppfs, unsigned short method=1)
 Create a new FullPerAACodonFrequenciesSet object. More...
 
 FullPerAACodonFrequenciesSet (const GeneticCode *gencode, unsigned short method=1)
 Construction with fixed uniform frequencies on the amino acids. The stop codon frequencies are null. More...
 
 FullPerAACodonFrequenciesSet (const FullPerAACodonFrequenciesSet &ffs)
 
FullPerAACodonFrequenciesSetoperator= (const FullPerAACodonFrequenciesSet &ffs)
 
virtual ~FullPerAACodonFrequenciesSet ()
 
FullPerAACodonFrequenciesSetclone () const
 
const CodonAlphabet * getAlphabet () const
 
const GeneticCode * getGeneticCode () const
 
void setFrequencies (const std::vector< double > &frequencies)
 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)
 
const ProteinFrequenciesSetgetProteinFrequenciesSet () const
 
unsigned short getMethod () const
 
virtual const StateMapgetStateMap () const =0
 
virtual const std::vector< double > getFrequencies () 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
 
const StateMapgetStateMap () const
 
const std::vector< double > getFrequencies () const
 
const std::map< int, double > getAlphabetStatesFrequencies () const
 
void setFrequenciesFromAlphabetStatesFrequencies (const std::map< int, double > &frequencies)
 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
 
std::string getName () const
 
void normalize ()
 

Static Public Member Functions

static FrequenciesSetgetFrequenciesSetForCodons (short option, const GeneticCode *gCode, const std::string &mgmtStopFreq="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 IntervalConstraint FREQUENCE_CONSTRAINT_SMALL
 
static IntervalConstraint FREQUENCE_CONSTRAINT_MILLI
 

Protected Member Functions

void fireParameterChanged (const ParameterList &parameters)
 
std::vector< double > & getFrequencies_ ()
 
double & getFreq_ (size_t i)
 
const double & getFreq_ (size_t i) const
 
void setFrequencies_ (const std::vector< double > &frequencies)
 

Private Member Functions

void updateFrequencies ()
 

Private Attributes

const GeneticCode * pgc_
 
std::auto_ptr< ProteinFrequenciesSetppfs_
 
std::vector< Simplex > vS_
 

Detailed Description

FrequenciesSet integrating ProteinFrequenciesSet inside CodonFrequenciesSet. In this case, FrequencieSet defined inside each amino acid is parametrized as a FullFrequenciesSet. Hence there are 61-20=41 parameters in addition of the parameters of the ProteinFrequenciesSet.

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

See also
Simplex

Definition at line 246 of file CodonFrequenciesSet.h.

Constructor & Destructor Documentation

◆ FullPerAACodonFrequenciesSet() [1/3]

FullPerAACodonFrequenciesSet::FullPerAACodonFrequenciesSet ( const GeneticCode *  gencode,
ProteinFrequenciesSet ppfs,
unsigned short  method = 1 
)

Create a new FullPerAACodonFrequenciesSet 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 177 of file CodonFrequenciesSet.cpp.

References bpp::StateMap::getAlphabetStateAsInt(), bpp::StateMap::getNumberOfModelStates(), pgc_, ppfs_, updateFrequencies(), and vS_.

Referenced by clone().

◆ FullPerAACodonFrequenciesSet() [2/3]

FullPerAACodonFrequenciesSet::FullPerAACodonFrequenciesSet ( 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 206 of file CodonFrequenciesSet.cpp.

References bpp::StateMap::getAlphabetStateAsInt(), bpp::StateMap::getNumberOfModelStates(), pgc_, ppfs_, updateFrequencies(), and vS_.

◆ FullPerAACodonFrequenciesSet() [3/3]

FullPerAACodonFrequenciesSet::FullPerAACodonFrequenciesSet ( const FullPerAACodonFrequenciesSet ffs)

Definition at line 228 of file CodonFrequenciesSet.cpp.

References updateFrequencies().

◆ ~FullPerAACodonFrequenciesSet()

virtual bpp::FullPerAACodonFrequenciesSet::~FullPerAACodonFrequenciesSet ( )
inlinevirtual

Definition at line 288 of file CodonFrequenciesSet.h.

Member Function Documentation

◆ clone()

FullPerAACodonFrequenciesSet* bpp::FullPerAACodonFrequenciesSet::clone ( ) const
inlinevirtual

Implements bpp::CodonFrequenciesSet.

Definition at line 295 of file CodonFrequenciesSet.h.

References FullPerAACodonFrequenciesSet().

◆ fireParameterChanged()

void FullPerAACodonFrequenciesSet::fireParameterChanged ( const ParameterList &  parameters)
protected

Definition at line 249 of file CodonFrequenciesSet.cpp.

References ppfs_, updateFrequencies(), and vS_.

◆ getAlphabet()

const CodonAlphabet* bpp::FullPerAACodonFrequenciesSet::getAlphabet ( ) const
inlinevirtual
Returns
The alphabet associated to this set.

Implements bpp::CodonFrequenciesSet.

Definition at line 299 of file CodonFrequenciesSet.h.

References bpp::AbstractFrequenciesSet::getAlphabet().

Referenced by setFrequencies().

◆ getAlphabetStatesFrequencies() [1/2]

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

Implemented in bpp::AbstractFrequenciesSet.

Referenced by bpp::CodonDistanceFitnessPhaseFrequenciesSubstitutionModel::setFreq().

◆ getAlphabetStatesFrequencies() [2/2]

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

Implements bpp::FrequenciesSet.

Definition at line 79 of file FrequenciesSet.cpp.

◆ getFreq_() [1/2]

◆ getFreq_() [2/2]

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

Definition at line 204 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

◆ getFrequencies() [1/2]

◆ getFrequencies() [2/2]

const std::vector<double> bpp::AbstractFrequenciesSet::getFrequencies ( ) const
inlinevirtualinherited
Returns
The frequencies values of the set.

Implements bpp::FrequenciesSet.

Definition at line 174 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

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

◆ getFrequencies_()

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

Definition at line 202 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

◆ getFrequenciesSetForCodons()

FrequenciesSet * CodonFrequenciesSet::getFrequenciesSetForCodons ( short  option,
const GeneticCode *  gCode,
const std::string &  mgmtStopFreq = "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 FrequenciesSet instance.
mgmtStopFreqthe 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 623 of file CodonFrequenciesSet.cpp.

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

Referenced by bpp::BppOFrequenciesSetFormat::read().

◆ getGeneticCode()

const GeneticCode* bpp::FullPerAACodonFrequenciesSet::getGeneticCode ( ) const
inlinevirtual
Returns
The associated genetic code.

Implements bpp::CodonFrequenciesSet.

Definition at line 305 of file CodonFrequenciesSet.h.

References pgc_.

◆ getMethod()

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

Definition at line 321 of file CodonFrequenciesSet.h.

References vS_.

Referenced by bpp::BppOFrequenciesSetFormat::write().

◆ getName() [1/2]

◆ getName() [2/2]

std::string bpp::AbstractFrequenciesSet::getName ( ) const
inlinevirtualinherited

◆ getNumberOfFrequencies() [1/2]

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

Implemented in bpp::AbstractFrequenciesSet.

◆ getNumberOfFrequencies() [2/2]

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

Implements bpp::FrequenciesSet.

Definition at line 189 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

Referenced by bpp::FixedFrequenciesSet::setFrequencies().

◆ getProteinFrequenciesSet()

const ProteinFrequenciesSet* bpp::FullPerAACodonFrequenciesSet::getProteinFrequenciesSet ( ) const
inline

Definition at line 316 of file CodonFrequenciesSet.h.

References ppfs_.

Referenced by bpp::BppOFrequenciesSetFormat::write().

◆ getStateMap() [1/2]

virtual const StateMap& bpp::FrequenciesSet::getStateMap ( ) const
pure virtualinherited
Returns
The mapping of model states with alphabet states.

Implemented in bpp::AbstractFrequenciesSet.

◆ getStateMap() [2/2]

const StateMap& bpp::AbstractFrequenciesSet::getStateMap ( ) const
inlinevirtualinherited
Returns
The mapping of model states with alphabet states.

Implements bpp::FrequenciesSet.

Definition at line 172 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::stateMap_.

Referenced by updateFrequencies().

◆ normalize()

void bpp::AbstractFrequenciesSet::normalize ( )
inlineinherited

Definition at line 193 of file FrequenciesSet.h.

References bpp::AbstractFrequenciesSet::freq_.

Referenced by updateFrequencies().

◆ operator=()

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

Definition at line 238 of file CodonFrequenciesSet.cpp.

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

◆ setFrequencies()

void FullPerAACodonFrequenciesSet::setFrequencies ( const std::vector< double > &  frequencies)
virtual

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

Implements bpp::FrequenciesSet.

Definition at line 277 of file CodonFrequenciesSet.cpp.

References getAlphabet(), bpp::StateMap::getAlphabetStateAsInt(), bpp::StateMap::getNumberOfModelStates(), pgc_, ppfs_, updateFrequencies(), and vS_.

◆ setFrequencies_()

◆ setFrequenciesFromAlphabetStatesFrequencies() [1/2]

virtual void bpp::FrequenciesSet::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::AbstractFrequenciesSet.

Referenced by bpp::BppOFrequenciesSetFormat::initialize_(), bpp::AbstractCodonFitnessSubstitutionModel::setFreq(), bpp::AbstractCodonFrequenciesSubstitutionModel::setFreq(), and bpp::AbstractCodonPhaseFrequenciesSubstitutionModel::setFreq().

◆ setFrequenciesFromAlphabetStatesFrequencies() [2/2]

void AbstractFrequenciesSet::setFrequenciesFromAlphabetStatesFrequencies ( const std::map< int, double > &  frequencies)
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.

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::FrequenciesSet.

Definition at line 58 of file FrequenciesSet.cpp.

◆ setNamespace()

void FullPerAACodonFrequenciesSet::setNamespace ( const std::string &  prefix)

Definition at line 315 of file CodonFrequenciesSet.cpp.

References pgc_, ppfs_, and vS_.

◆ updateFrequencies()

Member Data Documentation

◆ F0

const short CodonFrequenciesSet::F0 = 0
staticinherited

◆ F1X4

const short CodonFrequenciesSet::F1X4 = 1
staticinherited

◆ F3X4

const short CodonFrequenciesSet::F3X4 = 2
staticinherited

◆ F61

const short CodonFrequenciesSet::F61 = 3
staticinherited

◆ FREQUENCE_CONSTRAINT_MILLI

IntervalConstraint FrequenciesSet::FREQUENCE_CONSTRAINT_MILLI
staticinherited

Definition at line 118 of file FrequenciesSet.h.

◆ FREQUENCE_CONSTRAINT_SMALL

IntervalConstraint FrequenciesSet::FREQUENCE_CONSTRAINT_SMALL
staticinherited

◆ pgc_

const GeneticCode* bpp::FullPerAACodonFrequenciesSet::pgc_
private

◆ ppfs_

std::auto_ptr<ProteinFrequenciesSet> bpp::FullPerAACodonFrequenciesSet::ppfs_
private

◆ vS_

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

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