Skip to content

Commit

Permalink
Merge pull request #3482 from vgteam/surject-refuse-crash
Browse files Browse the repository at this point in the history
Don't try to stick together a spliced segment that surject refused to align
  • Loading branch information
jeizenga authored Nov 10, 2021
2 parents 0568631 + 3df0af5 commit 385fd63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/subcommand/surject_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ int main_surject(int argc, char** argv) {
if (spliced) {
surjector.min_splice_length = min_splice_length;
// we have to bump this up to be sure to align most splice junctions
surjector.max_subgraph_bases = 1024 * 1024;
surjector.max_subgraph_bases = 16 * 1024 * 1024;
}
else {
surjector.min_splice_length = numeric_limits<int64_t>::max();
Expand Down
8 changes: 6 additions & 2 deletions src/surjector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,8 @@ using namespace std;
return dist;
};

multipath_alignment_t surjected;

// checks whether the end of i is connected to the beginning of j by an edge


Expand Down Expand Up @@ -1650,6 +1652,8 @@ using namespace std;
backpointer[get<0>(edge)] = i;
}
else if (extended_score == score_dp[get<0>(edge)]
&& sections[i].path().mapping_size() != 0
&& sections[get<0>(edge)].path().mapping_size() != 0
&& backpointer[get<0>(edge)] >= 0
&& (abs<int64_t>(graph->get_position_of_step(section_path_ranges[i].first)
- graph->get_position_of_step(section_path_ranges[get<0>(edge)].first))
Expand Down Expand Up @@ -1694,7 +1698,6 @@ using namespace std;
}

// make an alignment to build out the path in
multipath_alignment_t surjected;
surjected.set_sequence(src_sequence);
surjected.set_quality(src_quality);
surjected.set_mapping_quality(src_mapping_quality);
Expand All @@ -1708,7 +1711,8 @@ using namespace std;
if (copy_path.mapping_size() == 0) {
// the DP chose a segment that was unsurjectable
path_range_out.first = path_range_out.second = graph->path_end(path_handle);
return make_null_mp_alignment(src_sequence, src_quality);
surjected = make_null_mp_alignment(src_sequence, src_quality);
return surjected;
}
#ifdef debug_spliced_surject
cerr << "appending path section " << pb2json(copy_path) << endl;
Expand Down

1 comment on commit 385fd63

@adamnovak
Copy link
Member

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 11023 seconds

Please sign in to comment.