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

#include <genesis/tree/attribute_tree/keyed_newick_reader.hpp>

Inherits NewickReader, DefaultTreeNewickReaderPlugin, and KeyedAttributeTreeNewickReaderPlugin.

Detailed Description

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

This class is a convenience wrapper that combines a NewickReader with a KeyedAttributeTreeNewickReaderPlugin. It is intended to be used for standard use cases, and produces a Tree with AttributeTreeNodeData and AttributeTreeEdgeData at its nodes and edges.

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

Definition at line 469 of file keyed_newick_reader.hpp.

Public Member Functions

 KeyedAttributeTreeNewickReader ()
 
- Public Member Functions inherited from NewickReader
 NewickReader ()=default
 
 NewickReader (NewickReader const &)=default
 
 NewickReader (NewickReader &&)=default
 
virtual ~NewickReader ()=default
 
NewickReaderenable_tags (bool value)
 Set whether Newick tags are enabled for reading. More...
 
bool enable_tags () const
 Return whether currently Newick tags are enabled. More...
 
Tree from_file (std::string const &filename) const
 Read a Tree from a file containing a Newick tree. More...
 
void from_file (std::string const &filename, TreeSet &tree_set, std::string const &default_name="") const
 Add Trees to a TreeSet from a file containing a list of Newick trees. More...
 
void from_files (std::vector< std::string > const &filenames, TreeSet &tree_set) const
 Fill a TreeSet from a list of files containing Newick trees. More...
 
Tree from_stream (std::istream &input_stream) const
 Read a Tree from an input stream containing a Newick tree. More...
 
void from_stream (std::istream &input_stream, TreeSet &tree_set, std::string const &default_name="") const
 Add Trees to a TreeSet from an input stream containing a list of Newick trees. More...
 
Tree from_string (std::string const &tree_string) const
 Read a Tree from a string containing a Newick tree. More...
 
void from_string (std::string const &tree_string, TreeSet &tree_set, std::string const &default_name="") const
 Add Trees to a TreeSet from a string containing a list of Newick trees. More...
 
void from_strings (std::vector< std::string > const &tree_strings, TreeSet &tree_set, std::string const &default_name="") const
 Fill a TreeSet from a list of strings containing Newick trees. More...
 
NewickReaderoperator= (NewickReader const &)=default
 
NewickReaderoperator= (NewickReader &&)=default
 
void parse_multiple_trees (utils::InputStream &input_stream, TreeSet &tree_set, std::string const &default_name) const
 Parse until the end of the stream and add all Trees to the TreeSet. More...
 
std::pair< std::string, Treeparse_named_tree (utils::InputStream &input_stream) const
 Parse one named tree, i.e., a tree as described here. More...
 
Tree parse_single_tree (utils::InputStream &input_stream) const
 Parse a single tree. Depending on stop_at_semicolon(), stop after the semicolon or continue until the end of the input, checking if there are only comments. More...
 
NewickReaderstop_at_semicolon (bool value)
 Set whether reading a single tree stops after the semicolon that finishes a Newick tree. More...
 
bool stop_at_semicolon () const
 Return whether currently reading stops after the semicolon that finishes a Newick tree. More...
 
- Public Member Functions inherited from DefaultTreeNewickReaderPlugin
 DefaultTreeNewickReaderPlugin ()=default
 
 DefaultTreeNewickReaderPlugin (DefaultTreeNewickReaderPlugin const &)=default
 
 DefaultTreeNewickReaderPlugin (DefaultTreeNewickReaderPlugin &&)=default
 
virtual ~DefaultTreeNewickReaderPlugin ()=default
 
double default_branch_length () const
 Get the default branch length used when there is none given for an edge. More...
 
self_typedefault_branch_length (double value)
 Set the default branch length used when there is none given for an edge. More...
 
std::string const & default_inner_name () const
 Get the default named used when there is none given for an inner node. More...
 
self_typedefault_inner_name (std::string const &value)
 Set the default named used when there is none given for an inner node. More...
 
std::string const & default_leaf_name () const
 Get the default named used when there is none given for a leaf node. More...
 
self_typedefault_leaf_name (std::string const &value)
 Set the default named used when there is none given for a leaf node. More...
 
std::string const & default_root_name () const
 Get the default named used when there is none given for the root node. More...
 
self_typedefault_root_name (std::string const &value)
 Set the default named used when there is none given for the root node. More...
 
void element_to_edge (NewickBrokerElement const &element, TreeEdge &edge) const
 
void element_to_node (NewickBrokerElement const &element, TreeNode &node) const
 
DefaultTreeNewickReaderPluginoperator= (DefaultTreeNewickReaderPlugin const &)=default
 
DefaultTreeNewickReaderPluginoperator= (DefaultTreeNewickReaderPlugin &&)=default
 
void register_with (NewickReader &reader) const
 
bool replace_name_underscores () const
 Return whether currently this plugin replaces underscores with spaces. More...
 
self_typereplace_name_underscores (bool value)
 Set whether to replace all underscores ('_') in names with spaces (' '). 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 unnamed nodes with a default name. More...
 
- Public Member Functions inherited from KeyedAttributeTreeNewickReaderPlugin
 KeyedAttributeTreeNewickReaderPlugin ()=default
 
 KeyedAttributeTreeNewickReaderPlugin (KeyedAttributeTreeNewickReaderPlugin const &)=default
 
 KeyedAttributeTreeNewickReaderPlugin (KeyedAttributeTreeNewickReaderPlugin &&)=default
 
virtual ~KeyedAttributeTreeNewickReaderPlugin ()=default
 
self_typeadd_attribute (std::string const &key, Target target)
 Store values of a key at a target (i.e., Node or Edge). More...
 
self_typeadd_attribute (std::string const &source_key, Target target, std::string const &target_key)
 Store values of a source_key at a target (i.e., Node or Edge), using the target_key. More...
 
self_typeadd_attribute (std::string const &source_key, Target target, std::string const &target_key, std::string const &default_value)
 Store values of a source_key at a target (i.e., Node or Edge), using the target_key, and a default_value, if the key is not found in the source. More...
 
self_typeadd_catch_all (Target target=Target::kNode)
 Store all key-value-pairs of the Newick data in an AttributeTree. More...
 
self_typeadd_nhx_attributes ()
 Add typical attributes of the NHX format, and set the appropriate delimiters. More...
 
self_typeassigner (std::string const &value)
 Set the assign symbol between a key and its value. More...
 
std::string assigner () const
 Get the currently set assign symbol between a key and its value. More...
 
void clear ()
 Reset all settings to the default and delete all attribute settings. More...
 
void element_to_edge (NewickBrokerElement const &element, TreeEdge &edge) const
 
void element_to_node (NewickBrokerElement const &element, TreeNode &node) const
 
self_typeoperator= (KeyedAttributeTreeNewickReaderPlugin const &)=default
 
self_typeoperator= (KeyedAttributeTreeNewickReaderPlugin &&)=default
 
self_typeprefix (std::string const &value)
 Set the prefix to look for in Newick comments. More...
 
std::string prefix () const
 Get the currently set prefix to look for in Newick comments. More...
 
void register_with (NewickReader &reader) const
 
self_typeseparator (std::string const &value)
 Set the separator between key-value-pairs. More...
 
std::string separator () const
 Get the currently set separator between key-value-pairs. More...
 
self_typeset_delimiters (std::string const &prefix, std::string const &separator, std::string const &assigner="=")
 Set the delimiters for key-value-pairs. More...
 
self_typeset_nhx_delimiters ()
 Set the delimiters to the format used by NHX. More...
 
self_typetrim (bool value)
 Set whether to trim keys and values before storing them in the Tree. More...
 
bool trim () const
 Get whether to trim keys and values before storing them in the Tree. More...
 

Additional Inherited Members

- Public Types inherited from NewickReader
using create_edge_data_function = std::function< void(TreeEdge &edge) >
 Function type used to create the data pointer for each TreeEdge. More...
 
using create_node_data_function = std::function< void(TreeNode &node) >
 Function type used to create the data pointer for each TreeNode. More...
 
using element_to_edge_function = std::function< void(NewickBrokerElement const &element, TreeEdge &edge) >
 Function type that translates from a NewickBrokerElement to a TreeEdge. More...
 
using element_to_node_function = std::function< void(NewickBrokerElement const &element, TreeNode &node) >
 Function type that translates from a NewickBrokerElement to a TreeNode. More...
 
using finish_reading_function = std::function< void(NewickBroker const &broker, Tree &tree) >
 Function type that allows to do some finalizing work with the NewickBroker and Tree after the actual tree reading finished. More...
 
using prepare_reading_function = std::function< void(NewickBroker const &broker, Tree &tree) >
 Function type that allows to do some preparatory work with the NewickBroker and Tree before the actual tree reading begins. More...
 
- Public Types inherited from DefaultTreeNewickReaderPlugin
using self_type = DefaultTreeNewickReaderPlugin
 
- Public Types inherited from KeyedAttributeTreeNewickReaderPlugin
using self_type = KeyedAttributeTreeNewickReaderPlugin
 
enum  Target { kNode, kEdge }
 Select where to store the data, i.e., at Nodes or Edges of the Tree. More...
 
- Public Attributes inherited from NewickReader
create_edge_data_function create_edge_data_plugin
 
create_node_data_function create_node_data_plugin
 
std::vector
< element_to_edge_function
element_to_edge_plugins
 
std::vector
< element_to_node_function
element_to_node_plugins
 
std::vector
< finish_reading_function
finish_reading_plugins
 
std::vector
< prepare_reading_function
prepare_reading_plugins
 

Constructor & Destructor Documentation

Definition at line 480 of file keyed_newick_reader.hpp.


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