A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DefaultTreeNewickWriter Class Reference

#include <genesis/tree/default/newick_writer.hpp>

Inherits NewickWriter, and DefaultTreeNewickWriterPlugin.

Detailed Description

Write default Newick trees, i.e., trees with names and branch lengths.

This class is a convenience wrapper that combines a NewickWriter with a DefaultTreeNewickWriterPlugin. It is intended to be used for standard use cases, and writes a Newick tree from a Tree with DefaultNodeData and DefaultEdgeData at its nodes and edges.

It is also possible to register additional plugins on top of this class.

Behind the curtain, this class derives from both NewickWriter and DefaultTreeNewickWriterPlugin. This is a bit ugly, but we use it for simplicity. This allows to use an instance as if it was a writer (i.e., call to_... functions), but also change the plugin settings in a natural way.

Definition at line 351 of file tree/default/newick_writer.hpp.

Public Member Functions

 DefaultTreeNewickWriter ()
 
- Public Member Functions inherited from NewickWriter
 NewickWriter ()=default
 
 NewickWriter (NewickWriter const &)=default
 
 NewickWriter (NewickWriter &&)=default
 
virtual ~NewickWriter ()=default
 
NewickWriteroperator= (NewickWriter const &)=default
 
NewickWriteroperator= (NewickWriter &&)=default
 
NewickWriterquotation_marks (char value)
 Set the type of quotation marks used for node names that contain special characters. More...
 
char quotation_marks () const
 Get the currently set type of quotation marks used for node names. More...
 
void to_file (Tree const &tree, std::string const &filename) const
 Writes the tree to a file in Newick format. More...
 
void to_string (Tree const &tree, std::string &ts) const
 Gives a Newick string representation of the tree. More...
 
std::string to_string (Tree const &tree) const
 Returns a Newick string representation of the tree. More...
 
NewickWriterwrite_comments (bool value)
 Set whether to write Newick comments (e.g., some forms of bootstrap values). More...
 
bool write_comments () const
 Get whether Newick comments (e.g., some forms of bootstrap values) are written. More...
 
NewickWriterwrite_names (bool value)
 Set whether to write Newick node names. More...
 
bool write_names () const
 Get whether Newick node names are written. More...
 
NewickWriterwrite_tags (bool value)
 Set whether to write Newick tags (e.g., for jplace files). More...
 
bool write_tags () const
 Get whether Newick tags (e.g., for jplace files) are written. More...
 
NewickWriterwrite_values (bool value)
 Set whether to write Newick values (e.g., branch lengths). More...
 
bool write_values () const
 Get whether Newick values (e.g., branch lengths) are written. More...
 
- Public Member Functions inherited from DefaultTreeNewickWriterPlugin
 DefaultTreeNewickWriterPlugin ()=default
 
 DefaultTreeNewickWriterPlugin (DefaultTreeNewickWriterPlugin const &)=default
 
 DefaultTreeNewickWriterPlugin (DefaultTreeNewickWriterPlugin &&)=default
 
virtual ~DefaultTreeNewickWriterPlugin ()=default
 
int branch_length_precision () const
 Get the currently set maximum precision (in number of digits) used for printing the branch_length floating point numbers. More...
 
self_typebranch_length_precision (int value)
 Set the maximum precision (in number of digits) used for printing the branch_length floating point numbers. More...
 
std::string const & default_inner_name () const
 Get the named used to filter out an inner node name. More...
 
self_typedefault_inner_name (std::string const &value)
 Set the named used to filter out an inner node name. More...
 
std::string const & default_leaf_name () const
 Get the named used to filter out a leaf node name. More...
 
self_typedefault_leaf_name (std::string const &value)
 Set the named used to filter out a leaf node name. More...
 
std::string const & default_root_name () const
 Get the named used to filter out the root node name. More...
 
self_typedefault_root_name (std::string const &value)
 Set the named used to filter out the root node name. More...
 
void edge_to_element (TreeEdge const &edge, NewickBrokerElement &element) const
 
self_typeenable_branch_lengths (bool value)
 Set whether to write branch lengths. More...
 
bool enable_branch_lengths () const
 Get whether currently any branch lengths are written. More...
 
self_typeenable_names (bool value)
 Set whether to write node names at all. More...
 
bool enable_names () const
 Get whether currently any node names are written at all. More...
 
void node_to_element (TreeNode const &node, NewickBrokerElement &element) const
 
DefaultTreeNewickWriterPluginoperator= (DefaultTreeNewickWriterPlugin const &)=default
 
DefaultTreeNewickWriterPluginoperator= (DefaultTreeNewickWriterPlugin &&)=default
 
void register_with (NewickWriter &writer) const
 
bool replace_name_spaces () const
 Return whether currently this plugin replaces spaces with underscores. More...
 
self_typereplace_name_spaces (bool value)
 Set whether to replace all spaces (' ') in names with underscores ('_'). More...
 
self_typeset_default_names (std::string const &value)
 Shorthand to set the default names for leaf, inner and root node at once, to one value. More...
 
bool use_default_names () const
 Return whether currently default names are activated in this plugin. More...
 
self_typeuse_default_names (bool value)
 Set whether to replace default named nodes with an empty string. More...
 

Additional Inherited Members

- Public Types inherited from NewickWriter
using edge_to_element_function = std::function< void(TreeEdge const &edge, NewickBrokerElement &element) >
 Function type that translates from a TreeEdge to a NewickBrokerElement. More...
 
using finish_writing_function = std::function< void(Tree const &tree, NewickBroker &broker) >
 Function type that allows to do some finalizing work with the Tree and NewickBroker after the actual tree writing finished. More...
 
using node_to_element_function = std::function< void(TreeNode const &node, NewickBrokerElement &element) >
 Function type that translates from a TreeNode to a NewickBrokerElement. More...
 
using prepare_writing_function = std::function< void(Tree const &tree, NewickBroker &broker) >
 Function type that allows to do some preparatory work with the Tree and NewickBroker before the actual tree writing begins. More...
 
- Public Types inherited from DefaultTreeNewickWriterPlugin
using self_type = DefaultTreeNewickWriterPlugin
 
- Public Attributes inherited from NewickWriter
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 representation. More...
 
std::vector
< finish_writing_function
finish_writing_plugins
 Collect all functions to be called after finishing the actual tree writing. More...
 
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 representation. More...
 
std::vector
< prepare_writing_function
prepare_writing_plugins
 Collect all functions to be called before starting the actual tree writing. More...
 

Constructor & Destructor Documentation

Definition at line 361 of file tree/default/newick_writer.hpp.


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