A library for working with phylogenetic and population genetic data.
v0.27.0
taxonomy/functions/taxonomy.hpp File Reference
#include "genesis/taxonomy/taxon.hpp"
#include "genesis/taxonomy/taxonomy.hpp"
#include <functional>
#include <iosfwd>
#include <string>
#include <unordered_map>
#include <vector>
#include <queue>

Go to the source code of this file.

Classes

struct  BreadthFirstSearch
 Tag used for find_taxon(). More...
 
struct  DepthFirstSearch
 Tag used for find_taxon(). More...
 

Namespaces

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

Typedefs

using BFS = BreadthFirstSearch
 Alias for BreadthFirstSearch. More...
 
using DFS = DepthFirstSearch
 Alias for DepthFirstSearch. More...
 

Functions

template<class UnaryPredicate >
Taxon * find_taxon (Taxonomy &tax, UnaryPredicate p)
 Alias for find_taxon(..., DepthFirstSearch{}) More...
 
template<class SearchStrategy , class UnaryPredicate >
Taxon * find_taxon (Taxonomy &tax, UnaryPredicate p, SearchStrategy strat)
 Find a Taxon based on a given predicate by recursively searching the Taxonomy according to a search strategy. More...
 
template<class UnaryPredicate >
Taxon const * find_taxon (Taxonomy const &tax, UnaryPredicate p)
 Alias for find_taxon(..., DepthFirstSearch{}) More...
 
template<class UnaryPredicate >
Taxon const * find_taxon (Taxonomy const &tax, UnaryPredicate p, BreadthFirstSearch)
 Find a Taxon based on a given predicate by recursively searching the Taxonomy in a breadth first manner. More...
 
template<class UnaryPredicate >
Taxon const * find_taxon (Taxonomy const &tax, UnaryPredicate p, DepthFirstSearch)
 Find a Taxon based on a given predicate by recursively searching the Taxonomy in a depth first manner. More...
 
Taxon * find_taxon_by_id (Taxonomy &tax, std::string const &id)
 Alias for find_taxon_by_id(..., DepthFirstSearch{}). More...
 
template<class SearchStrategy >
Taxon * find_taxon_by_id (Taxonomy &tax, std::string const &id, SearchStrategy strat)
 Find a Taxon with a given ID by recursively searching the Taxonomy according to a search strategy. More...
 
Taxon const * find_taxon_by_id (Taxonomy const &tax, std::string const &id)
 Alias for find_taxon_by_id(..., DepthFirstSearch{}). More...
 
template<class SearchStrategy >
Taxon const * find_taxon_by_id (Taxonomy const &tax, std::string const &id, SearchStrategy strat)
 Find a Taxon with a given ID by recursively searching the Taxonomy according to a search strategy. More...
 
Taxon * find_taxon_by_name (Taxonomy &tax, std::string const &name)
 Alias for find_taxon_by_name(..., DepthFirstSearch{}). More...
 
template<class SearchStrategy >
Taxon * find_taxon_by_name (Taxonomy &tax, std::string const &name, SearchStrategy strat)
 Find a Taxon with a given name by recursively searching the Taxonomy according to a search strategy. More...
 
Taxon const * find_taxon_by_name (Taxonomy const &tax, std::string const &name)
 Alias for find_taxon_by_name(..., DepthFirstSearch{}). More...
 
template<class SearchStrategy >
Taxon const * find_taxon_by_name (Taxonomy const &tax, std::string const &name, SearchStrategy strat)
 Find a Taxon with a given name by recursively searching the Taxonomy according to a search strategy. 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...