Skip to content

Commit

Permalink
Merge pull request #206 from pangenome/fix_path_embedding
Browse files Browse the repository at this point in the history
Fix path embedding
  • Loading branch information
AndreaGuarracino authored Mar 18, 2024
2 parents ea36234 + 45314a0 commit 52a81b7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<XG>();

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -680,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
Expand Down Expand Up @@ -792,6 +793,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;

Expand Down

0 comments on commit 52a81b7

Please sign in to comment.