|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_ATTRIBUTE_TREE_KEYED_NEWICK_READER_H_
2 #define GENESIS_TREE_ATTRIBUTE_TREE_KEYED_NEWICK_READER_H_
153 std::string
const& key,
189 std::string
const& source_key,
191 std::string
const& target_key
211 std::string
const& source_key,
213 std::string
const& target_key,
214 std::string
const& default_value
292 std::string
const&
prefix,
399 using KeyValuePair = std::pair<std::string, std::string>;
400 using PairList = std::vector<KeyValuePair>;
409 bool has_attributes_for_target_(
Target target )
const;
416 void process_keyed_attributes_(
417 PairList
const& data,
422 void process_catch_all_attributes_(
423 PairList
const& data,
434 struct AttributeDescriptor
436 std::string source_key;
438 std::string target_key;
439 std::string default_value;
443 std::string prefix_ =
"&";
444 std::string separator_ =
",";
445 std::string assigner_ =
"=";
449 std::vector<AttributeDescriptor> keyed_attributes_;
450 std::vector<AttributeDescriptor> catch_all_attributes_;
452 static std::vector<AttributeDescriptor> nhx_attributes_;
492 #endif // include guard
self_type & trim(bool value)
Set whether to trim keys and values before storing them in the Tree.
std::map< std::string, std::string > AttributeTreeMap
Alias for the map type used by an AttributeTree.
void clear()
Reset all settings to the default and delete all attribute settings.
std::string prefix() const
Get the currently set prefix to look for in Newick comments.
void element_to_edge(NewickBrokerElement const &element, TreeEdge &edge) const
Provide a set of plugin functions for NewickReader to read a CommonTree.
self_type & add_nhx_attributes()
Add typical attributes of the NHX format, and set the appropriate delimiters.
self_type & operator=(KeyedAttributeTreeNewickReaderPlugin const &)=default
self_type & assigner(std::string const &value)
Set the assign symbol between a key and its value.
void register_with(NewickReader &reader) const
virtual ~KeyedAttributeTreeNewickReaderPlugin()=default
self_type & prefix(std::string const &value)
Set the prefix to look for in Newick comments.
std::string assigner() const
Get the currently set assign symbol between a key and its value.
Read default Newick trees, i.e., trees with names and branch lengths.
Provide a set of plugin functions for NewickReader to read key-value-pair data attributes into an Att...
void element_to_node(NewickBrokerElement const &element, TreeNode &node) const
@ kNode
Store data at the attributes map of an AttributeTreeNode.
self_type & add_attribute(std::string const &key, Target target)
Store values of a key at a target (i.e., Node or Edge).
Target
Select where to store the data, i.e., at Nodes or Edges of the Tree.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
KeyedAttributeTreeNewickReaderPlugin()=default
std::string separator() const
Get the currently set separator between key-value-pairs.
self_type & separator(std::string const &value)
Set the separator between key-value-pairs.
@ kEdge
Store data at the attributes map of an AttributeTreeEdge.
self_type & add_catch_all(Target target=Target::kNode)
Store all key-value-pairs of the Newick data in an AttributeTree.
bool trim() const
Get whether to trim keys and values before storing them in the Tree.
self_type & set_delimiters(std::string const &prefix, std::string const &separator, std::string const &assigner="=")
Set the delimiters for key-value-pairs.
void register_with(NewickReader &reader) const
KeyedAttributeTreeNewickReader()
KeyedAttributeTreeNewickReaderPlugin self_type
Store the information for one element of a Newick tree.
self_type & set_nhx_delimiters()
Set the delimiters to the format used by NHX.