Skip to content

Commit

Permalink
Merge pull request #4513 from vgteam/skip-nonexistent-nodes
Browse files Browse the repository at this point in the history
Don't extract nodes in ranges that didn't actually exist in the source graph
  • Loading branch information
adamnovak authored Jan 31, 2025
2 parents 5e13d76 + b64e48a commit 511f840
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/algorithms/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void extract_context(const HandleGraph& source, MutableHandleGraph& subgraph, co

void extract_id_range(const HandleGraph& source, const nid_t& id1, const nid_t& id2, MutableHandleGraph& subgraph) {
for (nid_t i = id1; i <= id2; ++i) {
if (!subgraph.has_node(i)) {
if (!subgraph.has_node(i) && source.has_node(i)) {
subgraph.create_handle(source.get_sequence(source.get_handle(i)), i);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/chunker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class PathChunker {

/**
* Like above, but use (inclusive) id range instead of region on path.
*
* Skips nodes in the ID range that do not actually exist in the source
* graph, or that already exist in the target graph.
*/
void extract_id_range(vg::id_t start, vg::id_t end, int64_t context, int64_t length, bool forward_only,
MutablePathMutableHandleGraph& subgraph, Region& out_region);
Expand Down

1 comment on commit 511f840

@adamnovak
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for merge to master. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 17336 seconds

Please sign in to comment.