bpp-phyl3  3.0.0
bpp::BppOBranchModelFormat Class Reference

Branch model I/O in BppO format. More...

#include <Bpp/Phyl/Io/BppOBranchModelFormat.h>

+ Inheritance diagram for bpp::BppOBranchModelFormat:
+ Collaboration diagram for bpp::BppOBranchModelFormat:

Public Member Functions

 BppOBranchModelFormat (unsigned char alphabetCode, bool allowCovarions, bool allowMixed, bool allowGaps, bool verbose, int warn)
 Create a new BppOBranchModelFormat object. More...
 
 BppOBranchModelFormat (const BppOTransitionModelFormat &format)
 
BppOBranchModelFormatoperator= (const BppOBranchModelFormat &format)
 
std::unique_ptr< BranchModelInterfacereadBranchModel (std::shared_ptr< const Alphabet > alphabet, const std::string &modelDescription, const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &mData, size_t nData, bool parseArguments=true)
 
std::unique_ptr< TransitionModelInterfacereadTransitionModel (std::shared_ptr< const Alphabet > alphabet, const std::string &modelDescription, const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &mData, size_t nData, bool parseArguments=true)
 
const std::string getFormatName () const override
 
const std::string getFormatDescription () const override
 
void setGeneticCode (std::shared_ptr< const GeneticCode > gCode)
 Set the genetic code to use in case a codon frequencies set should be built. More...
 
std::unique_ptr< SubstitutionModelInterfacereadSubstitutionModel (std::shared_ptr< const Alphabet > alphabet, const std::string &modelDescription, const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &mData, size_t nData, bool parseArguments=true) override
 Read a substitution model from a string. More...
 
const std::map< std::string, std::string > & getUnparsedArguments () const override
 
void write (const BranchModelInterface &model, OutputStream &out, std::map< std::string, std::string > &globalAliases, std::vector< std::string > &writtenNames) const override
 Write a substitution model to a stream. More...
 
void setVerbose (bool verbose)
 
virtual const std::string getDataType () const
 

Static Public Attributes

static unsigned char DNA = 1
 
static unsigned char RNA = 2
 
static unsigned char NUCLEOTIDE = 1 | 2
 
static unsigned char PROTEIN = 4
 
static unsigned char CODON = 8
 
static unsigned char WORD = 16
 
static unsigned char BINARY = 32
 
static unsigned char INTEGER = 64
 
static unsigned char ALL = 1 | 2 | 4 | 8 | 16 | 32 | 64
 

Protected Member Functions

void updateParameters_ (BranchModelInterface &model, std::map< std::string, std::string > &args)
 Finish parsing of parameters, taking care of aliases. More...
 
void initialize_ (BranchModelInterface &model, std::shared_ptr< const AlignmentDataInterface > data)
 Set parameter initial values of a given model according to options. More...
 

Protected Attributes

unsigned char alphabetCode_
 
bool allowCovarions_
 
bool allowMixed_
 
bool allowGaps_
 
bool verbose_
 
std::map< std::string, std::string > unparsedArguments_
 
std::shared_ptr< const GeneticCodegeneticCode_
 
int warningLevel_
 

Private Member Functions

std::unique_ptr< MixedTransitionModelInterfacereadMixed_ (std::shared_ptr< const Alphabet > alphabet, const std::string &modelDescription, const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &mData, size_t nData)
 
std::unique_ptr< SubstitutionModelInterfacereadWord_ (std::shared_ptr< const Alphabet > alphabet, const std::string &modelDescription, const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &mData, size_t nData)
 
void writeMixed_ (const MixedTransitionModelInterface &model, OutputStream &out, std::map< std::string, std::string > &globalAliases, std::vector< std::string > &writtenNames) const
 

Detailed Description

Branch model I/O in BppO format.

Creates a new branch model object according to model description syntax (see the Bio++ Program Suite manual for a detailed description of this syntax).

Definition at line 21 of file BppOBranchModelFormat.h.

Constructor & Destructor Documentation

◆ BppOBranchModelFormat() [1/2]

bpp::BppOBranchModelFormat::BppOBranchModelFormat ( unsigned char  alphabetCode,
bool  allowCovarions,
bool  allowMixed,
bool  allowGaps,
bool  verbose,
int  warn 
)
inline

Create a new BppOBranchModelFormat object.

Parameters
alphabetCodeBit saying which alphabets are allowed in the model specification.
allowCovarionsTell is a covarion model can be returned.
allowMixedTell is a mixture model can be returned.
allowGapsTell is a gap model can be returned.
verboseTell if the construction is verbose.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).

Definition at line 35 of file BppOBranchModelFormat.h.

◆ BppOBranchModelFormat() [2/2]

bpp::BppOBranchModelFormat::BppOBranchModelFormat ( const BppOTransitionModelFormat format)
inline

Definition at line 39 of file BppOBranchModelFormat.h.

Member Function Documentation

◆ getDataType()

virtual const std::string bpp::IoSubstitutionModel::getDataType ( ) const
inlinevirtualinherited

Implements bpp::IOFormat.

Definition at line 35 of file IoSubstitutionModel.h.

◆ getFormatDescription()

const std::string bpp::BppOSubstitutionModelFormat::getFormatDescription ( ) const
inlineoverridevirtualinherited

Implements bpp::IOFormat.

Definition at line 100 of file BppOSubstitutionModelFormat.h.

◆ getFormatName()

const std::string bpp::BppOSubstitutionModelFormat::getFormatName ( ) const
inlineoverridevirtualinherited

Implements bpp::IOFormat.

Definition at line 98 of file BppOSubstitutionModelFormat.h.

◆ getUnparsedArguments()

◆ initialize_()

void BppOSubstitutionModelFormat::initialize_ ( BranchModelInterface model,
std::shared_ptr< const AlignmentDataInterface data 
)
protectedinherited

Set parameter initial values of a given model according to options.

Parameters actually depends on the model passed as argument. See getSubstitutionModel for more information.

This function is mainly for internal usage, you're probably looking for the getSubstitutionModel or getSubstitutionModelSet function.

Parameters
modelThe model to set.
dataA pointer toward the AlignmentDataInterface for which the substitution model is designed. The alphabet associated to the data must be of the same type as the one specified for the model. May be equal to NULL, but in this case use_observed_freq option will be unavailable.
Exceptions
Exceptionif an error occurred.

Definition at line 2000 of file BppOSubstitutionModelFormat.cpp.

References bpp::ApplicationTools::displayMessage(), bpp::ApplicationTools::displayResult(), bpp::ApplicationTools::displayWarning(), bpp::ApplicationTools::getDoubleParameter(), bpp::ParameterAliasable::getIndependentParameters(), bpp::BranchModelInterface::getName(), bpp::ParameterAliasable::getNamespace(), bpp::ApplicationTools::getStringParameter(), bpp::StringTokenizer::hasMoreToken(), bpp::ParameterAliasable::matchParametersValues(), bpp::StringTokenizer::nextToken(), bpp::AutoParameter::setMessageHandler(), bpp::ParameterList::setParameter(), bpp::ParameterList::size(), bpp::TextTools::toDouble(), bpp::TextTools::toString(), and bpp::ApplicationTools::warning.

◆ operator=()

BppOBranchModelFormat& bpp::BppOBranchModelFormat::operator= ( const BppOBranchModelFormat format)
inline

◆ readBranchModel()

std::unique_ptr< BranchModelInterface > BppOBranchModelFormat::readBranchModel ( std::shared_ptr< const Alphabet alphabet,
const std::string &  modelDescription,
const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &  mData,
size_t  nData,
bool  parseArguments = true 
)

◆ readMixed_()

◆ readSubstitutionModel()

unique_ptr< SubstitutionModelInterface > BppOSubstitutionModelFormat::readSubstitutionModel ( std::shared_ptr< const Alphabet alphabet,
const std::string &  modelDescription,
const std::map< size_t, std::shared_ptr< const AlignmentDataInterface >> &  mData,
size_t  nData,
bool  parseArguments = true 
)
overridevirtualinherited

Read a substitution model from a string.

Parameters
alphabetThe alphabet to use in the model.
modelDescriptionA string describing the model in the format.
mDataA map towards pointers of SiteContainer with the data to use to initialize frequency parameters
nDataNumber of the SiteContainer in the mData. Can be set to 0, if none assigned.
parseArgumentsAttempt to parse function arguments. If not, only store them and use default values instead.
Returns
A new SubstitutionModel object according to options specified.
Exceptions
Exceptionif an error occurred.

SIMPLE MODELS

Implements bpp::ISubstitutionModel.

Definition at line 118 of file BppOSubstitutionModelFormat.cpp.

References bpp::BppOFrequencySetFormat::ALL, bpp::ApplicationTools::displayResult(), bpp::ApplicationTools::displayWarning(), bpp::ApplicationTools::getStringParameter(), bpp::PhylogeneticsApplicationTools::getSubstitutionRegister(), bpp::BppODiscreteDistributionFormat::getUnparsedArguments(), bpp::BppOFrequencySetFormat::getUnparsedArguments(), bpp::BppOSubstitutionModelFormat::getUnparsedArguments(), bpp::AlphabetTools::isBinaryAlphabet(), bpp::AlphabetTools::isCodonAlphabet(), bpp::TextTools::isEmpty(), bpp::AlphabetTools::isIntegerAlphabet(), bpp::AlphabetTools::isNucleicAlphabet(), bpp::AlphabetTools::isProteicAlphabet(), bpp::AlphabetTools::isRNYAlphabet(), bpp::KeyvalTools::parseProcedure(), bpp::BppORateDistributionFormat::readDiscreteDistribution(), bpp::BppOFrequencySetFormat::readFrequencySet(), bpp::BppOSubstitutionModelFormat::readSubstitutionModel(), bpp::BppOTransitionModelFormat::readTransitionModel(), bpp::BppOFrequencySetFormat::setGeneticCode(), bpp::BppOSubstitutionModelFormat::setGeneticCode(), bpp::TextTools::toInt(), and bpp::TextTools::toString().

Referenced by bpp::PhylogeneticsApplicationTools::getSubstitutionModel(), bpp::BppOSubstitutionModelFormat::readSubstitutionModel(), bpp::BppOTransitionModelFormat::readTransitionModel(), and bpp::BppOSubstitutionModelFormat::readWord_().

◆ readTransitionModel()

◆ readWord_()

◆ setGeneticCode()

◆ setVerbose()

void bpp::BppOSubstitutionModelFormat::setVerbose ( bool  verbose)
inlineinherited

◆ updateParameters_()

◆ write()

void BppOSubstitutionModelFormat::write ( const BranchModelInterface model,
OutputStream out,
std::map< std::string, std::string > &  globalAliases,
std::vector< std::string > &  writtenNames 
) const
overridevirtualinherited

Write a substitution model to a stream.

Parameters
modelA substitution model object;
outThe output stream;
globalAliasesparameters linked to global alias. The output will be "name=alias_name";
writtenNamesis the vector of the written parameters so far [in, out];
Exceptions
ExceptionIf an error occurred.

Implements bpp::OSubstitutionModel.

Definition at line 1515 of file BppOSubstitutionModelFormat.cpp.

References bpp::POMO::fitness(), bpp::BranchModelInterface::frequencySet(), bpp::Coala::getExch(), bpp::ParameterAliasable::getIndependentParameters(), bpp::BranchModelInterface::getName(), bpp::AbstractParameterAliasable::getNamespace(), bpp::CoalaCore::getNbrOfAxes(), bpp::AbstractWordSubstitutionModel::getNumberOfModels(), bpp::ParameterList::getParameterNames(), bpp::UserProteinSubstitutionModel::getPath(), bpp::OneChangeRegisterTransitionModel::getRegisterName(), bpp::RegisterRatesSubstitutionModel::getRegisterName(), bpp::OneChangeRegisterTransitionModel::getRegisterNumbers(), bpp::InMixedSubstitutionModel::getSubModelNumber(), bpp::POMO::hasFitness(), bpp::TextTools::hasSubstring(), bpp::InMixedSubstitutionModel::mixedModel(), bpp::AbstractFromSubstitutionModelTransitionModel::model(), bpp::AbstractWrappedTransitionModel::model(), bpp::POMO::mutationModel(), bpp::MarkovModulatedSubstitutionModel::nestedModel(), bpp::gBGC::nestedModel(), bpp::YpR::nestedModel(), bpp::RE08::nestedModel(), bpp::AbstractWordSubstitutionModel::nModel(), bpp::VectorTools::paste(), bpp::G2001::rateDistribution(), bpp::StdStr::str(), bpp::TextTools::toString(), bpp::BppOParametrizableFormat::write(), bpp::BppODiscreteDistributionFormat::writeDiscreteDistribution(), and bpp::BppOFrequencySetFormat::writeFrequencySet().

Referenced by bpp::PhylogeneticsApplicationTools::printParameters(), bpp::LegacyPhylogeneticsApplicationTools::printParameters(), and bpp::BppOFrequencySetFormat::writeFrequencySet().

◆ writeMixed_()

void BppOSubstitutionModelFormat::writeMixed_ ( const MixedTransitionModelInterface model,
OutputStream out,
std::map< std::string, std::string > &  globalAliases,
std::vector< std::string > &  writtenNames 
) const
privateinherited

Member Data Documentation

◆ ALL

◆ allowCovarions_

bool bpp::BppOSubstitutionModelFormat::allowCovarions_
protectedinherited

◆ allowGaps_

bool bpp::BppOSubstitutionModelFormat::allowGaps_
protectedinherited

◆ allowMixed_

bool bpp::BppOSubstitutionModelFormat::allowMixed_
protectedinherited

◆ alphabetCode_

unsigned char bpp::BppOSubstitutionModelFormat::alphabetCode_
protectedinherited

◆ BINARY

unsigned char BppOSubstitutionModelFormat::BINARY = 32
staticinherited

Definition at line 35 of file BppOSubstitutionModelFormat.h.

◆ CODON

unsigned char BppOSubstitutionModelFormat::CODON = 8
staticinherited

Definition at line 33 of file BppOSubstitutionModelFormat.h.

◆ DNA

unsigned char BppOSubstitutionModelFormat::DNA = 1
staticinherited

Definition at line 29 of file BppOSubstitutionModelFormat.h.

◆ geneticCode_

std::shared_ptr<const GeneticCode> bpp::BppOSubstitutionModelFormat::geneticCode_
protectedinherited

◆ INTEGER

unsigned char BppOSubstitutionModelFormat::INTEGER = 64
staticinherited

Definition at line 36 of file BppOSubstitutionModelFormat.h.

◆ NUCLEOTIDE

unsigned char BppOSubstitutionModelFormat::NUCLEOTIDE = 1 | 2
staticinherited

Definition at line 31 of file BppOSubstitutionModelFormat.h.

◆ PROTEIN

unsigned char BppOSubstitutionModelFormat::PROTEIN = 4
staticinherited

Definition at line 32 of file BppOSubstitutionModelFormat.h.

◆ RNA

unsigned char BppOSubstitutionModelFormat::RNA = 2
staticinherited

Definition at line 30 of file BppOSubstitutionModelFormat.h.

◆ unparsedArguments_

std::map<std::string, std::string> bpp::BppOSubstitutionModelFormat::unparsedArguments_
protectedinherited

◆ verbose_

bool bpp::BppOSubstitutionModelFormat::verbose_
protectedinherited

◆ warningLevel_

int bpp::BppOSubstitutionModelFormat::warningLevel_
protectedinherited

◆ WORD

unsigned char BppOSubstitutionModelFormat::WORD = 16
staticinherited

Definition at line 34 of file BppOSubstitutionModelFormat.h.


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