Skip to content

Commit

Permalink
Patch to init last wavefront positions in case of (match!=0,ends-free) (
Browse files Browse the repository at this point in the history
fixes #84)
  • Loading branch information
smarco committed Sep 25, 2023
1 parent d09e0b2 commit d95d4e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion wavefront/wavefront_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ bool wavefront_compute_endsfree_required(
if (alg_form->text_begin_free == 0 &&
alg_form->pattern_begin_free == 0) return false;
if (score % (-penalties->match) != 0) return false;
// TODO: Missing condition (not added for efficiency)
// const int endsfree_k = score/(-penalties->match); // (h/v)-coordinate for boundary conditions
// const bool text_begin_free = (alg_form->text_begin_free >= endsfree_k);
// const bool pattern_begin_free = (alg_form->pattern_begin_free >= endsfree_k);
// if (!text_begin_free && !pattern_begin_free) return false;
// Ok
return true;
}
Expand Down Expand Up @@ -238,7 +243,7 @@ wavefront_t* wavefront_compute_endsfree_allocate_null(
wavefront_t* const wavefront = wavefront_slab_allocate(wavefront_slab,effective_lo,effective_hi);
wf_offset_t* const offsets = wavefront->offsets;
int k;
for (k=lo+1;k<hi;k++) {
for (k=lo;k<=hi;k++) {
offsets[k] = WAVEFRONT_OFFSET_NULL;
}
if (text_begin_free) {
Expand Down
2 changes: 1 addition & 1 deletion wavefront/wavefront_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void wavefront_display_print_element(
PRINT_CHAR_REP(stream,' ',bt_length-effective_pcigar_length);
}
} else {
fprintf(stream,"[ ]");
fprintf(stream,"[ *]");
PRINT_CHAR_REP(stream,' ',bt_length);
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions wavefront/wavefront_unialign.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ void wavefront_unialign_terminate(
/*
* Classic WF-Alignment (Unidirectional)
*/
#define WFA_UNIALIGN_DEBUG() wavefront_aligner_print(stderr,wf_aligner,0,score,7,0)
int wavefront_unialign(
wavefront_aligner_t* const wf_aligner) {
// Parameters
Expand All @@ -246,12 +247,12 @@ int wavefront_unialign(
int (*wf_align_extend)(wavefront_aligner_t* const,const int) = align_status->wf_align_extend;
// Compute wavefronts of increasing score
int score = align_status->score;
// WFA_UNIALIGN_DEBUG(); // DEBUG
while (true) {
// Exact extend s-wavefront
const int finished = (*wf_align_extend)(wf_aligner,score);
if (finished) {
// DEBUG
// wavefront_aligner_print(stderr,wf_aligner,0,score,7,0);
// WFA_UNIALIGN_DEBUG(); // DEBUG
if (align_status->status == WF_STATUS_END_REACHED ||
align_status->status == WF_STATUS_END_UNREACHABLE) {
wavefront_unialign_terminate(wf_aligner,score);
Expand All @@ -265,8 +266,7 @@ int wavefront_unialign(
if (wavefront_unialign_reached_limits(wf_aligner,score)) return align_status->status;
// Plot
if (wf_aligner->plot != NULL) wavefront_plot(wf_aligner,score,0);
// DEBUG
//wavefront_aligner_print(stderr,wf_aligner,score,score,7,0);
// WFA_UNIALIGN_DEBUG(); // DEBUG
}
// Unreachable code
return WF_STATUS_OK;
Expand Down

0 comments on commit d95d4e9

Please sign in to comment.