|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
53 if( trim_nested_duplicates_ ) {
59 for(
size_t i = cpy.size() - 1; i >= 1; --i ) {
60 if( cpy[i] == cpy[i-1] ) {
71 if( append_delimiter_ ) {
72 return res + delimiter_;
87 std::vector<std::string> taxa;
91 Taxon const* r = &taxon;
92 while( r !=
nullptr ) {
95 taxa.push_back( r->
name() );
99 taxa.push_back( r->
rank() );
103 taxa.push_back( r->
id() );
107 throw std::invalid_argument(
"Invalid TaxonField in TaxopathGenerator." );
116 if( trim_nested_duplicates_ ) {
117 for(
size_t i = 0; i < taxa.size() - 1; ++i ) {
118 if( taxa[i] == taxa[i+1] ) {
125 std::reverse( taxa.begin(), taxa.end() );
128 if( append_delimiter_ ) {
129 return res + delimiter_;
168 trim_nested_duplicates_ = value;
174 return trim_nested_duplicates_;
179 append_delimiter_ = value;
185 return append_delimiter_;
Taxon const * parent() const
Return a pointer to the parent of this taxon, or a nullptr if this is the top level taxon.
std::vector< std::string > const & elements() const
Return the elements of the Taxopath as a vector of strings.
TaxonField field() const
Return the currelty set field to use for describing a Taxon.
bool append_delimiter() const
Return whether currently a delimiter is appended to the taxonomic path string.
Store a Taxon, i.e., an element in a Taxonomy, with its name, rank, ID and sub-taxa.
Helper class to generate a taxonomic path string from a Taxopath object or a Taxon.
Helper class to store a taxonomic path.
Provides some commonly used string utility functions.
std::string const & rank() const
Return the rank of this taxon.
std::string const & name() const
Return the name of this taxon.
bool trim_nested_duplicates() const
Return the currently set value whether to trim nested duplicates of taxa names.
std::string delimiter() const
Return the currelty set value used to join the taxonomic path string elements.
Interval< DataType, NumericalType, IntervalKind > join(Interval< DataType, NumericalType, IntervalKind > const &a, Interval< DataType, NumericalType, IntervalKind > const &b)
Creates a new Interval that contains both intervals and whatever is between.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::string to_string(Taxopath const &taxopath) const
Return a string representation of a Taxopath.
std::string operator()(Taxopath const &taxopath) const
Shortcut function alias for to_string( Taxopath ).
std::string const & id() const
Set the ID of this taxon.