|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
58 std::array<size_t, 256> freqs;
59 for(
size_t i = 0; i < freqs.size(); ++i ) {
64 for(
auto const& s : seq ) {
69 std::map<char, size_t> result;
70 for(
size_t i = 0; i < freqs.size(); ++i ) {
82 std::array<size_t, 256> freqs;
83 for(
size_t i = 0; i < freqs.size(); ++i ) {
88 for(
auto const& seq : set ) {
89 for(
auto const& s : seq ) {
95 std::map<char, size_t> result;
96 for(
size_t i = 0; i < freqs.size(); ++i ) {
112 std::map<char, size_t>
const& sitehistogram,
113 std::string
const& plain_chars
116 std::map<char, double> result;
120 for(
auto const& shp : sitehistogram ) {
121 if( plain_chars.find( shp.first ) != std::string::npos ) {
127 for(
auto const& pc : plain_chars ) {
128 if( sitehistogram.count( pc )) {
129 result[pc] =
static_cast<double>( sitehistogram.at(pc) ) /
static_cast<double>(
sum );
155 lookup.set_selection_upper_lower( chars,
true );
158 for(
auto& s : set ) {
185 double ret =
static_cast<double>( gaps ) /
static_cast<double>( len );
186 assert( 0.0 <= ret && ret <= 1.0 );
193 for(
size_t site_idx = 0; site_idx < counts.
length(); ++site_idx ) {
194 bool all_gap_site =
true;
196 for(
size_t char_idx = 0; char_idx < counts.
characters().size(); ++char_idx ) {
197 all_gap_site &= ( counts.
count_at( char_idx, site_idx ) == 0 );
double sum(const Histogram &h)
Store counts of the occurence for certain characters at the sites of Sequences.
static std::map< char, double > base_frequencies_accumulator(std::map< char, size_t > const &sitehistogram, std::string const &plain_chars)
Local helper function that turns a site histogram into base frequencies.
size_t gap_site_count(SiteCounts const &counts)
size_t length() const
Return the number of sites used for counting.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Store a set of Sequences.
std::map< char, double > base_frequencies(Sequence const &seq, std::string const &plain_chars)
Get the base frequencies of the sites in a Sequence given the base chars.
size_t count_chars(SequenceSet const &set, std::string const &chars)
Count the number of occurrences of the given chars within the sites of the SequenceSet.
double gapyness(SequenceSet const &set, std::string const &gap_chars)
Return the "gapyness" of the Sequences, i.e., the proportion of gap chars and other completely undete...
std::map< char, size_t > site_histogram(Sequence const &seq)
Get a histogram of the occurrences of particular sites, given a Sequence.
CountsIntType count_at(size_t character_index, size_t site_index) const
Return the count for a character and a site, given their indices.
std::string characters() const
Return the character set that is used for counting.
size_t total_length(SequenceSet const &set)
Return the total length (sum) of all Sequences in the SequenceSet.