|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TAXONOMY_TAXONOMY_H_
2 #define GENESIS_TAXONOMY_TAXONOMY_H_
46 void swap( Taxonomy& lhs, Taxonomy& rhs );
162 bool has_child ( std::string name )
const;
189 Taxon const&
at (
size_t index )
const;
212 size_t index_of( std::string
const& name )
const;
262 template <
class Compare>
265 children_.sort( comp );
343 std::list<Taxon> children_;
349 #endif // include guard
void remove_at(size_t index)
Remove a child Taxon at a certain index.
void remove_child(std::string const &name)
Remove a child Taxon with a certain name.
std::list< Taxon >::const_iterator const_iterator
Taxonomy & operator=(Taxonomy const &)
Copy assignment operator.
Store a Taxon, i.e., an element in a Taxonomy, with its name, rank, ID and sub-taxa.
void reset_parent_pointers_(Taxon *parent)
Internal helper function that resets the parent pointer of all stored Taxa.
size_t index_of(std::string const &name) const
bool has_child(std::string name) const
Return whether an immediate child Taxon with the given name exists.
Taxon & add_child(Taxon const &child, bool merge_duplicates=true)
Add a child Taxon as a copy of a given Taxon and return it.
virtual ~Taxonomy()=default
void sort(Compare comp)
Sort the taxonomy according to some compare criterion.
Taxon const & operator[](std::string name) const
Return the child Taxon with a given name if it exists, or throw otherwise.
void swap(Taxon &lhs, Taxon &rhs)
iterator end()
Return an iterator to the end of the child taxa.
iterator begin()
Return an iterator to the beginning of the child taxa.
const_iterator cbegin() const
Return a const iterator to the beginning of the child taxa.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Store a Taxonomy, i.e., a nested hierarchy of Taxa.
void merge_duplicates(Sample &smp)
Look for Pqueries with the same name and merge them.
virtual Taxon & add_child_(Taxon const &child, bool merge_duplicates)
Virtual implementation function for adding a child Taxon.
size_t size() const
Return the number of immediate child Taxa.
Taxon const & get_child(std::string name) const
Return the child Taxon with a given name if it exists, or throw otherwise.
const_iterator cend() const
Return a const iterator to the end of the child taxa.
std::list< Taxon >::iterator iterator
void clear_children()
Remove all children.
Taxon const & at(size_t index) const
Return the child Taxon at the given index.
friend void swap(Taxonomy &lhs, Taxonomy &rhs)
Swapperator for Taxonomy.