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

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

Inherits NewickReader, CommonTreeNewickReaderPlugin, and IndexedAttributeTreeNewickReaderPlugin.

Detailed Description

Read Newick trees with ordered attributes for the Nodes and Edges.

This class is a convenience wrapper that combines a NewickReader with an IndexedAttributeTreeNewickReaderPlugin. 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 373 of file indexed_newick_reader.hpp.

Public Member Functions

 IndexedAttributeTreeNewickReader ()
 
- Public Member Functions inherited from NewickReader
 NewickReader ()=default
 
 NewickReader (NewickReader &&)=default
 
 NewickReader (NewickReader const &)=default
 
virtual ~NewickReader ()=default
 
Tree broker_to_tree (NewickBroker const &broker) const
 Build a Tree from a NewickBroker. More...
 
Tree broker_to_tree_destructive (NewickBroker &broker) const
 Build a Tree from a NewickBroker. More...
 
bool enable_tags () const
 Return whether currently Newick tags are enabled. More...
 
NewickReaderenable_tags (bool value)
 Set whether Newick tags are enabled for reading. More...
 
NewickReaderoperator= (NewickReader &&)=default
 
NewickReaderoperator= (NewickReader const &)=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_after_semicolon(), stop after the semicolon or continue until the end of the input, checking if there are only comments. More...
 
Tree read (std::shared_ptr< utils::BaseInputSource > source) const
 Read a single Tree from an input source containing a Newick tree. More...
 
void read (std::shared_ptr< utils::BaseInputSource > source, TreeSet &target, std::string const &default_name="") const
 Add Trees to a TreeSet from an input source containing a list of Newick trees. More...
 
TreeSet read (std::vector< std::shared_ptr< utils::BaseInputSource >> sources, std::string const &default_name="") const
 Return a TreeSet from a list of input sources containing Newick trees. More...
 
void read (std::vector< std::shared_ptr< utils::BaseInputSource >> sources, TreeSet &target, std::string const &default_name="") const
 Fill a TreeSet from a list of input sources containing Newick trees. More...
 
bool stop_after_semicolon () const
 Return whether currently reading stops after the semicolon that finishes a Newick tree. More...
 
NewickReaderstop_after_semicolon (bool value)
 Set whether reading a single tree stops after the semicolon that finishes a Newick tree. More...
 
- Public Member Functions inherited from CommonTreeNewickReaderPlugin
 CommonTreeNewickReaderPlugin ()=default
 
 CommonTreeNewickReaderPlugin (CommonTreeNewickReaderPlugin &&)=default
 
 CommonTreeNewickReaderPlugin (CommonTreeNewickReaderPlugin const &)=default
 
virtual ~CommonTreeNewickReaderPlugin ()=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
 
CommonTreeNewickReaderPluginoperator= (CommonTreeNewickReaderPlugin &&)=default
 
CommonTreeNewickReaderPluginoperator= (CommonTreeNewickReaderPlugin const &)=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 IndexedAttributeTreeNewickReaderPlugin
 IndexedAttributeTreeNewickReaderPlugin ()=default
 
 IndexedAttributeTreeNewickReaderPlugin (IndexedAttributeTreeNewickReaderPlugin &&)=default
 
 IndexedAttributeTreeNewickReaderPlugin (IndexedAttributeTreeNewickReaderPlugin const &)=default
 
virtual ~IndexedAttributeTreeNewickReaderPlugin ()=default
 
self_typeadd_attribute (Source source, size_t index, Target target, std::string const &target_key)
 Store the Newick data at a given index in an AttributeTreeMap. More...
 
self_typeadd_attribute (Source source, size_t index, Target target, std::string const &target_key, std::string const &default_value)
 Store the Newick data at a given index in an AttributeTreeMap, using a default value if there is no data at that index. More...
 
self_typeadd_catch_all (Source source, Target target, std::string const &target_key_prefix)
 Store all Newick data of a given source in an AttributeTreeMap. More...
 
self_typeadd_catch_all (Target target=Target::kNode)
 Store all Newick data in an AttributeTreeMap. More...
 
void clear ()
 Reset all settings to the default, i.e., 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= (IndexedAttributeTreeNewickReaderPlugin &&)=default
 
self_typeoperator= (IndexedAttributeTreeNewickReaderPlugin const &)=default
 
void register_with (NewickReader &reader) const
 

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(Tree &tree) >
 Function type that allows to do some finalizing work with the 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 CommonTreeNewickReaderPlugin
using self_type = CommonTreeNewickReaderPlugin
 
- Public Types inherited from IndexedAttributeTreeNewickReaderPlugin
using self_type = IndexedAttributeTreeNewickReaderPlugin
 
enum  Source { kValue, kComment, kTag }
 Select which kind of Newick data to take, i.e., either comments, values, or tags. More...
 
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_functionelement_to_edge_plugins
 
std::vector< element_to_node_functionelement_to_node_plugins
 
std::vector< finish_reading_functionfinish_reading_plugins
 
std::vector< prepare_reading_functionprepare_reading_plugins
 

Constructor & Destructor Documentation

◆ IndexedAttributeTreeNewickReader()

Definition at line 384 of file indexed_newick_reader.hpp.


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