Skip to content

Commit

Permalink
Merge pull request #564 from pangenome/fix_odgi_paths_non_ref
Browse files Browse the repository at this point in the history
`odgi paths ... --non-reference-ranges`: emit last non-ref path range, if any
  • Loading branch information
AndreaGuarracino authored Mar 14, 2024
2 parents ff88bfc + 81ee0e9 commit 14e313a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/subcommand/paths_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,22 @@ int main_paths(int argc, char** argv) {
step_range.push_back(step);
}
});

// Emit last non reference range, if any
if (end > start && (end - start) >= min_size_in_bp) {
if (_show_step_ranges) {
std::string step_range_str = "";
for (auto& step : step_range) {
const handle_t handle = graph.get_handle_of_step(step);
step_range_str += std::to_string(graph.get_id(handle)) + (graph.get_is_reverse(handle) ? "-" : "+") + ",";
}
#pragma omp critical (cout)
std::cout << graph.get_path_name(path) << "\t" << start << "\t" << end << "\t" << step_range_str.substr(0, step_range_str.size() - 1) << std::endl; // trim the trailing comma from step_range
} else {
#pragma omp critical (cout)
std::cout << graph.get_path_name(path) << "\t" << start << "\t" << end << std::endl;
}
}
}
}
}
Expand Down

0 comments on commit 14e313a

Please sign in to comment.