diff --git a/alignment/cigar.c b/alignment/cigar.c index dea0c12..5f054f9 100644 --- a/alignment/cigar.c +++ b/alignment/cigar.c @@ -696,7 +696,8 @@ void cigar_print( // Check null if (cigar_is_null(cigar)) return; // Generate and print operations - char* const buffer = malloc(2*(cigar->end_offset-cigar->begin_offset)+10); + const int buffer_length = 2*(cigar->end_offset-cigar->begin_offset)+20; + char* const buffer = malloc(buffer_length); cigar_sprint(buffer,cigar,print_matches); fprintf(stream,"%s",buffer); // Print // Free @@ -744,7 +745,8 @@ void cigar_print_SAM_CIGAR( // Check null if (cigar_is_null(cigar)) return; // Generate and print operations - char* const buffer = malloc(2*(cigar->end_offset-cigar->begin_offset)); + const int buffer_length = 4*(cigar->end_offset-cigar->begin_offset)+20; + char* const buffer = malloc(buffer_length); cigar_sprint_SAM_CIGAR(buffer,cigar,show_mismatches); fprintf(stream,"%s",buffer); // Print // Free diff --git a/wavefront/wavefront_compute.c b/wavefront/wavefront_compute.c index 09d3b28..eb2bd27 100644 --- a/wavefront/wavefront_compute.c +++ b/wavefront/wavefront_compute.c @@ -133,11 +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; + // Check boundary conditions for ends-free + 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; } @@ -254,6 +254,9 @@ wavefront_t* wavefront_compute_endsfree_allocate_null( } wavefront->lo = lo; wavefront->hi = hi; + // Set max/min init elements + wavefront->wf_elements_init_min = lo; + wavefront->wf_elements_init_max = hi; // Return return wavefront; }