bpp-phyl3  3.0.0
PhylogeneticsApplicationTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_LEGACY_APP_PHYLOGENETICSAPPLICATIONTOOLS_H
6 #define BPP_PHYL_LEGACY_APP_PHYLOGENETICSAPPLICATIONTOOLS_H
7 
8 #include <Bpp/Io/OutputStream.h>
12 #include <Bpp/Text/TextTools.h>
13 
14 #include "../../Model/MarkovModulatedSubstitutionModel.h"
15 #include "../../Model/SubstitutionModel.h"
16 #include "../../Tree/Tree.h"
17 #include "../Likelihood/HomogeneousTreeLikelihood.h"
18 #include "../Model/MixedSubstitutionModelSet.h"
19 #include "../Model/SubstitutionModelSet.h"
20 
21 // From SeqLib:
26 
27 // From the STL:
28 #include <string>
29 #include <map>
30 #include <memory>
31 #include <vector>
32 
33 
34 namespace bpp
35 {
51 {
52 public:
55 
74  static std::map<size_t, std::shared_ptr<Tree>> getTrees(
75  const std::map<std::string, std::string>& params,
76  const std::map<size_t, std::shared_ptr<AlignmentDataInterface>>& mSeq,
77  std::map<std::string, std::string>& unparsedParams,
78  const std::string& prefix = "input.",
79  const std::string& suffix = "",
80  bool suffixIsOptional = true,
81  bool verbose = true,
82  int warn = 1);
83 
106  BranchModelInterface& model,
107  std::map<std::string, std::string>& unparsedParameterValues,
108  size_t modelNumber,
109  std::shared_ptr<const AlignmentDataInterface> data,
110  std::map<std::string, std::string>& sharedParams,
111  bool verbose);
112 
119  static std::unique_ptr<SubstitutionModelSet> getSubstitutionModelSet(
120  std::shared_ptr<const Alphabet> alphabet,
121  std::shared_ptr<const GeneticCode> gcode,
122  std::shared_ptr<const AlignmentDataInterface> data,
123  const std::map<std::string, std::string>& params,
124  const std::string& suffix = "",
125  bool suffixIsOptional = true,
126  bool verbose = true,
127  int warn = 1);
128 
129 
183  static void setSubstitutionModelSet(
184  SubstitutionModelSet& modelSet,
185  std::shared_ptr<const Alphabet> alphabet,
186  std::shared_ptr<const GeneticCode> gcode,
187  std::shared_ptr<const AlignmentDataInterface> data,
188  const std::map<std::string, std::string>& params,
189  const std::string& suffix = "",
190  bool suffixIsOptional = true,
191  bool verbose = true,
192  int warn = 1);
193 
257  MixedSubstitutionModelSet& mixedModelSet,
258  std::shared_ptr<const Alphabet> alphabet,
259  std::shared_ptr<const AlignmentDataInterface> data,
260  const std::map<std::string, std::string>& params,
261  const std::string& suffix = "",
262  bool suffixIsOptional = true,
263  bool verbose = true,
264  int warn = 1);
265 
285  static std::shared_ptr<TreeLikelihoodInterface> optimizeParameters(
286  std::shared_ptr<TreeLikelihoodInterface> tl,
287  const ParameterList& parameters,
288  const std::map<std::string, std::string>& params,
289  const std::string& suffix = "",
290  bool suffixIsOptional = true,
291  bool verbose = true,
292  int warn = 1);
293 
294 
312  static void writeTrees(
313  const std::vector<const Tree*>& trees,
314  const std::map<std::string, std::string>& params,
315  const std::string& prefix = "output.",
316  const std::string& suffix = "",
317  bool suffixIsOptional = true,
318  bool verbose = true,
319  bool checkOnly = false,
320  int warn = 1);
321 
322  static void writeTrees(
323  const std::vector<const TreeTemplate<Node>* >& trees,
324  const std::map<std::string, std::string>& params,
325  const std::string& prefix = "output.",
326  const std::string& suffix = "",
327  bool suffixIsOptional = true,
328  bool verbose = true,
329  bool checkOnly = false,
330  int warn = 1);
331 
342  static void printParameters(
343  const SubstitutionModelSet& modelSet,
344  OutputStream& out,
345  int warn = 1,
346  bool withAlias = true);
347 };
348 } // end of namespace bpp.
349 #endif // BPP_PHYL_LEGACY_APP_PHYLOGENETICSAPPLICATIONTOOLS_H
Interface for all Branch models.
This class provides some common tools for applications.
static void setSubstitutionModelParametersInitialValuesWithAliases(BranchModelInterface &model, std::map< std::string, std::string > &unparsedParameterValues, size_t modelNumber, std::shared_ptr< const AlignmentDataInterface > data, std::map< std::string, std::string > &sharedParams, bool verbose)
Set parameter initial values of a given model in a set according to options.
static std::map< size_t, std::shared_ptr< Tree > > getTrees(const std::map< std::string, std::string > &params, const std::map< size_t, std::shared_ptr< AlignmentDataInterface >> &mSeq, std::map< std::string, std::string > &unparsedParams, const std::string &prefix="input.", const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1)
Build a list ofTree objects according to options.
static void completeMixedSubstitutionModelSet(MixedSubstitutionModelSet &mixedModelSet, std::shared_ptr< const Alphabet > alphabet, std::shared_ptr< const AlignmentDataInterface > data, const 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 f...
static void writeTrees(const std::vector< const TreeTemplate< Node > * > &trees, const 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)
static std::unique_ptr< SubstitutionModelSet > getSubstitutionModelSet(std::shared_ptr< const Alphabet > alphabet, std::shared_ptr< const GeneticCode > gcode, std::shared_ptr< const AlignmentDataInterface > data, const 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.
static void setSubstitutionModelSet(SubstitutionModelSet &modelSet, std::shared_ptr< const Alphabet > alphabet, std::shared_ptr< const GeneticCode > gcode, std::shared_ptr< const AlignmentDataInterface > data, const 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.
static void writeTrees(const std::vector< const Tree * > &trees, const 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)
Write a tree according to options.
static void printParameters(const SubstitutionModelSet &modelSet, OutputStream &out, int warn=1, bool withAlias=true)
Output a SubstitutionModelSet description to a file.
static std::shared_ptr< TreeLikelihoodInterface > optimizeParameters(std::shared_ptr< TreeLikelihoodInterface > tl, const ParameterList &parameters, const std::map< std::string, std::string > &params, const std::string &suffix="", bool suffixIsOptional=true, bool verbose=true, int warn=1)
Optimize parameters according to options.
Substitution models manager for Mixed Substitution Models. This class inherits from SubstitutionModel...
Substitution models manager for non-homogeneous / non-reversible models of evolution.
The phylogenetic tree class.
Definition: TreeTemplate.h:59
Defines the basic types of data flow nodes.