|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_COMMON_TREE_NEWICK_READER_H_
2 #define GENESIS_TREE_COMMON_TREE_NEWICK_READER_H_
82 return default_branch_length_;
92 default_branch_length_ = value;
101 return default_leaf_name_;
109 default_leaf_name_ = value;
118 return default_inner_name_;
126 default_inner_name_ = value;
135 return default_root_name_;
143 default_root_name_ = value;
153 default_leaf_name_ = value;
154 default_inner_name_ = value;
155 default_root_name_ = value;
166 return use_default_names_;
187 use_default_names_ = value;
198 return replace_name_underscores_;
211 replace_name_underscores_ = value;
221 std::string name = element.
name;
224 if( name.empty() && use_default_names_ ) {
226 name = default_leaf_name_;
227 }
else if( element.
is_root() ) {
228 name = default_root_name_;
230 name = default_inner_name_;
235 if( replace_name_underscores_ ) {
247 if( element.
values.size() > 0 ) {
297 double default_branch_length_ = 1.0;
299 std::string default_leaf_name_ =
"Leaf_Node";
300 std::string default_inner_name_ =
"Inner_Node";
301 std::string default_root_name_ =
"Root_Node";
303 bool use_default_names_ =
false;
304 bool replace_name_underscores_ =
false;
349 #endif // include guard
self_type & replace_name_underscores(bool value)
Set whether to replace all underscores ('_') in names with spaces (' ').
create_node_data_function create_node_data_plugin
self_type & use_default_names(bool value)
Set whether to replace unnamed nodes with a default name.
void element_to_node(NewickBrokerElement const &element, TreeNode &node) const
double default_branch_length() const
Get the default branch length used when there is none given for an edge.
std::string name
Name of the node.
bool is_root() const
Return whether this is the root node of the tree.
std::string replace_all(std::string const &text, std::string const &search, std::string const &replace)
Return a copy of a string, where all occurrences of a search string are replaced by a replace string.
self_type & default_root_name(std::string const &value)
Set the default named used when there is none given for the root node.
Provide a set of plugin functions for NewickReader to read a CommonTree.
static std::unique_ptr< CommonEdgeData > create()
create_edge_data_function create_edge_data_plugin
std::string const & default_inner_name() const
Get the default named used when there is none given for an inner node.
self_type & default_inner_name(std::string const &value)
Set the default named used when there is none given for an inner node.
void register_with(NewickReader &reader) const
Provides some valuable additions to STD.
bool replace_name_underscores() const
Return whether currently this plugin replaces underscores with spaces.
Read default Newick trees, i.e., trees with names and branch lengths.
std::vector< std::string > values
Numerical values associated with the node, i.e. branch lengths.
virtual ~CommonTreeNewickReaderPlugin()=default
Provides some commonly used string utility functions.
std::vector< element_to_edge_function > element_to_edge_plugins
CommonTreeNewickReaderPlugin()=default
bool use_default_names() const
Return whether currently default names are activated in this plugin.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::string const & default_leaf_name() const
Get the default named used when there is none given for a leaf node.
bool is_leaf() const
Return whether this is a leaf node.
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.
std::vector< element_to_node_function > element_to_node_plugins
void element_to_edge(NewickBrokerElement const &element, TreeEdge &edge) const
std::string const & default_root_name() const
Get the default named used when there is none given for the root node.
Common class containing the commonly needed data for tree edges.
Common class containing the commonly needed data for tree nodes.
self_type & default_leaf_name(std::string const &value)
Set the default named used when there is none given for a leaf node.
static std::unique_ptr< CommonNodeData > create()
Store the information for one element of a Newick tree.
CommonTreeNewickReaderPlugin & operator=(CommonTreeNewickReaderPlugin const &)=default
self_type & default_branch_length(double value)
Set the default branch length used when there is none given for an edge.