bpp-phyl  2.2.0
bpp::PhylogeneticsApplicationTools Class Reference

This class provides some common tools for applications. More...

#include <Bpp/Phyl/App/PhylogeneticsApplicationTools.h>

Public Member Functions

 PhylogeneticsApplicationTools ()
 
virtual ~PhylogeneticsApplicationTools ()
 

Static Public Member Functions

static TreegetTree (std::map< std::string, std::string > &params, const std::string &prefix="input.", const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1) throw (Exception)
 Build a Tree object according to options. More...
 
static std::vector< Tree * > getTrees (std::map< std::string, std::string > &params, const std::string &prefix="input.", const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1) throw (Exception)
 Build a list ofTree objects according to options. More...
 
static SubstitutionModelgetSubstitutionModel (const Alphabet *alphabet, const GeneticCode *gCode, const SiteContainer *data, std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1) throw (Exception)
 Build a SubstitutionModel object according to options. More...
 
static void setSubstitutionModelParametersInitialValuesWithAliases (SubstitutionModel &model, std::map< std::string, std::string > &unparsedParameterValues, size_t modelNumber, const SiteContainer *data, std::map< std::string, double > &existingParams, std::map< std::string, std::string > &sharedParams, bool verbose) throw (Exception)
 Set parameter initial values of a given model in a set according to options. More...
 
static FrequenciesSetgetRootFrequenciesSet (const Alphabet *alphabet, const GeneticCode *gCode, const SiteContainer *data, std::map< std::string, std::string > &params, const std::vector< double > &rateFreqs, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1) throw (Exception)
 Get A FrequenciesSet object for root frequencies (NH models) according to options. More...
 
static FrequenciesSetgetFrequenciesSet (const Alphabet *alphabet, const GeneticCode *gCode, const std::string &freqDescription, const SiteContainer *data, const std::vector< double > &rateFreqs, bool verbose=true, int warn=1) throw (Exception)
 Get A FrequenciesSet object according to options. More...
 
static SubstitutionModelSetgetSubstitutionModelSet (const Alphabet *alphabet, const GeneticCode *gcode, const SiteContainer *data, std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1)
 Gets a SubstitutionModelSet object according to options. More...
 
static void setSubstitutionModelSet (SubstitutionModelSet &modelSet, const Alphabet *alphabet, const GeneticCode *gcode, const SiteContainer *data, std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1)
 Sets a SubstitutionModelSet object according to options. More...
 
static void completeMixedSubstitutionModelSet (MixedSubstitutionModelSet &mixedModelSet, const Alphabet *alphabet, const SiteContainer *data, std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1)
 Complete a MixedSubstitutionModelSet object according to options, given this model has already been filled through setSubstitutionModelSet method. More...
 
static MultipleDiscreteDistribution * getMultipleDistributionDefaultInstance (const std::string &distDescription, std::map< std::string, std::string > &unparsedParameterValues, bool verbose=true)
 Build a multi-dimension distribution as a MultipleDiscreteDistribution object with default parameter values according to a keyval description. More...
 
static DiscreteDistribution * getRateDistribution (std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true) throw (Exception)
 Build a DiscreteDistribution object according to options. More...
 
static TreeLikelihoodoptimizeParameters (TreeLikelihood *tl, const ParameterList &parameters, std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1) throw (Exception)
 Optimize parameters according to options. More...
 
static void optimizeParameters (DiscreteRatesAcrossSitesClockTreeLikelihood *tl, const ParameterList &parameters, std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1) throw (Exception)
 Optimize parameters according to options, with a molecular clock. More...
 
static void checkEstimatedParameters (const ParameterList &pl)
 Check if parameter values are close to their definition boundary. More...
 
static SubstitutionCountgetSubstitutionCount (const Alphabet *alphabet, const SubstitutionModel *model, map< string, string > &params, string suffix="", bool verbose=true, int warn=1)
 Get a SubstitutionCount instance. More...
 
static void writeTree (const TreeTemplate< Node > &tree, std::map< std::string, std::string > &params, const std::string &prefix="output.", const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, bool checkOnly=false, int warn=1) throw (Exception)
 Write a tree according to options. More...
 
static void writeTrees (const std::vector< Tree *> &trees, std::map< std::string, std::string > &params, const std::string &prefix="output.", const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, bool checkOnly=false, int warn=1) throw (Exception)
 Write a tree according to options. More...
 
static void printParameters (const SubstitutionModel *model, OutputStream &out, int warn=1)
 Output a SubstitutionModel description to a file. More...
 
static void printParameters (const SubstitutionModelSet *modelSet, OutputStream &out, int warn=1)
 Output a SubstitutionModelSet description to a file. More...
 
static void printParameters (const DiscreteDistribution *rDist, OutputStream &out)
 Output a DiscreteDistribution description to a file. More...
 

Detailed Description

This class provides some common tools for applications.

The functions parse some option file, create corresponding objects and send a pointer toward it.

The option files are supposed to follow this simple format:

parameterName = parameterContent

with one parameter per line.

See also
ApplicationTools

Definition at line 85 of file PhylogeneticsApplicationTools.h.

Constructor & Destructor Documentation

◆ PhylogeneticsApplicationTools()

bpp::PhylogeneticsApplicationTools::PhylogeneticsApplicationTools ( )

◆ ~PhylogeneticsApplicationTools()

virtual bpp::PhylogeneticsApplicationTools::~PhylogeneticsApplicationTools ( )
virtual

Member Function Documentation

◆ checkEstimatedParameters()

void PhylogeneticsApplicationTools::checkEstimatedParameters ( const ParameterList &  pl)
static

Check if parameter values are close to their definition boundary.

This allows the detection of potential optimization issues. A warning message will be output for each problematic parameter.

Parameters
plA list of parameters. Parameters without constraint will be ignored.

Definition at line 1333 of file PhylogeneticsApplicationTools.cpp.

◆ completeMixedSubstitutionModelSet()

void PhylogeneticsApplicationTools::completeMixedSubstitutionModelSet ( MixedSubstitutionModelSet mixedModelSet,
const Alphabet *  alphabet,
const SiteContainer *  data,
std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
static

Complete a MixedSubstitutionModelSet object according to options, given this model has already been filled through setSubstitutionModelSet method.

In addition, this method builds the allowed combinations of submodels of the different mixed models.

If none combination is given, then all possible submodels combinations will be considered.

The submodels dependencies are given a sets of combinations of the mixed variables of the mixed models. For instance, if we have:

model1=MixedModel(model=T92(kappa=Gamma(n=4), theta=0.5))
model2=MixedModel(model=T92(kappa=Gaussian(n=5), theta=Beta(n=3)))

In this case model1 is a mixture of 4 T92 submodels and model2 a mixture of 15 T92 submodels. These submodels are denoted with the parameter name and the class number. For example, the submodels of model1 are denoted model1[kappa_1], ..., model1[kappa_4], and the submodels of model2 are denoted model2[kappa_1,theta_1], ..., model2[kappa_5, theta_3]. Additionnaly, for instance, model2[kappa_2] denotes all the submodels whose description has kappa_2.

By default, when switching from model1 to model2, a site is allowed to switch between any submodel of model1 and any submodel of model2. If the only allowed combination is that a site follows submodels model1(kappa_1) and model2(kappa_3,theta_2), it is denoted:

site.allowedpaths= model1[kappa_1] & model2[kappa_3,theta_2]

With additional combination saying that a site can follow submodels model1[kappa_2] and any submodel of model2[kappa_3] is denoted:

site.allowedpaths= model1[kappa_1] & model2[kappa_3,theta_2] |
model1[kappa_2] & model2[kappa_3]

See MixedSubstitutionModelSet description for further information.

Parameters
mixedModelSetThe modified MixedSubstitutionModelSet object according to options specified.
alphabetThe alpabet to use in all models.
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 cas use_observed_freq option will be unavailable.
paramsThe attribute map where options may be found.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Exceptions
Exceptionif an error occured.

Definition at line 521 of file PhylogeneticsApplicationTools.cpp.

References bpp::MixedSubstitutionModelSet::addEmptyHyperNode(), bpp::MixedSubstitutionModelSet::addToHyperNode(), bpp::MixedSubstitutionModelSet::complete(), bpp::MixedSubstitutionModelSet::computeHyperNodesProbabilities(), bpp::MixedSubstitutionModelSet::getHyperNode(), bpp::SubstitutionModelSet::getModel(), bpp::MixedSubstitutionModelSet::getNumberOfHyperNodes(), bpp::MixedSubstitutionModel::getSubmodelNumbers(), and bpp::MixedSubstitutionModelSet::hasExclusivePaths().

◆ getFrequenciesSet()

FrequenciesSet * PhylogeneticsApplicationTools::getFrequenciesSet ( const Alphabet *  alphabet,
const GeneticCode *  gCode,
const std::string &  freqDescription,
const SiteContainer *  data,
const std::vector< double > &  rateFreqs,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Get A FrequenciesSet object according to options.

Parameters
alphabetThe alpabet to use.
gCodeThe genetic code to use (only for codon alphabets, otherwise can be set to 0). If set to NULL and a codon frequencies set is requested, an Exception will be thrown.
freqDescriptionA string in the keyval syntaxe describing the frequency set to use.:if expand("%") == ""|browse confirm w|else|confirm w|endif
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 cas use_observed_freq option will be unavailable.
rateFreqsA vector of rate catégories frequencies in case of a Markov Modulated Markov Model. Ignored if a vector with size 0 is passed.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Returns
A new FrequenciesSet object according to options specified.
Exceptions
Exceptionif an error occured.

Definition at line 313 of file PhylogeneticsApplicationTools.cpp.

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

◆ getMultipleDistributionDefaultInstance()

MultipleDiscreteDistribution * PhylogeneticsApplicationTools::getMultipleDistributionDefaultInstance ( const std::string &  distDescription,
std::map< std::string, std::string > &  unparsedParameterValues,
bool  verbose = true 
)
static

Build a multi-dimension distribution as a MultipleDiscreteDistribution object with default parameter values according to a keyval description.

Check the Bio++ Program Suite documentation for a description of the syntax. It is mainly for internal usage, you're probably looking for the getRateDistribution function.

Parameters
distDescriptionA string describing the model in the keyval syntax.
unparsedParameterValues[out] a map that will contain all the distribution parameters names and their corresponding unparsed value, if they were found.
verbosePrint some info to the 'message' output stream.
Returns
A new MultipleDiscreteDistribution object according to options specified.
Exceptions
Exceptionif an error occured.

Definition at line 615 of file PhylogeneticsApplicationTools.cpp.

◆ getRateDistribution()

DiscreteDistribution * PhylogeneticsApplicationTools::getRateDistribution ( std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true 
)
throw (Exception
)
static

Build a DiscreteDistribution object according to options.

Creates a new rate distribution object according to distribution description syntax (see the Bio++ Progam Suite manual for a detailed description of this syntax). The function also parses the parameter values and set them accordingly.

Parameters
paramsThe attribute map where options may be found.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
Returns
A new DiscreteDistribution object according to options specified.
Exceptions
Exceptionif an error occured.

Definition at line 661 of file PhylogeneticsApplicationTools.cpp.

References bpp::BppORateDistributionFormat::read().

◆ getRootFrequenciesSet()

FrequenciesSet * PhylogeneticsApplicationTools::getRootFrequenciesSet ( const Alphabet *  alphabet,
const GeneticCode *  gCode,
const SiteContainer *  data,
std::map< std::string, std::string > &  params,
const std::vector< double > &  rateFreqs,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Get A FrequenciesSet object for root frequencies (NH models) according to options.

Parameters
alphabetThe alpabet to use.
gCodeThe genetic code to use (only for codon alphabets, otherwise can be set to 0). If set to NULL and a codon frequencies set is requested, an Exception will be thrown.
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 cas use_observed_freq option will be unavailable.
paramsThe attribute map where options may be found.
rateFreqsA vector of rate catégories frequencies in case of a Markov Modulated Markov Model. Ignored if a vector with size 0 is passed.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Returns
A new FrequenciesSet object according to options specified.
Exceptions
Exceptionif an error occured.

Definition at line 286 of file PhylogeneticsApplicationTools.cpp.

References bpp::FrequenciesSet::getName().

◆ getSubstitutionCount()

SubstitutionCount * PhylogeneticsApplicationTools::getSubstitutionCount ( const Alphabet *  alphabet,
const SubstitutionModel model,
map< string, string > &  params,
string  suffix = "",
bool  verbose = true,
int  warn = 1 
)
static

Get a SubstitutionCount instance.

Parameters
alphabetThe alphabet to use.
modelThe model to use.
paramsThe attribute map where options may be found.
suffixOptional suffix for command name.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Returns
A SubstitutionCount object.

Definition at line 1493 of file PhylogeneticsApplicationTools.cpp.

◆ getSubstitutionModel()

SubstitutionModel * PhylogeneticsApplicationTools::getSubstitutionModel ( const Alphabet *  alphabet,
const GeneticCode *  gCode,
const SiteContainer *  data,
std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Build a SubstitutionModel object according to options.

Creates a new substitution model object according to model description syntax (see the Bio++ Progam Suite manual for a detailed description of this syntax). The function also parses the parameter values and set them accordingly.

Parameters
alphabetThe alphabet to use in the model.
gCodeThe genetic code to use (only for codon models, otherwise can be set to 0). If set to NULL and a codon model is requested, an Exception will be thrown.
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.
paramsThe attribute map where options may be found.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Returns
A new SubstitutionModel object according to options specified.
Exceptions
Exceptionif an error occured.

Definition at line 165 of file PhylogeneticsApplicationTools.cpp.

References bpp::BppOSubstitutionModelFormat::ALL, bpp::BppOSubstitutionModelFormat::read(), and bpp::BppOSubstitutionModelFormat::setGeneticCode().

◆ getSubstitutionModelSet()

SubstitutionModelSet * PhylogeneticsApplicationTools::getSubstitutionModelSet ( const Alphabet *  alphabet,
const GeneticCode *  gcode,
const SiteContainer *  data,
std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
static

Gets a SubstitutionModelSet object according to options.

See setSubstitutionModelSet and setMixedSubstitutionModelSet methods.

Definition at line 346 of file PhylogeneticsApplicationTools.cpp.

References bpp::SubstitutionModelSet::hasMixedSubstitutionModel().

◆ getTree()

Tree * PhylogeneticsApplicationTools::getTree ( std::map< std::string, std::string > &  params,
const std::string &  prefix = "input.",
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Build a Tree object according to options.

See the Bio++ Program Suite manual for a description of available options.

Parameters
paramsThe attribute map where options may be found.
prefixA prefix to be applied to each attribute name.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Returns
A new Tree object according to the specified options.
Exceptions
Exceptionif an error occured.

Definition at line 96 of file PhylogeneticsApplicationTools.cpp.

References bpp::ITree::read().

◆ getTrees()

vector< Tree * > PhylogeneticsApplicationTools::getTrees ( std::map< std::string, std::string > &  params,
const std::string &  prefix = "input.",
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Build a list ofTree objects according to options.

See the Bio++ Program Suite manual for a description of available options.

Parameters
paramsThe attribute map where options may be found.
prefixA prefix to be applied to each attribute name.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Returns
A new vector of Tree objects according to the specified options.
Exceptions
Exceptionif an error occured.

Definition at line 126 of file PhylogeneticsApplicationTools.cpp.

References bpp::IMultiTree::read().

◆ optimizeParameters() [1/2]

TreeLikelihood * PhylogeneticsApplicationTools::optimizeParameters ( TreeLikelihood tl,
const ParameterList &  parameters,
std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Optimize parameters according to options.

Parameters
tlThe TreeLikelihood function to optimize.
parametersThe initial list of parameters to optimize. Use tl->getIndependentParameters() in order to estimate all parameters.
paramsThe attribute map where options may be found.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Exceptions
ExceptionAny exception that may happen during the optimization process.
Returns
A pointer toward the final likelihood object. This pointer may be the same as passed in argument (tl), but in some cases the algorithm clone this object. We may change this bahavior in the future... You hence should write something like

optimization options

Definition at line 692 of file PhylogeneticsApplicationTools.cpp.

References bpp::NNITopologySearch::BETTER, bpp::NNITopologySearch::FAST, bpp::NonHomogeneousTreeLikelihood::getRootFrequenciesParameters(), bpp::OptimizationTools::OPTIMIZATION_BFGS, bpp::OptimizationTools::OPTIMIZATION_BRENT, bpp::OptimizationTools::OPTIMIZATION_GRADIENT, bpp::OptimizationTools::OPTIMIZATION_NEWTON, bpp::OptimizationTools::optimizeNumericalParameters(), bpp::OptimizationTools::optimizeNumericalParameters2(), bpp::OptimizationTools::optimizeTreeNNI(), bpp::OptimizationTools::optimizeTreeNNI2(), bpp::OptimizationTools::optimizeTreeScale(), and bpp::NNITopologySearch::PHYML.

◆ optimizeParameters() [2/2]

void PhylogeneticsApplicationTools::optimizeParameters ( DiscreteRatesAcrossSitesClockTreeLikelihood tl,
const ParameterList &  parameters,
std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
throw (Exception
)
static

Optimize parameters according to options, with a molecular clock.

Parameters
tlThe ClockTreeLikelihood function to optimize.
parametersThe initial list of parameters to optimize. Use tl->getIndependentParameters() in order to estimate all parameters.
paramsThe attribute map where options may be found.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Exceptions
ExceptionAny exception that may happen during the optimization process.

Definition at line 1110 of file PhylogeneticsApplicationTools.cpp.

References bpp::NonHomogeneousTreeLikelihood::getRootFrequenciesParameters(), bpp::OptimizationTools::OPTIMIZATION_GRADIENT, bpp::OptimizationTools::OPTIMIZATION_NEWTON, bpp::OptimizationTools::optimizeNumericalParametersWithGlobalClock(), and bpp::OptimizationTools::optimizeNumericalParametersWithGlobalClock2().

◆ printParameters() [1/3]

void PhylogeneticsApplicationTools::printParameters ( const SubstitutionModel model,
OutputStream &  out,
int  warn = 1 
)
static

Output a SubstitutionModel description to a file.

Parameters
modelThe model to serialize.
outThe stream where to print.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).

Definition at line 1411 of file PhylogeneticsApplicationTools.cpp.

References bpp::BppOSubstitutionModelFormat::ALL, and bpp::BppOSubstitutionModelFormat::write().

◆ printParameters() [2/3]

void PhylogeneticsApplicationTools::printParameters ( const SubstitutionModelSet modelSet,
OutputStream &  out,
int  warn = 1 
)
static

Output a SubstitutionModelSet description to a file.

Parameters
modelSetThe model set to serialize.
outThe stream where to print.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).

Definition at line 1423 of file PhylogeneticsApplicationTools.cpp.

References bpp::BppOFrequenciesSetFormat::ALL, bpp::BppOSubstitutionModelFormat::ALL, bpp::SubstitutionModelSet::getModel(), bpp::SubstitutionModelSet::getNodesWithModel(), bpp::SubstitutionModelSet::getNumberOfModels(), bpp::SubstitutionModelSet::getRootFrequenciesSet(), bpp::BppOFrequenciesSetFormat::write(), and bpp::BppOSubstitutionModelFormat::write().

◆ printParameters() [3/3]

void PhylogeneticsApplicationTools::printParameters ( const DiscreteDistribution *  rDist,
OutputStream &  out 
)
static

Output a DiscreteDistribution description to a file.

Parameters
rDistThe rate distribution to serialize.
outThe stream where to print.

Definition at line 1477 of file PhylogeneticsApplicationTools.cpp.

References bpp::BppORateDistributionFormat::write().

◆ setSubstitutionModelParametersInitialValuesWithAliases()

void PhylogeneticsApplicationTools::setSubstitutionModelParametersInitialValuesWithAliases ( SubstitutionModel model,
std::map< std::string, std::string > &  unparsedParameterValues,
size_t  modelNumber,
const SiteContainer *  data,
std::map< std::string, double > &  existingParams,
std::map< std::string, std::string > &  sharedParams,
bool  verbose 
)
throw (Exception
)
static

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

Parameters actually depends on the model passed as argument. See getSubstitutionModelSet 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.
unparsedParameterValuesA map that contains all the model parameters names and their corresponding unparsed value, if they were found.
modelNumberThe number of this model in the SubstitutionModelSet.
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.
existingParams(in/out) A map with already existing value that have been found in previous calls, and may be recalled here. New parameters found here will be added.
sharedParams(out) remote parameters will be recorded here.
verbosePrint some info to the 'message' output stream.
Exceptions
Exceptionif an error occured.

Definition at line 194 of file PhylogeneticsApplicationTools.cpp.

◆ setSubstitutionModelSet()

void PhylogeneticsApplicationTools::setSubstitutionModelSet ( SubstitutionModelSet modelSet,
const Alphabet *  alphabet,
const GeneticCode *  gcode,
const SiteContainer *  data,
std::map< std::string, std::string > &  params,
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
int  warn = 1 
)
static

Sets a SubstitutionModelSet object according to options.

This model set is meant to be used with non-homogeneous substitution models of sequence evolution.

Recognized options are:

Then, for each of the models, the following information must be provided:

  • model1='model name(parameters'='value',...) Model names and parameters follow the same syntaxe as for the getSubstitutionModel method.
  • model1.nodes='list of nodes id, separated by comas'. And then
  • model2=... etc.

All models must be fully specified, and at the end of the description, all nodes must be attributed to a model, otherwise an exception is thrown.

Finally, this is also allowed for models to share one or several parameters. for instance:

model1=T92(kappa=2.0, theta=0.5)
model2=T92(kappa=model1.kappa, theta=0.5)

In this case model1 and model2 with have their own and independent theta parameter, but only one kappa parameter will be used for both models. Note that

model1=T92(kappa=2.0, theta=0.5)
model1.nodes=1,2,3
model2=T92(kappa= model1.kappa, theta=model1.theta)
model2.nodes=4,5,6

is equivalent to

model1=T92(kappa=2.0, theta=0.5)
model1.nodes=1,2,3,4,5,6

but will require more memory and use more CPU, since some calculations will be performed twice.

Parameters
modelSetThe modified SubstitutionModelSet object according to options specified.
alphabetThe alpabet to use in all models.
gcodeThe genetic code to use (only for codon models, otherwise can be set to 0). If set to NULL and a codon model is requested, an Exception will be thrown.
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 cas use_observed_freq option will be unavailable.
paramsThe attribute map where options may be found.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Exceptions
Exceptionif an error occured.

Definition at line 390 of file PhylogeneticsApplicationTools.cpp.

References bpp::SubstitutionModelSet::addModel(), bpp::BppOSubstitutionModelFormat::ALL, bpp::SubstitutionModelSet::clear(), bpp::BppOSubstitutionModelFormat::getUnparsedArguments(), bpp::BppOSubstitutionModelFormat::read(), bpp::BppOSubstitutionModelFormat::setGeneticCode(), bpp::SubstitutionModelSet::setRootFrequencies(), and bpp::BppOSubstitutionModelFormat::setVerbose().

◆ writeTree()

void PhylogeneticsApplicationTools::writeTree ( const TreeTemplate< Node > &  tree,
std::map< std::string, std::string > &  params,
const std::string &  prefix = "output.",
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
bool  checkOnly = false,
int  warn = 1 
)
throw (Exception
)
static

Write a tree according to options.

See the Bio++ Program Suite manual for a descriptio of all available options.

Parameters
treeThe tree to write.
paramsThe attribute map where options may be found.
prefixA prefix to be applied to each attribute name.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
checkOnlyIf this parameter is set to true, then all options are checked and error messages sent, but no file is written.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Exceptions
Exceptionif an error occured.

Definition at line 1351 of file PhylogeneticsApplicationTools.cpp.

References bpp::OTree::write().

◆ writeTrees()

void PhylogeneticsApplicationTools::writeTrees ( const std::vector< Tree *> &  trees,
std::map< std::string, std::string > &  params,
const std::string &  prefix = "output.",
const std::string &  suffix = "",
bool  suffixIsOptional = true,
bool  verbose = true,
bool  checkOnly = false,
int  warn = 1 
)
throw (Exception
)
static

Write a tree according to options.

See the Bio++ Program Suite manual for a descriptio of all available options.

Parameters
treesThe trees to write.
paramsThe attribute map where options may be found.
prefixA prefix to be applied to each attribute name.
suffixA suffix to be applied to each attribute name.
suffixIsOptionalTell if the suffix is absolutely required.
verbosePrint some info to the 'message' output stream.
checkOnlyIf this parameter is set to true, then all options are checked and error messages sent, but no file is written.
warnSet the warning level (0: always display warnings, >0 display warnings on demand).
Exceptions
Exceptionif an error occured.

Definition at line 1381 of file PhylogeneticsApplicationTools.cpp.

References bpp::OMultiTree::write().


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