Skip to content

Commit

Permalink
check most_frequent_abundance
Browse files Browse the repository at this point in the history
  • Loading branch information
jermp committed Mar 1, 2022
1 parent c6db657 commit 9c52477
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions include/abundances.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions include/builder/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions include/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9c52477

Please sign in to comment.