A library for working with phylogenetic and population genetic data.
v0.27.0
NewickBrokerElement Struct Reference

#include <genesis/tree/formats/newick/element.hpp>

Detailed Description

Store the information for one element of a Newick tree.

Most of the class' members are public, as it is intended to serve an an intermediate data exchange format, so different callers might need to modify its content. However, this means paying attention when working with the data, as it can be changed from anywhere.

See NewickBroker class for a description of this intermediate format.

Definition at line 60 of file element.hpp.

Public Member Functions

 NewickBrokerElement ()
 Constructor, initializes the item values. More...
 
 NewickBrokerElement (long depth)
 Constructor, initializes the item values and sets the depth. More...
 
 NewickBrokerElement (NewickBrokerElement &&)=default
 
 NewickBrokerElement (NewickBrokerElement const &)=default
 
 NewickBrokerElement (std::string const &name, long depth)
 Constructor, initializes the item values and sets the name and the depth. More...
 
 ~NewickBrokerElement ()=default
 
bool is_inner () const
 Return whether this is an inner node, i.e., not a leaf node. More...
 
bool is_leaf () const
 Return whether this is a leaf node. More...
 
bool is_root () const
 Return whether this is the root node of the tree. More...
 
NewickBrokerElementoperator= (NewickBrokerElement &&)=default
 
NewickBrokerElementoperator= (NewickBrokerElement const &)=default
 
long rank () const
 Returns the rank (number of immediate children) of this node. More...
 

Public Attributes

std::vector< std::string > comments
 Arbitrary strings that can be attached to a node, e.g. in Newick format via "[]". More...
 
long depth
 Depth of the node in the tree, i.e. its distance from the root. More...
 
std::string name
 Name of the node. More...
 
friend NewickBroker
 
std::vector< std::string > tags
 Arbitrary strings that can be attached to a node, e.g. in Newick format via "{}". More...
 
std::vector< std::string > values
 Numerical values associated with the node, i.e. branch lengths. More...
 

Constructor & Destructor Documentation

◆ NewickBrokerElement() [1/5]

NewickBrokerElement ( )
inline

Constructor, initializes the item values.

Definition at line 73 of file element.hpp.

◆ NewickBrokerElement() [2/5]

NewickBrokerElement ( long  depth)
inlineexplicit

Constructor, initializes the item values and sets the depth.

Definition at line 81 of file element.hpp.

◆ NewickBrokerElement() [3/5]

NewickBrokerElement ( std::string const &  name,
long  depth 
)
inline

Constructor, initializes the item values and sets the name and the depth.

Definition at line 89 of file element.hpp.

◆ ~NewickBrokerElement()

~NewickBrokerElement ( )
default

◆ NewickBrokerElement() [4/5]

◆ NewickBrokerElement() [5/5]

Member Function Documentation

◆ is_inner()

bool is_inner ( ) const
inline

Return whether this is an inner node, i.e., not a leaf node.

Definition at line 179 of file element.hpp.

◆ is_leaf()

bool is_leaf ( ) const
inline

Return whether this is a leaf node.

Definition at line 168 of file element.hpp.

◆ is_root()

bool is_root ( ) const
inline

Return whether this is the root node of the tree.

Definition at line 160 of file element.hpp.

◆ operator=() [1/2]

NewickBrokerElement& operator= ( NewickBrokerElement &&  )
default

◆ operator=() [2/2]

NewickBrokerElement& operator= ( NewickBrokerElement const &  )
default

◆ rank()

long rank ( ) const
inline

Returns the rank (number of immediate children) of this node.

NewickBroker::assign_ranks() has to be called before using this function. Otherwise, this function will throw an std::logic_error.

Definition at line 149 of file element.hpp.

Member Data Documentation

◆ comments

std::vector<std::string> comments

Arbitrary strings that can be attached to a node, e.g. in Newick format via "[]".

Definition at line 132 of file element.hpp.

◆ depth

long depth

Depth of the node in the tree, i.e. its distance from the root.

Definition at line 137 of file element.hpp.

◆ name

std::string name

Name of the node.

In case it is a leaf, this is usually the name of the taxon represented by the node. Internal nodes are named "Internal Node" in case no name is specified in the Newick format, same applies to the (possibly virtual) root, which is named "Root Node" by default.

Definition at line 114 of file element.hpp.

◆ NewickBroker

friend NewickBroker

Definition at line 62 of file element.hpp.

◆ tags

std::vector<std::string> tags

Arbitrary strings that can be attached to a node, e.g. in Newick format via "{}".

Definition at line 127 of file element.hpp.

◆ values

std::vector<std::string> values

Numerical values associated with the node, i.e. branch lengths.

In cases wehre the values need to be interpreted as edge values, this is the edge leading to this node's parent.

Definition at line 122 of file element.hpp.


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