A library for working with phylogenetic and population genetic data.
v0.27.0
signatures.cpp File Reference
#include "genesis/sequence/functions/signatures.hpp"
#include "genesis/sequence/functions/codes.hpp"
#include "genesis/sequence/functions/signature_specifications.hpp"
#include "genesis/sequence/functions/stats.hpp"
#include "genesis/sequence/sequence_set.hpp"
#include "genesis/sequence/sequence.hpp"
#include "genesis/utils/math/statistics.hpp"
#include "genesis/utils/tools/char_lookup.hpp"
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <unordered_map>

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

std::string kmer_string_overlapping (Sequence const &sequence, SignatureSpecifications const &settings)
 Return the sequence spitted into overlapping k-mers. More...
 
void kmer_string_overlapping (Sequence const &sequence, SignatureSpecifications const &settings, std::ostream &out)
 Print the sequence spitted into overlapping k-mers. More...
 
static void kmer_string_overlapping_line (Sequence const &sequence, SignatureSpecifications const &settings, std::ostream &out)
 Local helper function that writes an overlapping kmer string to a stream. More...
 
static void kmer_string_single_kmer (Sequence const &sequence, SignatureSpecifications const &settings, size_t start, std::ostream &out)
 Local helper function that writes one kmer string to a stream. More...
 
std::vector< std::string > kmer_strings_non_overlapping (Sequence const &sequence, SignatureSpecifications const &settings)
 Return the sequence spitted into a set of non-overlapping k-mers. More...
 
void kmer_strings_non_overlapping (Sequence const &sequence, SignatureSpecifications const &settings, std::ostream &out)
 Print the sequence spitted into non-overlapping k-mers. More...
 
static void kmer_strings_non_overlapping_line (Sequence const &sequence, SignatureSpecifications const &settings, std::ostream &out, size_t offset)
 Local helper function that does one line of a non overlapping kmer string. More...
 
template<class Combinator >
std::vector< double > signature_complementarity_frequencies_helper (Sequence const &sequence, SignatureSpecifications const &settings, Combinator combinator)
 Local helper function that returns a vector where the frequencies of the non-palindromic kmers are combined using a functor. More...
 
std::vector< size_t > signature_counts (Sequence const &sequence, SignatureSpecifications const &settings)
 Count the occurences of k-mers in the sequence according to the settings. More...
 
std::vector< double > signature_frequencies (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the frequencies of occurences of k-mers in the sequence according to the settings. More...
 
std::vector< double > signature_frequency_ratios_1 (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the ratio 1 signature of a sequence. More...
 
std::vector< double > signature_frequency_ratios_2 (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the ratio 2 signature of a sequence. More...
 
std::vector< double > signature_jensen_shannon (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the Jensen-Shannon (JS) signature of a sequence. More...
 
std::vector< double > signature_maximal_complementarity_frequencies (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the signature of a sequence that uses the maximum frequency of reverse complement k-mers. More...
 
std::vector< double > signature_minimal_complementarity_frequencies (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the signature of a sequence that uses the minimum frequency of reverse complement k-mers. More...
 
std::vector< size_t > signature_ranks (Sequence const &sequence, SignatureSpecifications const &settings)
 Calcuate the rank signature of a sequence according to the settings. More...
 
std::vector< double > signature_reverse_identity_frequencies (Sequence const &sequence, SignatureSpecifications const &settings)
 Calculate the signature of a sequence that uses only the frequencies of k-mers whose reverse complement is the k-mer itself. More...
 
std::vector< size_t > signature_symmetrized_counts (Sequence const &sequence, SignatureSpecifications const &settings)
 Calcuate the symmetrized counts of the sequence according to the settings. More...
 
std::vector< double > signature_symmetrized_frequencies (Sequence const &sequence, SignatureSpecifications const &settings)
 Calcuate the symmetrized counts of the sequence according to the settings. More...
 
template<class T >
std::vector< T > signature_symmetrized_helper (std::vector< T > const &kmers, SignatureSpecifications const &settings)
 Local helper function that adds up the values for reverse complement k-mers. More...
 
std::vector< size_t > signature_symmetrized_ranks (Sequence const &sequence, SignatureSpecifications const &settings)
 Calcuate the symmetrized rank signature of a sequence according to the settings. More...