bpp-phyl  2.2.0
bpp::FixedCodonFrequenciesSet Class Referenceabstract

FrequenciesSet useful for homogeneous and stationary models, codon implementation. More...

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

+ Inheritance diagram for bpp::FixedCodonFrequenciesSet:
+ Collaboration diagram for bpp::FixedCodonFrequenciesSet:

Public Member Functions

 FixedCodonFrequenciesSet (const GeneticCode *gCode, const std::vector< double > &initFreqs, const std::string &name="Fixed")
 
 FixedCodonFrequenciesSet (const GeneticCode *gCode, const std::string &name="Fixed")
 Construction with uniform frequencies on the letters of the alphabet. The stop codon frequencies are null. More...
 
 FixedCodonFrequenciesSet (const FixedCodonFrequenciesSet &fcfs)
 
FixedCodonFrequenciesSetoperator= (const FixedCodonFrequenciesSet &fcfs)
 
FixedCodonFrequenciesSetclone () const
 
const GeneticCode * getGeneticCode () const
 
const CodonAlphabet * getAlphabet () 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...
 
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)
 

Protected Attributes

const GeneticCode * pgc_
 

Detailed Description

FrequenciesSet useful for homogeneous and stationary models, codon implementation.

This set contains no parameter.

Definition at line 177 of file CodonFrequenciesSet.h.

Constructor & Destructor Documentation

◆ FixedCodonFrequenciesSet() [1/3]

FixedCodonFrequenciesSet::FixedCodonFrequenciesSet ( const GeneticCode *  gCode,
const std::vector< double > &  initFreqs,
const std::string &  name = "Fixed" 
)

Definition at line 331 of file CodonFrequenciesSet.cpp.

References setFrequencies().

Referenced by clone().

◆ FixedCodonFrequenciesSet() [2/3]

FixedCodonFrequenciesSet::FixedCodonFrequenciesSet ( const GeneticCode *  gCode,
const std::string &  name = "Fixed" 
)

Construction with uniform frequencies on the letters of the alphabet. The stop codon frequencies are null.

Definition at line 341 of file CodonFrequenciesSet.cpp.

References bpp::AbstractFrequenciesSet::getFreq_().

◆ FixedCodonFrequenciesSet() [3/3]

bpp::FixedCodonFrequenciesSet::FixedCodonFrequenciesSet ( const FixedCodonFrequenciesSet fcfs)
inline

Definition at line 193 of file CodonFrequenciesSet.h.

Member Function Documentation

◆ clone()

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

Implements bpp::CodonFrequenciesSet.

Definition at line 210 of file CodonFrequenciesSet.h.

References FixedCodonFrequenciesSet().

◆ fireParameterChanged()

void bpp::FixedCodonFrequenciesSet::fireParameterChanged ( const ParameterList &  parameters)
inlineprotected

Definition at line 229 of file CodonFrequenciesSet.h.

◆ getAlphabet()

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

Implements bpp::CodonFrequenciesSet.

Definition at line 216 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::FixedCodonFrequenciesSet::getGeneticCode ( ) const
inlinevirtual
Returns
The associated genetic code.

Implements bpp::CodonFrequenciesSet.

Definition at line 213 of file CodonFrequenciesSet.h.

References pgc_.

◆ 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().

◆ 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 bpp::FullPerAACodonFrequenciesSet::updateFrequencies().

◆ normalize()

void bpp::AbstractFrequenciesSet::normalize ( )
inlineinherited

◆ operator=()

FixedCodonFrequenciesSet& bpp::FixedCodonFrequenciesSet::operator= ( const FixedCodonFrequenciesSet fcfs)
inline

Definition at line 198 of file CodonFrequenciesSet.h.

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

◆ setFrequencies()

void FixedCodonFrequenciesSet::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 353 of file CodonFrequenciesSet.cpp.

References getAlphabet(), bpp::AbstractFrequenciesSet::getFreq_(), and pgc_.

Referenced by FixedCodonFrequenciesSet().

◆ 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.

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::FixedCodonFrequenciesSet::pgc_
protected

Definition at line 182 of file CodonFrequenciesSet.h.

Referenced by getGeneticCode(), operator=(), and setFrequencies().


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