diff --git a/common.h b/common.h index a8b44c7..cb76951 100644 --- a/common.h +++ b/common.h @@ -13,7 +13,7 @@ #include // global definitions/constants -#define VERSION "0.0.4" +#define VERSION "0.0.5" // definitions/constants for argparsing #define DEFAULT_NUM_THREADS 1 diff --git a/count.cpp b/count.cpp index c638d62..e74561f 100644 --- a/count.cpp +++ b/count.cpp @@ -227,7 +227,7 @@ std::string compute_consensus(std::vector> const & pos_co std::string out; out.reserve(FASTA_STRING_RESERVE); long unsigned int const pos_counts_size = pos_counts.size(); std::unordered_map>::iterator ins_counts_it; - char best_pos_base; const std::string* best_ins_seq; double best_count; double tot_depth; + char best_pos_base; const std::string* best_ins_seq; long unsigned int best_count; long unsigned int tot_depth; for(long unsigned int pos = 0; pos <= pos_counts_size; ++pos) { // handle insertions before pos ins_counts_it = ins_counts.find(pos); @@ -262,7 +262,7 @@ std::string compute_consensus(std::vector> const & pos_co if(pos_counts[pos][4] > best_count) { best_count = pos_counts[pos][4]; best_pos_base = '-'; } - if(tot_depth >= user_args.min_depth && (best_count/tot_depth) > user_args.min_freq) { + if(tot_depth >= user_args.min_depth && best_count > tot_depth * user_args.min_freq) { if(best_pos_base != '-') { out += best_pos_base; }