|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_COMMON_TREE_NEWICK_WRITER_H_
2 #define GENESIS_TREE_COMMON_TREE_NEWICK_WRITER_H_
83 return default_leaf_name_;
91 default_leaf_name_ = value;
100 return default_inner_name_;
108 default_inner_name_ = value;
117 return default_root_name_;
125 default_root_name_ = value;
135 default_leaf_name_ = value;
136 default_inner_name_ = value;
137 default_root_name_ = value;
148 return use_default_names_;
175 use_default_names_ = value;
186 return replace_name_spaces_;
200 replace_name_spaces_ = value;
211 enable_names_ = value;
220 return enable_names_;
228 enable_branch_lengths_ = value;
237 return enable_branch_lengths_;
246 return branch_length_precision_;
257 branch_length_precision_ = value;
271 if( replace_name_spaces_ ) {
276 if( use_default_names_ && (
277 (
is_leaf( node ) && name == default_leaf_name_ ) ||
278 (
is_inner( node ) && name == default_inner_name_ ) ||
279 (
is_root( node ) && name == default_root_name_ )
290 if (enable_branch_lengths_) {
320 int branch_length_precision_ = 6;
322 std::string default_leaf_name_ =
"Leaf_Node";
323 std::string default_inner_name_ =
"Inner_Node";
324 std::string default_root_name_ =
"Root_Node";
326 bool use_default_names_ =
false;
327 bool replace_name_spaces_ =
true;
329 bool enable_names_ =
true;
330 bool enable_branch_lengths_ =
true;
371 #endif // include guard
virtual ~CommonTreeNewickWriterPlugin()=default
self_type & default_leaf_name(std::string const &value)
Set the named used to filter out a leaf node name.
self_type & enable_branch_lengths(bool value)
Set whether to write branch lengths.
std::string name
Name of the node.
std::string replace_all(std::string const &text, std::string const &search, std::string const &replace)
Return a copy of a string, where all occurrences of a search string are replaced by a replace string.
Write a Tree to Newick format.
bool enable_branch_lengths() const
Get whether currently any branch lengths are written.
bool is_inner(TreeLink const &link)
Return true iff the node of the given link is an inner node.
std::string to_string_rounded(double const value, int const precision)
Return a string representation of the input value, using the provided precision value (determining it...
std::string const & default_root_name() const
Get the named used to filter out the root node name.
int branch_length_precision() const
Get the currently set maximum precision (in number of digits) used for printing the branch_length flo...
Write default Newick trees, i.e., trees with names and branch lengths.
void node_to_element(TreeNode const &node, NewickBrokerElement &element) const
bool replace_name_spaces() const
Return whether currently this plugin replaces spaces with underscores.
self_type & set_default_names(std::string const &value)
Shorthand to set the default names for leaf, inner and root node at once, to one value.
Provides some valuable additions to STD.
std::vector< std::string > values
Numerical values associated with the node, i.e. branch lengths.
Provides some commonly used string utility functions.
bool is_root(TreeLink const &link)
Return whether the link belongs to the root node of its Tree.
std::string const & default_leaf_name() const
Get the named used to filter out a leaf node name.
self_type & use_default_names(bool value)
Set whether to replace default named nodes with an empty string.
std::vector< edge_to_element_function > edge_to_element_plugins
Collect all functions to be called for each TreeEdge in order to translate it to a Newick representat...
self_type & branch_length_precision(int value)
Set the maximum precision (in number of digits) used for printing the branch_length floating point nu...
void edge_to_element(TreeEdge const &edge, NewickBrokerElement &element) const
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
self_type & default_inner_name(std::string const &value)
Set the named used to filter out an inner node name.
self_type & replace_name_spaces(bool value)
Set whether to replace all spaces (' ') in names with underscores ('_').
bool use_default_names() const
Return whether currently default names are activated in this plugin.
self_type & enable_names(bool value)
Set whether to write node names at all.
Provide a set of plugin functions for NewickWriter to write a CommonTree.
Common class containing the commonly needed data for tree edges.
void register_with(NewickWriter &writer) const
Common class containing the commonly needed data for tree nodes.
std::string const & default_inner_name() const
Get the named used to filter out an inner node name.
bool enable_names() const
Get whether currently any node names are written at all.
bool is_leaf(TreeLink const &link)
Return true iff the node of the given link is a leaf node.
Store the information for one element of a Newick tree.
self_type & default_root_name(std::string const &value)
Set the named used to filter out the root node name.
CommonTreeNewickWriterPlugin & operator=(CommonTreeNewickWriterPlugin const &)=default
std::vector< node_to_element_function > node_to_element_plugins
Collect all functions to be called for each TreeNode in order to translate it to a Newick representat...
CommonTreeNewickWriterPlugin()=default