A library for working with phylogenetic and population genetic data.
v0.27.0
CommonTreeNewickWriterPlugin Class Reference

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

Inherited by PlacementTreeNewickWriter, CommonTreeNewickWriter, and SimpleNewickTreeNewickWriter.

Detailed Description

Provide a set of plugin functions for NewickWriter to write a CommonTree.

Definition at line 51 of file tree/common_tree/newick_writer.hpp.

Public Member Functions

 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_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
 
bool enable_branch_lengths () const
 Get whether currently any branch lengths are written. More...
 
self_typeenable_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_typeenable_names (bool value)
 Set whether to write node names at all. More...
 
void node_to_element (TreeNode const &node, NewickBrokerElement &element) const
 
CommonTreeNewickWriterPluginoperator= (CommonTreeNewickWriterPlugin &&)=default
 
CommonTreeNewickWriterPluginoperator= (CommonTreeNewickWriterPlugin const &)=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...
 

Public Types

using self_type = CommonTreeNewickWriterPlugin
 

Constructor & Destructor Documentation

◆ CommonTreeNewickWriterPlugin() [1/3]

◆ ~CommonTreeNewickWriterPlugin()

virtual ~CommonTreeNewickWriterPlugin ( )
virtualdefault

◆ CommonTreeNewickWriterPlugin() [2/3]

◆ CommonTreeNewickWriterPlugin() [3/3]

Member Function Documentation

◆ branch_length_precision() [1/2]

int branch_length_precision ( ) const
inline

Get the currently set maximum precision (in number of digits) used for printing the branch_length floating point numbers.

Definition at line 244 of file tree/common_tree/newick_writer.hpp.

◆ branch_length_precision() [2/2]

self_type& branch_length_precision ( int  value)
inline

Set the maximum precision (in number of digits) used for printing the branch_length floating point numbers.

Common is 6.

Definition at line 255 of file tree/common_tree/newick_writer.hpp.

◆ default_inner_name() [1/2]

std::string const& default_inner_name ( ) const
inline

Get the named used to filter out an inner node name.

Definition at line 98 of file tree/common_tree/newick_writer.hpp.

◆ default_inner_name() [2/2]

self_type& default_inner_name ( std::string const &  value)
inline

Set the named used to filter out an inner node name.

Definition at line 106 of file tree/common_tree/newick_writer.hpp.

◆ default_leaf_name() [1/2]

std::string const& default_leaf_name ( ) const
inline

Get the named used to filter out a leaf node name.

Definition at line 81 of file tree/common_tree/newick_writer.hpp.

◆ default_leaf_name() [2/2]

self_type& default_leaf_name ( std::string const &  value)
inline

Set the named used to filter out a leaf node name.

Definition at line 89 of file tree/common_tree/newick_writer.hpp.

◆ default_root_name() [1/2]

std::string const& default_root_name ( ) const
inline

Get the named used to filter out the root node name.

Definition at line 115 of file tree/common_tree/newick_writer.hpp.

◆ default_root_name() [2/2]

self_type& default_root_name ( std::string const &  value)
inline

Set the named used to filter out the root node name.

Definition at line 123 of file tree/common_tree/newick_writer.hpp.

◆ edge_to_element()

void edge_to_element ( TreeEdge const &  edge,
NewickBrokerElement element 
) const
inline

Definition at line 288 of file tree/common_tree/newick_writer.hpp.

◆ enable_branch_lengths() [1/2]

bool enable_branch_lengths ( ) const
inline

Get whether currently any branch lengths are written.

Definition at line 235 of file tree/common_tree/newick_writer.hpp.

◆ enable_branch_lengths() [2/2]

self_type& enable_branch_lengths ( bool  value)
inline

Set whether to write branch lengths.

Definition at line 226 of file tree/common_tree/newick_writer.hpp.

◆ enable_names() [1/2]

bool enable_names ( ) const
inline

Get whether currently any node names are written at all.

Definition at line 218 of file tree/common_tree/newick_writer.hpp.

◆ enable_names() [2/2]

self_type& enable_names ( bool  value)
inline

Set whether to write node names at all.

If disabled, no names are written for any node.

Definition at line 209 of file tree/common_tree/newick_writer.hpp.

◆ node_to_element()

void node_to_element ( TreeNode const &  node,
NewickBrokerElement element 
) const
inline

Definition at line 265 of file tree/common_tree/newick_writer.hpp.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ register_with()

void register_with ( NewickWriter writer) const
inline

Definition at line 297 of file tree/common_tree/newick_writer.hpp.

◆ replace_name_spaces() [1/2]

bool replace_name_spaces ( ) const
inline

Return whether currently this plugin replaces spaces with underscores.

See the setter replace_name_spaces( bool ) for details.

Definition at line 184 of file tree/common_tree/newick_writer.hpp.

◆ replace_name_spaces() [2/2]

self_type& replace_name_spaces ( bool  value)
inline

Set whether to replace all spaces (' ') in names with underscores ('_').

This is the reverse of CommonTreeNewickReaderPlugin::replace_name_underscores(). It is activated by default, as it does no harm on already existing underscores. However, as spaces cannot be part of names in Newick, if it is deactivated (set to false), all names that contain spaces are instead wrapped in quotation marks by the NewickWriter, see NewickWriter::quotation_marks( std::string const& ) for details.

Definition at line 198 of file tree/common_tree/newick_writer.hpp.

◆ set_default_names()

self_type& set_default_names ( std::string const &  value)
inline

Shorthand to set the default names for leaf, inner and root node at once, to one value.

Definition at line 133 of file tree/common_tree/newick_writer.hpp.

◆ use_default_names() [1/2]

bool use_default_names ( ) const
inline

Return whether currently default names are activated in this plugin.

See the setter use_default_names( bool ) for details.

Definition at line 146 of file tree/common_tree/newick_writer.hpp.

◆ use_default_names() [2/2]

self_type& use_default_names ( bool  value)
inline

Set whether to replace default named nodes with an empty string.

This setting activates the "reverse" operation of CommonTreeNewickReaderPlugin::use_default_names( bool ). Thus, when the default names are set to the same values as in the reader plugin, reading a Newick tree and then writing it again should yield the same names in the Newick tree again.

Common is false. In this case, all node names are written to the Newick tree, indepentenly of whether they match the default names.

If set to true, a node that has one of the default names will result in an empty node name in the Newick tree:

These default names can be changed by using default_leaf_name( std::string const& ), default_inner_name( std::string const& ) and default_root_name( std::string const& ), or by using set_default_names( std::string const& ) to set all three at once.

Definition at line 173 of file tree/common_tree/newick_writer.hpp.

Member Typedef Documentation

◆ self_type


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