bpp-phyl  2.2.0
bpp::BppOSubstitutionModelFormat Class Reference

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

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

+ Inheritance diagram for bpp::BppOSubstitutionModelFormat:
+ Collaboration diagram for bpp::BppOSubstitutionModelFormat:

Public Member Functions

 BppOSubstitutionModelFormat (unsigned char alphabetCode, bool allowCovarions, bool allowMixed, bool allowGaps, bool verbose, int warn)
 Create a new BppOSubstitutionModelFormat object. More...
 
 BppOSubstitutionModelFormat (const BppOSubstitutionModelFormat &format)
 
BppOSubstitutionModelFormatoperator= (const BppOSubstitutionModelFormat &format)
 
virtual ~BppOSubstitutionModelFormat ()
 
const std::string getFormatName () const
 
const std::string getFormatDescription () const
 
void setGeneticCode (const GeneticCode *gCode)
 Set the genetic code to use in case a codon frequencies set should be built. More...
 
SubstitutionModelread (const Alphabet *alphabet, const std::string &modelDescription, const SiteContainer *data=0, bool parseArguments=true)
 Read a substitution model from a string. More...
 
const std::map< std::string, std::string > & getUnparsedArguments () const
 
void write (const SubstitutionModel &model, OutputStream &out, std::map< std::string, std::string > &globalAliases, std::vector< std::string > &writtenNames) const
 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 ALL = 1 | 2 | 4 | 8 | 16 | 32
 

Private Member Functions

MixedSubstitutionModelreadMixed_ (const Alphabet *alphabet, const std::string &modelDescription, const SiteContainer *data)
 
SubstitutionModelreadWord_ (const Alphabet *alphabet, const std::string &modelDescription, const SiteContainer *data)
 
void initialize_ (SubstitutionModel &model, const SiteContainer *data) throw (Exception)
 Set parameter initial values of a given model according to options. More...
 
void writeMixed_ (const MixedSubstitutionModel &model, OutputStream &out, std::map< std::string, std::string > &globalAliases, std::vector< std::string > &writtenNames) const
 

Private Attributes

unsigned char alphabetCode_
 
bool allowCovarions_
 
bool allowMixed_
 
bool allowGaps_
 
bool verbose_
 
std::map< std::string, std::string > unparsedArguments_
 
const GeneticCode * geneticCode_
 
int warningLevel_
 

Detailed Description

Substitution model I/O in BppO format.

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

Definition at line 59 of file BppOSubstitutionModelFormat.h.

Constructor & Destructor Documentation

◆ BppOSubstitutionModelFormat() [1/2]

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

Create a new BppOSubstitutionModelFormat 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 94 of file BppOSubstitutionModelFormat.h.

◆ BppOSubstitutionModelFormat() [2/2]

bpp::BppOSubstitutionModelFormat::BppOSubstitutionModelFormat ( const BppOSubstitutionModelFormat format)
inline

Definition at line 105 of file BppOSubstitutionModelFormat.h.

◆ ~BppOSubstitutionModelFormat()

virtual bpp::BppOSubstitutionModelFormat::~BppOSubstitutionModelFormat ( )
inlinevirtual

Definition at line 129 of file BppOSubstitutionModelFormat.h.

Member Function Documentation

◆ getDataType()

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

Definition at line 69 of file IoSubstitutionModel.h.

◆ getFormatDescription()

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

Definition at line 134 of file BppOSubstitutionModelFormat.h.

◆ getFormatName()

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

Definition at line 132 of file BppOSubstitutionModelFormat.h.

◆ getUnparsedArguments()

const std::map<std::string, std::string>& bpp::BppOSubstitutionModelFormat::getUnparsedArguments ( ) const
inlinevirtual
Returns
The arguments and their unparsed values from the last call of the read function, if there are any.

Implements bpp::ISubstitutionModel.

Definition at line 147 of file BppOSubstitutionModelFormat.h.

References unparsedArguments_.

Referenced by read(), readMixed_(), readWord_(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().

◆ initialize_()

void BppOSubstitutionModelFormat::initialize_ ( SubstitutionModel model,
const SiteContainer *  data 
)
throw (Exception
)
private

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 SiteContainer 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 occured.

Definition at line 1298 of file BppOSubstitutionModelFormat.cpp.

◆ operator=()

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

◆ read()

SubstitutionModel * BppOSubstitutionModelFormat::read ( const Alphabet *  alphabet,
const std::string &  modelDescription,
const SiteContainer *  data = 0,
bool  parseArguments = true 
)
virtual

Read a substitution model from a string.

Parameters
alphabetThe alpabet to use in the model.
modelDescriptionA string describing the model in the format.
dataA pointer toward a SiteContainer, which can be used to initial some parmaeters like frequencies.
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 occured.

Implements bpp::ISubstitutionModel.

Definition at line 131 of file BppOSubstitutionModelFormat.cpp.

References bpp::BppOFrequenciesSetFormat::ALL, bpp::BppOFrequenciesSetFormat::getUnparsedArguments(), getUnparsedArguments(), bpp::BppOFrequenciesSetFormat::read(), read(), bpp::SubstitutionModel::setFreqFromData(), and bpp::BppOFrequenciesSetFormat::setGeneticCode().

Referenced by bpp::PhylogeneticsApplicationTools::getSubstitutionModel(), read(), readMixed_(), readWord_(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().

◆ readMixed_()

MixedSubstitutionModel * BppOSubstitutionModelFormat::readMixed_ ( const Alphabet *  alphabet,
const std::string &  modelDescription,
const SiteContainer *  data 
)
private

◆ readWord_()

SubstitutionModel * BppOSubstitutionModelFormat::readWord_ ( const Alphabet *  alphabet,
const std::string &  modelDescription,
const SiteContainer *  data 
)
private

◆ setGeneticCode()

void bpp::BppOSubstitutionModelFormat::setGeneticCode ( const GeneticCode *  gCode)
inline

Set the genetic code to use in case a codon frequencies set should be built.

Parameters
gCodeThe genetic code to use.

Definition at line 141 of file BppOSubstitutionModelFormat.h.

References geneticCode_.

Referenced by bpp::PhylogeneticsApplicationTools::getSubstitutionModel(), and bpp::PhylogeneticsApplicationTools::setSubstitutionModelSet().

◆ setVerbose()

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

◆ write()

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

◆ writeMixed_()

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

Member Data Documentation

◆ ALL

◆ allowCovarions_

bool bpp::BppOSubstitutionModelFormat::allowCovarions_
private

Definition at line 75 of file BppOSubstitutionModelFormat.h.

Referenced by operator=().

◆ allowGaps_

bool bpp::BppOSubstitutionModelFormat::allowGaps_
private

Definition at line 77 of file BppOSubstitutionModelFormat.h.

Referenced by operator=().

◆ allowMixed_

bool bpp::BppOSubstitutionModelFormat::allowMixed_
private

Definition at line 76 of file BppOSubstitutionModelFormat.h.

Referenced by operator=().

◆ alphabetCode_

unsigned char bpp::BppOSubstitutionModelFormat::alphabetCode_
private

Definition at line 74 of file BppOSubstitutionModelFormat.h.

Referenced by operator=().

◆ BINARY

unsigned char BppOSubstitutionModelFormat::BINARY = 32
static

Definition at line 70 of file BppOSubstitutionModelFormat.h.

◆ CODON

unsigned char BppOSubstitutionModelFormat::CODON = 8
static

Definition at line 68 of file BppOSubstitutionModelFormat.h.

◆ DNA

unsigned char BppOSubstitutionModelFormat::DNA = 1
static

Definition at line 64 of file BppOSubstitutionModelFormat.h.

◆ geneticCode_

const GeneticCode* bpp::BppOSubstitutionModelFormat::geneticCode_
private

Definition at line 80 of file BppOSubstitutionModelFormat.h.

Referenced by operator=(), and setGeneticCode().

◆ NUCLEOTIDE

unsigned char BppOSubstitutionModelFormat::NUCLEOTIDE = 1 | 2
static

Definition at line 66 of file BppOSubstitutionModelFormat.h.

◆ PROTEIN

unsigned char BppOSubstitutionModelFormat::PROTEIN = 4
static

Definition at line 67 of file BppOSubstitutionModelFormat.h.

◆ RNA

unsigned char BppOSubstitutionModelFormat::RNA = 2
static

Definition at line 65 of file BppOSubstitutionModelFormat.h.

◆ unparsedArguments_

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

Definition at line 79 of file BppOSubstitutionModelFormat.h.

Referenced by getUnparsedArguments(), and operator=().

◆ verbose_

bool bpp::BppOSubstitutionModelFormat::verbose_
private

Definition at line 78 of file BppOSubstitutionModelFormat.h.

Referenced by operator=(), and setVerbose().

◆ warningLevel_

int bpp::BppOSubstitutionModelFormat::warningLevel_
private

Definition at line 81 of file BppOSubstitutionModelFormat.h.

Referenced by operator=().

◆ WORD

unsigned char BppOSubstitutionModelFormat::WORD = 16
static

Definition at line 69 of file BppOSubstitutionModelFormat.h.


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