Skip to content

Commit

Permalink
Make --aemb work with -o
Browse files Browse the repository at this point in the history
Previously, output would always be sent to stdout, even when -o was
provided.
  • Loading branch information
marcelm committed Mar 5, 2024
1 parent 11aaa5c commit e1ea5ba
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ InputBuffer get_input_buffer(const CommandLineOptions& opt) {
}
}

void output_abundance(const std::vector<double>& abundances, const References& references){
void output_abundance(std::ostream& out, 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;
out << references.names[i] << '\t' << std::fixed << std::setprecision(6) << abundances[i] / double(references.sequences[i].size()) << std::endl;
}
}

Expand Down Expand Up @@ -349,11 +349,8 @@ int run_strobealign(int argc, char **argv) {
abundances[j] += worker_abundances[i][j];
}
}

// output the abundance file
output_abundance(abundances, references);
output_abundance(out, abundances, references);
}


logger.info() << "Total mapping sites tried: " << tot_statistics.tot_all_tried << std::endl
<< "Total calls to ssw: " << tot_statistics.tot_aligner_calls << std::endl
Expand Down

0 comments on commit e1ea5ba

Please sign in to comment.