A library for working with phylogenetic and population genetic data.
v0.27.0
labels.cpp File Reference
#include "genesis/sequence/functions/labels.hpp"
#include "genesis/sequence/sequence_set.hpp"
#include "genesis/sequence/sequence.hpp"
#include "genesis/utils/text/string.hpp"
#include "genesis/utils/tools/hash/md5.hpp"
#include "genesis/utils/tools/hash/sha1.hpp"
#include "genesis/utils/tools/hash/sha256.hpp"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <stdexcept>

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::sequence
 

Functions

void filter_by_label_list (SequenceSet &set, std::unordered_set< std::string > const &labels, bool invert=false)
 Remove all those Sequences from a SequenceSet whose labels are in the given list. More...
 
Sequence const * find_sequence (SequenceSet const &set, std::string const &label)
 Return a pointer to a Sequence with a specific label, or nullptr iff not found. More...
 
std::pair< std::string, size_t > guess_sequence_abundance (Sequence const &sequence)
 Guess the abundance of a Sequence, using it's label. More...
 
std::pair< std::string, size_t > guess_sequence_abundance (std::string const &label)
 Guess the abundance of a Sequence, given it's label. More...
 
bool has_unique_labels (SequenceSet const &set, bool case_sensitive=true)
 Return true iff all labels of the Sequences in the SequenceSet are unique. More...
 
bool has_valid_label (Sequence const &seq)
 Check whether a Sequence has a valid label. More...
 
bool has_valid_labels (SequenceSet const &set)
 Check whether all Sequences in a SequenceSet have valid labels. More...
 
bool is_valid_label (std::string const &label)
 Check whether a given string is a valid label for a Sequence. More...
 
LabelAttributes label_attributes (Sequence const &sequence)
 Get the attributes list (semicolons-separated) from a Sequence. More...
 
LabelAttributes label_attributes (std::string const &label)
 Get the attributes list (semicolons-separated) from a Sequence, given it's label. More...
 
std::unordered_set< std::string > labels (SequenceSet const &set)
 Return a set of all labels of the SequenceSet. More...
 
void relabel_with_hash (Sequence &seq, utils::HashingFunctions hash_function)
 Relabel the Sequence using the hash digest of its sites. More...
 
void relabel_with_hash (SequenceSet &set, utils::HashingFunctions hash_function)
 Relabel all Sequences in the SequenceSet using the hash digest of the sites. More...
 
void sanitize_label (Sequence &seq)
 Sanitize a label by replacing all invalid characters with underscores. More...
 
std::string sanitize_label (std::string const &label)
 Sanitize a label by replacing all invalid characters with underscores. More...
 
void sanitize_labels (SequenceSet &set)
 Sanitize the labels of all Sequences in the SequenceSet by replacing all invalid characters with underscores. More...