#include <genesis/tree/common_tree/newick_writer.hpp>
Inherits NewickWriter, and CommonTreeNewickWriterPlugin.
Write default Newick trees, i.e., trees with names and branch lengths.
This class is a convenience wrapper that combines a NewickWriter with a CommonTreeNewickWriterPlugin. It is intended to be used for standard use cases, and writes a Newick tree from a Tree with CommonNodeData and CommonEdgeData 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 CommonTreeNewickWriterPlugin. 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 367 of file tree/common_tree/newick_writer.hpp.
Public Member Functions | |
CommonTreeNewickWriter () | |
Public Member Functions inherited from NewickWriter | |
NewickWriter ()=default | |
NewickWriter (NewickWriter &&)=default | |
NewickWriter (NewickWriter const &)=default | |
virtual | ~NewickWriter ()=default |
bool | force_quotation_marks () const |
Get whether all names are wrapped in quotation marks. More... | |
NewickWriter & | force_quotation_marks (bool value) |
If set to true , all names are wrapped in quotation marks, regardless of whether the name contains any characters that need to be wrapped. More... | |
size_t | line_length () const |
Get the currently set approximate maximal line length. More... | |
NewickWriter & | line_length (size_t value) |
Set the approximate maximal line length to use when writing Newick trees. More... | |
NewickWriter & | operator= (NewickWriter &&)=default |
NewickWriter & | operator= (NewickWriter const &)=default |
char | quotation_mark () const |
Get the currently set type of quotation marks used for node names. More... | |
NewickWriter & | quotation_mark (char value) |
Set the type of quotation marks used for node names that contain special characters. More... | |
std::string | to_string (Tree const &tree) const |
Shorthand to write a Tree to Newick format and return it is a string. More... | |
bool | trailing_new_line () const |
Get the current setting for whether a new line char \n is written to the end of each tree. More... | |
NewickWriter & | trailing_new_line (bool value) |
Set whether to write a new line char \n at the end of each tree. More... | |
NewickBroker | tree_to_broker (Tree const &tree) const |
Transform the information of the tree into a NewickBroker object. More... | |
void | write (NewickBroker const &broker, std::shared_ptr< utils::BaseOutputTarget > target) const |
Write a NewickBroker to an output target, in Newick format. More... | |
void | write (Tree const &tree, std::shared_ptr< utils::BaseOutputTarget > target) const |
Write a Tree to an output target, using the Newick format. More... | |
void | write (TreeSet const &tree_set, std::shared_ptr< utils::BaseOutputTarget > target, bool with_names=false) const |
Write all Trees in a TreeSet to an output target, using the Newick format. More... | |
bool | write_comments () const |
Get whether Newick comments (e.g., some forms of bootstrap values) are written. More... | |
NewickWriter & | write_comments (bool value) |
Set whether to write Newick comments (e.g., some forms of bootstrap values). More... | |
bool | write_names () const |
Get whether Newick node names are written. More... | |
NewickWriter & | write_names (bool value) |
Set whether to write Newick node names. More... | |
bool | write_tags () const |
Get whether Newick tags (e.g., for jplace files) are written. More... | |
NewickWriter & | write_tags (bool value) |
Set whether to write Newick tags (e.g., for jplace files). More... | |
bool | write_values () const |
Get whether Newick values (e.g., branch lengths) are written. More... | |
NewickWriter & | write_values (bool value) |
Set whether to write Newick values (e.g., branch lengths). More... | |
Public Member Functions inherited from CommonTreeNewickWriterPlugin | |
CommonTreeNewickWriterPlugin ()=default | |
CommonTreeNewickWriterPlugin (CommonTreeNewickWriterPlugin &&)=default | |
CommonTreeNewickWriterPlugin (CommonTreeNewickWriterPlugin const &)=default | |
virtual | ~CommonTreeNewickWriterPlugin ()=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_type & | branch_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_type & | default_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_type & | default_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_type & | default_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 |
bool | enable_branch_lengths () const |
Get whether currently any branch lengths are written. More... | |
self_type & | enable_branch_lengths (bool value) |
Set whether to write branch lengths. More... | |
bool | enable_names () const |
Get whether currently any node names are written at all. More... | |
self_type & | enable_names (bool value) |
Set whether to write node names at all. More... | |
void | node_to_element (TreeNode const &node, NewickBrokerElement &element) const |
CommonTreeNewickWriterPlugin & | operator= (CommonTreeNewickWriterPlugin &&)=default |
CommonTreeNewickWriterPlugin & | operator= (CommonTreeNewickWriterPlugin const &)=default |
void | register_with (NewickWriter &writer) const |
bool | replace_invalid_chars () const |
Return whether currently this plugin replaces characters that are invalid in the Newick file format with underscores. More... | |
self_type & | replace_invalid_chars (bool value) |
Set whether to replace all characters that are invalid in the Newick file format in names with underscores ('_'). More... | |
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. More... | |
bool | use_default_names () const |
Return whether currently default names are activated in this plugin. More... | |
self_type & | use_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 CommonTreeNewickWriterPlugin | |
using | self_type = CommonTreeNewickWriterPlugin |
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... | |
|
inline |
Definition at line 377 of file tree/common_tree/newick_writer.hpp.