diff --git a/include/abundances.hpp b/include/abundances.hpp index ef3c5ce..f4a1a58 100644 --- a/include/abundances.hpp +++ b/include/abundances.hpp @@ -80,6 +80,13 @@ struct abundances { return x.first < y.first; }); + /* If this tests fails, then we need to change the value of + constants::most_frequent_abundance */ + if (m_most_frequent_abundance != m_abundances.front().first) { + throw std::runtime_error("the most frequent abundance is not " + + std::to_string(constants::most_frequent_abundance)); + } + uint64_t rest = num_kmers - m_abundances.front().second; std::cout << "kmers that do not have the most frequent ab: " << rest << " (" << (rest * 100.0) / num_kmers << "%)" << std::endl; diff --git a/include/builder/build.cpp b/include/builder/build.cpp index 1c3e980..fc95df6 100644 --- a/include/builder/build.cpp +++ b/include/builder/build.cpp @@ -89,8 +89,7 @@ void parse_file(std::istream& is, parse_data& data, build_configuration const& b }; uint64_t seq_len = 0; - constexpr uint64_t most_frequent_abundance = 1; - data.abundances_builder.init(most_frequent_abundance); + data.abundances_builder.init(constants::most_frequent_abundance); /* intervals of kmer_ids */ uint64_t kmer_id_value = constants::invalid; @@ -145,7 +144,7 @@ void parse_file(std::istream& is, parse_data& data, build_configuration const& b data.abundances_builder.eat(ab); - if (ab != most_frequent_abundance) { + if (ab != constants::most_frequent_abundance) { if (kmer_id_value == constants::invalid) { kmer_id_value = num_kmers; kmer_id_length = 1; diff --git a/include/util.hpp b/include/util.hpp index 105a058..c33172c 100644 --- a/include/util.hpp +++ b/include/util.hpp @@ -17,6 +17,7 @@ constexpr uint64_t hashcode_bits = 64; constexpr double c = 3.0; // for PThash constexpr uint64_t min_l = 6; constexpr uint64_t max_l = 12; +constexpr uint64_t most_frequent_abundance = 1; // usual value } // namespace constants typedef pthash::murmurhash2_64 base_hasher_type;