From 24c454f8dec68d9497d8d4a7ef69b0a00c1d8ca0 Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Mon, 18 Mar 2024 10:45:14 -0500 Subject: [PATCH 1/2] check number of paths too --- src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 4c6e359..04bca92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -411,6 +411,7 @@ int main(int argc, char **argv) { uint64_t block_count; + uint64_t number_of_paths_in_the_original_graph; { auto graph = std::make_unique(); @@ -441,6 +442,8 @@ int main(int argc, char **argv) { } } + number_of_paths_in_the_original_graph = graph->get_path_count(); + auto *blockset = new smoothxg::blockset_t(); smoothxg::smoothable_blocks(*graph, *blockset, @@ -792,6 +795,13 @@ int main(int argc, char **argv) { validate_progress.finish(); } + if (number_of_paths_in_the_original_graph != smoothed->get_path_count()) { + std::cerr << smoothxg_iter << "] error! path count mismatch between input (" + << number_of_paths_in_the_original_graph << ") and smoothed graph (" + << smoothed->get_path_count() << ")" << std::endl; + exit(1); + } + if (!consensus_mapping.empty()) { std::cerr << smoothxg_iter << "::smooth_and_lace] sorting consensus" << std::endl; From 45314a0099786b2025bf80c4cc0978fc914d06c9 Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Mon, 18 Mar 2024 11:37:25 -0500 Subject: [PATCH 2/2] fix condition --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 04bca92..b3d47e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -683,10 +683,8 @@ int main(int argc, char **argv) { prec_i = i; } } - if (path_mapping.size() == 1 || prec_i != path_mapping.size() - 1) { - smoothed->create_path_handle(path_handle_2_name_and_length[prec_path].first); - path_handle_2_start_and_end_in_path_mapping[prec_path] = std::make_pair(prec_i, path_mapping.size() - 1); - } + smoothed->create_path_handle(path_handle_2_name_and_length[prec_path].first); + path_handle_2_start_and_end_in_path_mapping[prec_path] = std::make_pair(prec_i, path_mapping.size() - 1); } // then for each path, ensure that it's embedded in the graph by walking through