A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
consensus.cpp File Reference
#include "genesis/sequence/functions/consensus.hpp"
#include "genesis/sequence/counts.hpp"
#include "genesis/sequence/sequence_set.hpp"
#include "genesis/sequence/sequence.hpp"
#include "genesis/sequence/functions/codes.hpp"
#include "genesis/sequence/functions/functions.hpp"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdexcept>
#include <vector>

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
 

Typedefs

using CountPair = std::pair< size_t, char >
 Helper struct to store characters sorted by their count. More...
 

Functions

std::string consensus_sequence_cavener (SiteCounts const &counts, bool allow_gaps=true)
 Calculate a consensus sequence using the method by Cavener for nucleic acid codes ACGT and their ambiguities. More...
 
std::string consensus_sequence_cavener (SequenceSet const &sequences, bool allow_gaps=true)
 Calculate a consensus sequence using the method by Cavener for nucleic acid codes ACGT and their ambiguities. More...
 
template<typename CharSelector >
std::string consensus_sequence_template (SiteCounts const &counts, bool const allow_gaps, CharSelector const &char_selector)
 Local helper function template that handles the common code for the nucleic acid consensus sequence functions. More...
 
std::string consensus_sequence_with_ambiguities (SiteCounts const &counts, double similarity_factor=0.9, bool allow_gaps=true)
 Calculate a consensus sequence by using the most frequent characters at each site, for nucleic acid codes ACGT and their ambiguities. More...
 
std::string consensus_sequence_with_ambiguities (SequenceSet const &sequences, double similarity_factor=0.9, bool allow_gaps=true)
 Calculate a consensus sequence by using the most frequent characters at each site, for nucleic acid codes ACGT and their ambiguities. More...
 
std::string consensus_sequence_with_majorities (SiteCounts const &counts, bool allow_gaps=true, char gap_char= '-')
 Calculate the majority rule consensus sequence by using the most frequent character at each site. More...
 
std::string consensus_sequence_with_majorities (SequenceSet const &sequences, std::string const &characters, bool allow_gaps=true, char gap_char= '-')
 Calculate the majority rule consensus sequence by using the most frequent character at each site. More...
 
std::string consensus_sequence_with_majorities (SequenceSet const &sequences, bool allow_gaps=true)
 Calculate the majority rule consensus sequence by using the most frequent character at each site for nucleic acid codes ACGT. More...
 
std::string consensus_sequence_with_threshold (SiteCounts const &counts, double frequency_threshold=0.6, bool allow_gaps=true, bool use_ambiguities=true)
 Calculate a consensus sequence where the character frequency needs to be above a given threshold, for nucleic acid codes ACGT. More...
 
std::string consensus_sequence_with_threshold (SequenceSet const &sequences, double frequency_threshold=0.6, bool allow_gaps=true, bool use_ambiguities=true)
 Calculate a consensus sequence where the character frequency needs to be above a given threshold, for nucleic acid codes ACGT. More...
 
bool CountPairComparator (CountPair const &lhs, CountPair const &rhs)
 Local helper function to sort a CountPair. More...