A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
functions/taxonomy.cpp File Reference
#include "genesis/taxonomy/functions/taxonomy.hpp"
#include "genesis/taxonomy/taxon.hpp"
#include "genesis/taxonomy/taxonomy.hpp"
#include "genesis/taxonomy/printers/nested.hpp"
#include "genesis/utils/core/logging.hpp"
#include "genesis/utils/text/string.hpp"
#include <algorithm>
#include <assert.h>
#include <ostream>
#include <stdexcept>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::taxonomy
 

Functions

Taxon const * find_taxon_by_name (Taxonomy const &tax, std::string const &name)
 Find a Taxon with a given name by recursively searching the Taxonomy. More...
 
Taxon * find_taxon_by_name (Taxonomy &tax, std::string const &name)
 Find a Taxon with a given name by recursively searching the Taxonomy. More...
 
std::ostream & operator<< (std::ostream &out, Taxonomy const &tax)
 Print the contents of a Taxonomy, i.e., all nested taxa, up to a limit of 10. More...
 
void remove_taxa_at_level (Taxonomy &tax, size_t level)
 Remove all Taxa at a given level of depth in the Taxonomy hierarchy, and all their children. More...
 
void sort_by_name (Taxonomy &tax, bool recursive, bool case_sensitive)
 Sort the Taxa of a Taxonomy by their name. More...
 
size_t taxa_count_at_level (Taxonomy const &tax, size_t level)
 Count the number of Taxa at a certain level of depth in the Taxonomy. More...
 
std::vector< size_t > taxa_count_levels (Taxonomy const &tax)
 Count the number of Taxa at each level of depth in the Taxonomy. More...
 
size_t taxa_count_lowest_levels (Taxonomy const &tax)
 Return the number of lowest level Taxa (i.e., taxa without sub-taxa) in the Taxonomy. More...
 
std::unordered_map
< std::string, size_t > 
taxa_count_ranks (Taxonomy const &tax, bool case_sensitive)
 Count the number of Taxa in a Taxonomy per rank. More...
 
size_t taxa_count_with_rank (Taxonomy const &tax, std::string const &rank, bool case_sensitive)
 Count the number of Taxa in a Taxonomy that have a certain rank assigned to them. More...
 
size_t taxon_level (Taxon const &taxon)
 Return the level of depth of a given Taxon. More...
 
size_t total_taxa_count (Taxonomy const &tax)
 Return the total number of taxa contained in the Taxomony, i.e., the number of (non-unique) names of all children (recursively). More...
 
bool validate (Taxonomy const &taxonomy, bool stop_at_first_error)
 Validate the internal data structures of a Taxonomy and its child Taxa Taxa. More...