A library for working with phylogenetic and population genetic data.
v0.27.0
functions/taxonomy.cpp File Reference
#include "genesis/taxonomy/functions/taxonomy.hpp"
#include "genesis/taxonomy/iterator/preorder.hpp"
#include "genesis/taxonomy/printers/nested.hpp"
#include "genesis/utils/core/logging.hpp"
#include "genesis/utils/text/string.hpp"
#include <algorithm>
#include <cassert>
#include <ostream>
#include <stdexcept>
#include <string>
#include <unordered_set>
#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 * find_taxon_by_id (Taxonomy &tax, std::string const &id)
 Alias for find_taxon_by_id(..., DepthFirstSearch{}). More...
 
Taxon const * find_taxon_by_id (Taxonomy const &tax, std::string const &id)
 Alias for find_taxon_by_id(..., DepthFirstSearch{}). More...
 
Taxon * find_taxon_by_name (Taxonomy &tax, std::string const &name)
 Alias for find_taxon_by_name(..., DepthFirstSearch{}). More...
 
Taxon const * find_taxon_by_name (Taxonomy const &tax, std::string const &name)
 Alias for find_taxon_by_name(..., DepthFirstSearch{}). More...
 
bool has_unique_ids (Taxonomy const &tax)
 Return true iff all IDs of the Taxa in the Taxonomy are unique. 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=true, bool case_sensitive=false)
 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=false)
 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=false)
 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=false)
 Validate the internal data structures of a Taxonomy and its child Taxa Taxa. More...