Skip to content

Commit

Permalink
Attempt to fix edge case with insertions
Browse files Browse the repository at this point in the history
  • Loading branch information
niemasd committed Mar 6, 2024
1 parent 78ebe88 commit 2b3afcf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>

// global definitions/constants
#define VERSION "0.0.4"
#define VERSION "0.0.5"

// definitions/constants for argparsing
#define DEFAULT_NUM_THREADS 1
Expand Down
4 changes: 2 additions & 2 deletions count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ std::string compute_consensus(std::vector<std::array<COUNT_T, 5>> const & pos_co
std::string out; out.reserve(FASTA_STRING_RESERVE);
long unsigned int const pos_counts_size = pos_counts.size();
std::unordered_map<uint32_t, std::unordered_map<std::string, COUNT_T>>::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);
Expand Down Expand Up @@ -262,7 +262,7 @@ std::string compute_consensus(std::vector<std::array<COUNT_T, 5>> 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;
}
Expand Down

0 comments on commit 2b3afcf

Please sign in to comment.