bpp-phyl  2.2.0
bpp::FullFrequenciesSet Class Reference

A generic FrequenciesSet allowing for the estimation of all frequencies. More...

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

+ Inheritance diagram for bpp::FullFrequenciesSet:
+ Collaboration diagram for bpp::FullFrequenciesSet:

Public Member Functions

 FullFrequenciesSet (StateMap *stateMap, bool allowNullFreqs=false, unsigned short method=1, const std::string &name="Full.")
 Construction with uniform frequencies on the states of the alphabet. More...
 
 FullFrequenciesSet (StateMap *stateMap, const std::vector< double > &initFreqs, bool allowNullFreqs=false, unsigned short method=1, const std::string &name="Full.")
 
FullFrequenciesSetclone () const
 
void setFrequencies (const std::vector< double > &frequencies)
 Set the parameters in order to match a given set of frequencies. More...
 
unsigned short getMethod () const
 
void setNamespace (const std::string &nameSpace)
 
const Alphabet * getAlphabet () const
 
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 Attributes

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 updateFreq_ ()
 

Private Attributes

Simplex sFreq_
 Simplex to handle the probabilities and the parameters. More...
 

Detailed Description

A generic FrequenciesSet allowing for the estimation of all frequencies.

The FrequenciesSet has hence n-1 parameters, where n is the size of the input alphabet.

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

See also
Simplex

Definition at line 220 of file FrequenciesSet.h.

Constructor & Destructor Documentation

◆ FullFrequenciesSet() [1/2]

FullFrequenciesSet::FullFrequenciesSet ( StateMap stateMap,
bool  allowNullFreqs = false,
unsigned short  method = 1,
const std::string &  name = "Full." 
)

Construction with uniform frequencies on the states of the alphabet.

Definition at line 91 of file FrequenciesSet.cpp.

References bpp::StateMap::getNumberOfModelStates(), sFreq_, and updateFreq_().

Referenced by clone().

◆ FullFrequenciesSet() [2/2]

FullFrequenciesSet::FullFrequenciesSet ( StateMap stateMap,
const std::vector< double > &  initFreqs,
bool  allowNullFreqs = false,
unsigned short  method = 1,
const std::string &  name = "Full." 
)

Definition at line 106 of file FrequenciesSet.cpp.

References sFreq_, and updateFreq_().

Member Function Documentation

◆ clone()

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

Implements bpp::AbstractFrequenciesSet.

Reimplemented in bpp::FullProteinFrequenciesSet.

Definition at line 237 of file FrequenciesSet.h.

References FullFrequenciesSet().

◆ fireParameterChanged()

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

Definition at line 130 of file FrequenciesSet.cpp.

References sFreq_, and updateFreq_().

◆ getAlphabet()

◆ getAlphabetStatesFrequencies()

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

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

◆ getMethod()

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

Definition at line 242 of file FrequenciesSet.h.

References sFreq_.

◆ getName()

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

◆ getNumberOfFrequencies()

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

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

◆ setFrequencies()

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

Set the parameters in order to match a given set of frequencies.

Parameters
frequenciesThe set of frequencies to match.
Exceptions
DimensionExceptionIf the number of frequencies does not match the size of the alphabet.
ExceptionIf the frequencies do not sum to 1.

Implements bpp::FrequenciesSet.

Definition at line 115 of file FrequenciesSet.cpp.

References sFreq_, and updateFreq_().

◆ setFrequencies_()

◆ setFrequenciesFromAlphabetStatesFrequencies()

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 FullFrequenciesSet::setNamespace ( const std::string &  nameSpace)

Definition at line 124 of file FrequenciesSet.cpp.

References sFreq_.

◆ updateFreq_()

void FullFrequenciesSet::updateFreq_ ( )
private

Member Data Documentation

◆ 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

◆ sFreq_

Simplex bpp::FullFrequenciesSet::sFreq_
private

Simplex to handle the probabilities and the parameters.

Definition at line 227 of file FrequenciesSet.h.

Referenced by fireParameterChanged(), FullFrequenciesSet(), getMethod(), setFrequencies(), setNamespace(), and updateFreq_().


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