Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
psj1997 committed Feb 26, 2024
1 parent 383515d commit 8c32350
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/aln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,21 +936,21 @@ inline void get_best_map_location(
std::make_pair(std::cref(nams2), read2_len) }) {
size_t best_score = 0;
// We loop twice because we need to count the number of NAMs with best score
for (auto &t : nams) {
if (t.score == nams[0].score){
for (auto &nam : nams) {
if (nam.score == nams[0].score){
++best_score;
} else {
break;
}
}
for (auto &t: nams) {
if (t.ref_start < 0) {
for (auto &nam: nams) {
if (nam.ref_start < 0) {
continue;
}
if (t.score != nams[0].score){
if (nam.score != nams[0].score){
break;
}
abundances[t.ref_id] += float(read_len) / float(best_score);
abundances[nam.ref_id] += float(read_len) / float(best_score);
}
}
}
Expand Down Expand Up @@ -1181,14 +1181,14 @@ void align_or_map_single(
}
}

for (auto &t: nams) {
if (t.ref_start < 0) {
for (auto &nam: nams) {
if (nam.ref_start < 0) {
continue;
}
if (t.score != nams[0].score){
if (nam.score != nams[0].score){
break;
}
abundances[t.ref_id] += float(record.seq.length()) / float(n_best);
abundances[nam.ref_id] += float(record.seq.length()) / float(n_best);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ InputBuffer get_input_buffer(const CommandLineOptions& opt) {
}
}

void output_abundance(std::vector<double> abundances, References references){
void output_abundance(const std::vector<double> abundances, const References references){
for (size_t i = 0; i < references.size(); ++i) {
std::cout << references.names[i] << '\t' << std::fixed << std::setprecision(6) << abundances[i] / double(references.sequences[i].size()) << std::endl;
}
Expand Down

0 comments on commit 8c32350

Please sign in to comment.