Skip to content

Commit

Permalink
Fixed insertion issue
Browse files Browse the repository at this point in the history
  • Loading branch information
niemasd committed Mar 6, 2024
1 parent 2b3afcf commit f08402b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,20 @@ 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; long unsigned int best_count; long unsigned int tot_depth;
char best_pos_base; 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);
if(ins_counts_it != ins_counts.end()) {
best_count = 0; tot_depth = 0;
best_count = 0; tot_depth = 0; best_ins_seq = "";
for(auto curr_ins : ins_counts_it->second) {
tot_depth += curr_ins.second;
if(curr_ins.second > best_count) {
best_count = curr_ins.second; best_ins_seq = &(curr_ins.first);
best_count = curr_ins.second; best_ins_seq = curr_ins.first;
}
}
if(tot_depth >= user_args.min_depth && (best_count/tot_depth) > user_args.min_freq) {
out += (*best_ins_seq);
if(tot_depth >= user_args.min_depth && best_count > tot_depth * user_args.min_freq) {
out += best_ins_seq;
}
}

Expand Down

0 comments on commit f08402b

Please sign in to comment.