bpp-phyl  2.2.0
bpp::WordFromIndependentFrequenciesSet Class Referenceabstract

the Frequencies in words are the product of Independent Frequencies in letters More...

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

+ Inheritance diagram for bpp::WordFromIndependentFrequenciesSet:
+ Collaboration diagram for bpp::WordFromIndependentFrequenciesSet:

Public Member Functions

 WordFromIndependentFrequenciesSet (const WordAlphabet *pWA, const std::vector< FrequenciesSet *> &freqVector, const std::string &prefix="", const std::string &name="WordFromIndependent")
 Constructor from a WordAlphabet* and a vector of different FrequenciesSet*. Throws an Exception if their lengths do not match. More...
 
 WordFromIndependentFrequenciesSet (const WordFromIndependentFrequenciesSet &iwfs)
 
 ~WordFromIndependentFrequenciesSet ()
 
WordFromIndependentFrequenciesSetoperator= (const WordFromIndependentFrequenciesSet &iwfs)
 
WordFromIndependentFrequenciesSetclone () const
 
void fireParameterChanged (const ParameterList &pl)
 
virtual void updateFrequencies ()
 
virtual void setFrequencies (const std::vector< double > &frequencies)
 
const FrequenciesSetgetFrequenciesSetForLetter (size_t i) const
 
virtual size_t getLength () const
 
void setNamespace (const std::string &prefix)
 
std::string getDescription () const
 
const WordAlphabet * getAlphabet () const
 
virtual const StateMapgetStateMap () const =0
 
const StateMapgetStateMap () const
 
virtual const std::vector< double > getFrequencies () const =0
 
const std::vector< double > getFrequencies () const
 
virtual const std::map< int, double > getAlphabetStatesFrequencies () const =0
 
const std::map< int, double > getAlphabetStatesFrequencies () const
 
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...
 
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...
 
virtual std::string getName () const =0
 
std::string getName () const
 
virtual size_t getNumberOfFrequencies () const =0
 
size_t getNumberOfFrequencies () const
 
void normalize ()
 

Static Public Attributes

static IntervalConstraint FREQUENCE_CONSTRAINT_SMALL
 
static IntervalConstraint FREQUENCE_CONSTRAINT_MILLI
 

Protected Member Functions

size_t getSizeFromVector (const std::vector< FrequenciesSet *> &freqVector)
 
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

std::vector< FrequenciesSet * > vFreq_
 
std::vector< std::string > vNestedPrefix_
 

Detailed Description

the Frequencies in words are the product of Independent Frequencies in letters

Author
Laurent Guéguen

Definition at line 139 of file WordFrequenciesSet.h.

Constructor & Destructor Documentation

◆ WordFromIndependentFrequenciesSet() [1/2]

WordFromIndependentFrequenciesSet::WordFromIndependentFrequenciesSet ( const WordAlphabet *  pWA,
const std::vector< FrequenciesSet *> &  freqVector,
const std::string &  prefix = "",
const std::string &  name = "WordFromIndependent" 
)

Constructor from a WordAlphabet* and a vector of different FrequenciesSet*. Throws an Exception if their lengths do not match.

Definition at line 77 of file WordFrequenciesSet.cpp.

References bpp::AbstractWordFrequenciesSet::getSizeFromVector(), updateFrequencies(), vFreq_, and vNestedPrefix_.

Referenced by clone().

◆ WordFromIndependentFrequenciesSet() [2/2]

WordFromIndependentFrequenciesSet::WordFromIndependentFrequenciesSet ( const WordFromIndependentFrequenciesSet iwfs)

Definition at line 102 of file WordFrequenciesSet.cpp.

References updateFrequencies(), and vFreq_.

◆ ~WordFromIndependentFrequenciesSet()

WordFromIndependentFrequenciesSet::~WordFromIndependentFrequenciesSet ( )

Definition at line 114 of file WordFrequenciesSet.cpp.

References vFreq_.

Member Function Documentation

◆ clone()

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

◆ fireParameterChanged()

void WordFromIndependentFrequenciesSet::fireParameterChanged ( const ParameterList &  pl)

Definition at line 143 of file WordFrequenciesSet.cpp.

References updateFrequencies(), and vFreq_.

◆ getAlphabet()

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

◆ getDescription()

std::string WordFromIndependentFrequenciesSet::getDescription ( ) const

Definition at line 239 of file WordFrequenciesSet.cpp.

References bpp::AbstractFrequenciesSet::getName(), and vFreq_.

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

◆ getFrequenciesSetForLetter()

const FrequenciesSet& bpp::WordFromIndependentFrequenciesSet::getFrequenciesSetForLetter ( size_t  i) const
inlinevirtual

@ brief Return the n-th FrequenciesSet&

Implements bpp::WordFrequenciesSet.

Definition at line 177 of file WordFrequenciesSet.h.

References vFreq_.

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

◆ getLength()

size_t WordFromIndependentFrequenciesSet::getLength ( ) const
virtual

@ brief Return the length of the words

Reimplemented from bpp::AbstractWordFrequenciesSet.

Definition at line 225 of file WordFrequenciesSet.cpp.

References vFreq_.

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

◆ getSizeFromVector()

size_t AbstractWordFrequenciesSet::getSizeFromVector ( const std::vector< FrequenciesSet *> &  freqVector)
protectedvirtualinherited

Implements bpp::WordFrequenciesSet.

Definition at line 48 of file WordFrequenciesSet.cpp.

Referenced by WordFromIndependentFrequenciesSet().

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

◆ setFrequencies()

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

@ brief Independent letter frequencies from given word frequencies. The frequencies of a letter at a position is the sum of the frequencies of the words that have this letter at this position.

Implements bpp::FrequenciesSet.

Definition at line 183 of file WordFrequenciesSet.cpp.

References bpp::AbstractWordFrequenciesSet::getAlphabet(), updateFrequencies(), and vFreq_.

◆ 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 WordFromIndependentFrequenciesSet::setNamespace ( const std::string &  prefix)

Definition at line 230 of file WordFrequenciesSet.cpp.

References vFreq_, and vNestedPrefix_.

◆ updateFrequencies()

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

◆ vFreq_

◆ vNestedPrefix_

std::vector<std::string> bpp::WordFromIndependentFrequenciesSet::vNestedPrefix_
protected

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