Skip to content

Commit

Permalink
fix bug in softclip reconstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
jeizenga committed Jul 16, 2024
1 parent ef4624d commit ce756c2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/multipath_alignment_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6056,6 +6056,11 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
// figure out how long we need to try to align out to
size_t tail_length = alignment.sequence().end() - path_node.end;
size_t aligning_tail_length = min(tail_length, max_tail_length);
#ifdef debug_multipath_alignment
if (aligning_tail_length != tail_length) {
cerr << "trimming tail from length " << tail_length << " to " << aligning_tail_length << endl;
}
#endif
int64_t gap = min(max_gap, aligner->longest_detectable_gap(alignment.sequence().size() - tail_length + aligning_tail_length,
path_node.end - alignment.sequence().begin()));
if (pessimistic_tail_gap_multiplier) {
Expand Down Expand Up @@ -6104,7 +6109,7 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
auto& alt_alignments = right_alignments[j];

#ifdef debug_multipath_alignment
cerr << "making " << num_alt_alns << " alignments of sequence: " << right_tail_sequence.sequence() << endl << "to right tail graph" << endl;
cerr << "making " << num_alt_alns << " alignments of sequence: " << right_tail_sequence.sequence() << endl << "to right tail graph extracted from " << end_pos << endl;
tail_graph.for_each_handle([&](const handle_t& handle) {
cerr << tail_graph.get_id(handle) << " " << tail_graph.get_sequence(handle) << endl;
tail_graph.follow_edges(handle, true, [&](const handle_t& prev) {
Expand Down Expand Up @@ -6218,6 +6223,11 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
// figure out how far we need to try to align out to
size_t tail_length = path_node.begin - alignment.sequence().begin();
size_t aligning_tail_length = min(tail_length, max_tail_length);
#ifdef debug_multipath_alignment
if (aligning_tail_length != tail_length) {
cerr << "trimming tail from length " << tail_length << " to " << aligning_tail_length << endl;
}
#endif
int64_t gap = min(max_gap, aligner->longest_detectable_gap(alignment.sequence().size() - tail_length + aligning_tail_length,
aligning_tail_length));
if (pessimistic_tail_gap_multiplier) {
Expand Down Expand Up @@ -6256,17 +6266,17 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
// get the sequence remaining in the left tail
Alignment left_tail_sequence;
left_tail_sequence.set_sequence(alignment.sequence().substr(tail_length - aligning_tail_length,
path_node.begin - alignment.sequence().begin()));
aligning_tail_length));
if (!alignment.quality().empty()) {
left_tail_sequence.set_quality(alignment.quality().substr(tail_length - aligning_tail_length,
path_node.begin - alignment.sequence().begin()));
aligning_tail_length));
}

// And the place to put it
auto& alt_alignments = left_alignments[j];

#ifdef debug_multipath_alignment
cerr << "making " << num_alt_alns << " alignments of sequence: " << left_tail_sequence.sequence() << endl << "to left tail graph" << endl;
cerr << "making " << num_alt_alns << " alignments of sequence: " << left_tail_sequence.sequence() << endl << "to left tail graph extracted from " << begin_pos << endl;
tail_graph.for_each_handle([&](const handle_t& handle) {
cerr << tail_graph.get_id(handle) << " " << tail_graph.get_sequence(handle) << endl;
tail_graph.follow_edges(handle, false, [&](const handle_t& next) {
Expand Down

1 comment on commit ce756c2

@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 branch limit-surject-tails. View the full report here.

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

Please sign in to comment.