ʻOhana
Population structure, admixture history, and selection using learning methods.
|
A template class representing a node from a Newick tree. More...
#include <jade.newick.hpp>
Public Types | |
typedef TValue | value_type |
The value type. More... | |
typedef const basic_newick_node * | const_pointer_type |
The constant Newick node pointer type. More... | |
typedef basic_newick_node * | pointer_type |
The Newick node pointer type. More... | |
typedef std::vector< pointer_type > | children_type |
The children vector type. More... | |
typedef basic_scanner< char > | scanner_type |
The scanner type. More... | |
Public Member Functions | |
~basic_newick_node () | |
Reclaims resources used by this instance and its children. More... | |
basic_newick_node () | |
Initializes a new instance of the class. Initially, the instance has no name, no length, no parent, and no children. More... | |
basic_newick_node (std::istream &in) | |
Initializes a new instance of the class from the specified input stream. The input stream must end with a semicolon. If an error occurs, the method throws an exception. More... | |
basic_newick_node (const std::string &in) | |
Initializes a new instance of the class from the specified input string. The input string must end with a semicolon. If an error occurs, the method throws an exception. More... | |
void | erase_length () |
Erases the length. More... | |
template<typename TPredicate > | |
std::set< const_pointer_type > | find_all (const TPredicate predicate) const |
template<typename TPredicate > | |
std::set< pointer_type > | find_all (const TPredicate predicate) |
std::set< const_pointer_type > | find_descendents () const |
std::set< pointer_type > | find_descendents () |
template<typename TPredicate > | |
const_pointer_type | find_first (const TPredicate predicate) const |
template<typename TPredicate > | |
pointer_type | find_first (const TPredicate predicate) |
const_pointer_type | find_id (const int id) const |
pointer_type | find_id (const int id) |
std::set< const_pointer_type > | find_leafs () const |
std::set< pointer_type > | find_leafs () |
const_pointer_type | find_name (char const *const name) const |
pointer_type | find_name (char const *const name) |
const_pointer_type | find_root () const |
pointer_type | find_root () |
template<typename TAction > | |
void | for_each (const TAction action) const |
Executes the specified action for all descendent nodes, including this instance, in depth-first order. More... | |
template<typename TAction > | |
void | for_each (const TAction action) |
Executes the specified action for all descendent nodes, including this instance, in depth-first order. More... | |
const children_type & | get_children () const |
int | get_id () const |
value_type | get_length () const |
const std::string & | get_name () const |
const_pointer_type | get_parent () const |
pointer_type | get_parent () |
bool | has_length () const |
bool | has_name () const |
bool | is_leaf () const |
bool | is_root () const |
pointer_type | reroot () const |
Creates a new tree based on the tree associated with this node; in the tree returned, a copy of this node is the root. More... | |
void | set_length (const value_type length) |
Assigns the length. More... | |
void | set_name (char const *const name) |
Assigns the name. More... | |
std::string | str () const |
Encodes this instance and returns the output as a string. A semicolon is written as the last character of the file. More... | |
void | write (std::ostream &out) const |
Writes this instance into the specified output stream. The output stream receives a semicolon after the tree data. More... | |
void | write (char const *const path) const |
Writes this instance into the specified file. A semicolon is written as the last character of the file. More... | |
void | write (const std::string &path) const |
Writes this instance into the specified file. A semicolon is written as the last character of the file. More... | |
Static Public Member Functions | |
static pointer_type | from_file (char const *const path) |
static basic_newick_node * | from_file (const std::string &path) |
A template class representing a node from a Newick tree.
Definition at line 18 of file jade.newick.hpp.
typedef std::vector<pointer_type> jade::basic_newick_node< TValue >::children_type |
The children vector type.
Definition at line 31 of file jade.newick.hpp.
typedef const basic_newick_node* jade::basic_newick_node< TValue >::const_pointer_type |
The constant Newick node pointer type.
Definition at line 25 of file jade.newick.hpp.
typedef basic_newick_node* jade::basic_newick_node< TValue >::pointer_type |
The Newick node pointer type.
Definition at line 28 of file jade.newick.hpp.
typedef basic_scanner<char> jade::basic_newick_node< TValue >::scanner_type |
The scanner type.
Definition at line 34 of file jade.newick.hpp.
typedef TValue jade::basic_newick_node< TValue >::value_type |
The value type.
Definition at line 22 of file jade.newick.hpp.
|
inline |
Reclaims resources used by this instance and its children.
Definition at line 39 of file jade.newick.hpp.
|
inline |
Initializes a new instance of the class. Initially, the instance has no name, no length, no parent, and no children.
Definition at line 48 of file jade.newick.hpp.
|
inlineexplicit |
Initializes a new instance of the class from the specified input stream. The input stream must end with a semicolon. If an error occurs, the method throws an exception.
jade::error | Thrown if there is an error parsing the tree. |
in | The input stream to read. |
Definition at line 65 of file jade.newick.hpp.
|
inlineexplicit |
Initializes a new instance of the class from the specified input string. The input string must end with a semicolon. If an error occurs, the method throws an exception.
jade::error | Thrown if there is an error parsing the tree. |
in | The input string to read. |
Definition at line 80 of file jade.newick.hpp.
|
inline |
Erases the length.
Definition at line 91 of file jade.newick.hpp.
|
inline |
predicate | The predicate to match. |
Definition at line 126 of file jade.newick.hpp.
|
inline |
predicate | The predicate to match. |
Definition at line 103 of file jade.newick.hpp.
|
inline |
Definition at line 156 of file jade.newick.hpp.
|
inline |
Definition at line 145 of file jade.newick.hpp.
|
inline |
predicate | The predicate to match. |
Definition at line 190 of file jade.newick.hpp.
|
inline |
predicate | The predicate to match. |
Definition at line 170 of file jade.newick.hpp.
|
inline |
id | The id of the node to find. |
Definition at line 219 of file jade.newick.hpp.
|
inline |
id | The id of the node to find. |
Definition at line 206 of file jade.newick.hpp.
|
inline |
Definition at line 244 of file jade.newick.hpp.
|
inline |
Definition at line 232 of file jade.newick.hpp.
|
inline |
name | The name of the node to find. |
Definition at line 268 of file jade.newick.hpp.
|
inline |
name | The name of the node to find. |
Definition at line 255 of file jade.newick.hpp.
|
inline |
Definition at line 288 of file jade.newick.hpp.
|
inline |
Definition at line 280 of file jade.newick.hpp.
|
inline |
Executes the specified action for all descendent nodes, including this instance, in depth-first order.
action | The action to perform. |
Definition at line 313 of file jade.newick.hpp.
|
inline |
Executes the specified action for all descendent nodes, including this instance, in depth-first order.
action | The action to perform. |
Definition at line 298 of file jade.newick.hpp.
|
inlinestatic |
jade::error | Thrown if there is an error parsing the tree. |
path | The path to the file. |
Definition at line 327 of file jade.newick.hpp.
|
inlinestatic |
jade::error | Thrown if there is an error parsing the tree. |
path | The path to the file to decode. |
Definition at line 339 of file jade.newick.hpp.
|
inline |
Definition at line 348 of file jade.newick.hpp.
|
inline |
Definition at line 357 of file jade.newick.hpp.
|
inline |
Definition at line 366 of file jade.newick.hpp.
|
inline |
Definition at line 374 of file jade.newick.hpp.
|
inline |
Definition at line 390 of file jade.newick.hpp.
|
inline |
Definition at line 382 of file jade.newick.hpp.
|
inline |
Definition at line 398 of file jade.newick.hpp.
|
inline |
Definition at line 406 of file jade.newick.hpp.
|
inline |
Definition at line 414 of file jade.newick.hpp.
|
inline |
Definition at line 422 of file jade.newick.hpp.
|
inline |
Creates a new tree based on the tree associated with this node; in the tree returned, a copy of this node is the root.
Definition at line 433 of file jade.newick.hpp.
|
inline |
Assigns the length.
length | The length to assign. |
Definition at line 456 of file jade.newick.hpp.
|
inline |
Assigns the name.
name | The name to assign. |
Definition at line 468 of file jade.newick.hpp.
|
inline |
Encodes this instance and returns the output as a string. A semicolon is written as the last character of the file.
Definition at line 481 of file jade.newick.hpp.
|
inline |
Writes this instance into the specified file. A semicolon is written as the last character of the file.
path | The path to the output file. |
Definition at line 504 of file jade.newick.hpp.
|
inline |
Writes this instance into the specified file. A semicolon is written as the last character of the file.
path | The path to the output file. |
Definition at line 517 of file jade.newick.hpp.
|
inline |
Writes this instance into the specified output stream. The output stream receives a semicolon after the tree data.
out | The output stream. |
Definition at line 492 of file jade.newick.hpp.