From 3eb7e6c345a22ebc7071bf44e441011d953f900e Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Wed, 24 Apr 2024 14:58:25 -0700 Subject: [PATCH] hmr.cpp: ensuring the summary yaml output file reflects the HMRs written to the output file that passed the score cutoff --- src/analysis/hmr.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/analysis/hmr.cpp b/src/analysis/hmr.cpp index 882caed9..528e355c 100644 --- a/src/analysis/hmr.cpp +++ b/src/analysis/hmr.cpp @@ -574,15 +574,20 @@ main_hmr(int argc, const char **argv) { build_domains(cpgs, reset_points, state_ids, domains); std::ofstream of; - if (!outfile.empty()) of.open(outfile.c_str()); + if (!outfile.empty()) of.open(outfile); std::ostream out(outfile.empty() ? std::cout.rdbuf() : of.rdbuf()); size_t good_hmr_count = 0; for (auto i = 0u; i < size(domains); ++i) if (p_values[i] < domain_score_cutoff) { - domains[i].set_name("HYPO" + to_string(good_hmr_count++)); - out << domains[i] << '\n'; + domains[good_hmr_count] = domains[i]; + domains[good_hmr_count].set_name("HYPO" + to_string(good_hmr_count)); + ++good_hmr_count; } + domains.resize(good_hmr_count); + + for (const auto &d: domains) + out << d << '\n'; if (!hypo_post_outfile.empty()) { if (verbose)