Skip to content

Commit

Permalink
Factor wavefronts -> wavefront
Browse files Browse the repository at this point in the history
  • Loading branch information
smarco committed Jul 25, 2022
1 parent 0a2f047 commit bc9aee9
Show file tree
Hide file tree
Showing 12 changed files with 595 additions and 595 deletions.
896 changes: 448 additions & 448 deletions tests/wfa.utest.log

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions wavefront/wavefront_aligner.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ void wavefront_aligner_init_penalties(
wavefront_aligner_attr_t* const attributes) {
switch (attributes->distance_metric) {
case indel:
wavefronts_penalties_set_indel(&wf_aligner->penalties);
wavefront_penalties_set_indel(&wf_aligner->penalties);
break;
case edit:
wavefronts_penalties_set_edit(&wf_aligner->penalties);
wavefront_penalties_set_edit(&wf_aligner->penalties);
break;
case gap_linear:
wavefronts_penalties_set_linear(
wavefront_penalties_set_linear(
&wf_aligner->penalties,
&attributes->linear_penalties);
break;
case gap_affine:
wavefronts_penalties_set_affine(
wavefront_penalties_set_affine(
&wf_aligner->penalties,
&attributes->affine_penalties);
break;
case gap_affine_2p:
wavefronts_penalties_set_affine2p(
wavefront_penalties_set_affine2p(
&wf_aligner->penalties,
&attributes->affine2p_penalties);
break;
Expand Down
2 changes: 1 addition & 1 deletion wavefront/wavefront_aligner.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ typedef struct _wavefront_aligner_t {
// Alignment Attributes
alignment_scope_t alignment_scope; // Alignment scope (score only or full-CIGAR)
alignment_form_t alignment_form; // Alignment form (end-to-end/ends-free)
wavefronts_penalties_t penalties; // Alignment penalties
wavefront_penalties_t penalties; // Alignment penalties
wavefront_heuristic_t heuristic; // Heuristic's parameters
wavefront_memory_t memory_mode; // Wavefront memory strategy (modular wavefronts and piggyback)
// Wavefront components
Expand Down
72 changes: 36 additions & 36 deletions wavefront/wavefront_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef enum {
/*
* Backtrace Trace Patch Match/Mismsmatch
*/
int64_t wavefronts_backtrace_misms(
int64_t wavefront_backtrace_misms(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -74,7 +74,7 @@ int64_t wavefronts_backtrace_misms(
return WAVEFRONT_OFFSET_NULL;
}
}
void wavefronts_backtrace_matches(
void wavefront_backtrace_matches(
wavefront_aligner_t* const wf_aligner,
const int k,
wf_offset_t offset,
Expand All @@ -101,7 +101,7 @@ void wavefronts_backtrace_matches(
/*
* Backtrace Trace Patch Deletion
*/
int64_t wavefronts_backtrace_del1_open(
int64_t wavefront_backtrace_del1_open(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -115,7 +115,7 @@ int64_t wavefronts_backtrace_del1_open(
return WAVEFRONT_OFFSET_NULL;
}
}
int64_t wavefronts_backtrace_del2_open(
int64_t wavefront_backtrace_del2_open(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -129,7 +129,7 @@ int64_t wavefronts_backtrace_del2_open(
return WAVEFRONT_OFFSET_NULL;
}
}
int64_t wavefronts_backtrace_del1_ext(
int64_t wavefront_backtrace_del1_ext(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -143,7 +143,7 @@ int64_t wavefronts_backtrace_del1_ext(
return WAVEFRONT_OFFSET_NULL;
}
}
int64_t wavefronts_backtrace_del2_ext(
int64_t wavefront_backtrace_del2_ext(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -160,7 +160,7 @@ int64_t wavefronts_backtrace_del2_ext(
/*
* Backtrace Trace Patch Insertion
*/
int64_t wavefronts_backtrace_ins1_open(
int64_t wavefront_backtrace_ins1_open(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -174,7 +174,7 @@ int64_t wavefronts_backtrace_ins1_open(
return WAVEFRONT_OFFSET_NULL;
}
}
int64_t wavefronts_backtrace_ins2_open(
int64_t wavefront_backtrace_ins2_open(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -188,7 +188,7 @@ int64_t wavefronts_backtrace_ins2_open(
return WAVEFRONT_OFFSET_NULL;
}
}
int64_t wavefronts_backtrace_ins1_ext(
int64_t wavefront_backtrace_ins1_ext(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -202,7 +202,7 @@ int64_t wavefronts_backtrace_ins1_ext(
return WAVEFRONT_OFFSET_NULL;
}
}
int64_t wavefronts_backtrace_ins2_ext(
int64_t wavefront_backtrace_ins2_ext(
wavefront_aligner_t* const wf_aligner,
const int score,
const int k) {
Expand All @@ -228,7 +228,7 @@ void wavefront_backtrace_linear(
const int pattern_length = wf_aligner->pattern_length;
const int text_length = wf_aligner->text_length;
const distance_metric_t distance_metric = wf_aligner->penalties.distance_metric;
const wavefronts_penalties_t* const wavefront_penalties = &(wf_aligner->penalties);
const wavefront_penalties_t* const wavefront_penalties = &(wf_aligner->penalties);
// Prepare cigar
cigar_t* const cigar = wf_aligner->cigar;
cigar->end_offset = cigar->max_operations - 1;
Expand Down Expand Up @@ -256,15 +256,15 @@ void wavefront_backtrace_linear(
const int gap_open1 = score - wavefront_penalties->gap_opening1;
// Compute source offsets
const int64_t misms = (distance_metric != indel) ?
wavefronts_backtrace_misms(wf_aligner,mismatch,k) :
wavefront_backtrace_misms(wf_aligner,mismatch,k) :
WAVEFRONT_OFFSET_NULL;
const int64_t ins = wavefronts_backtrace_ins1_open(wf_aligner,gap_open1,k);
const int64_t del = wavefronts_backtrace_del1_open(wf_aligner,gap_open1,k);
const int64_t ins = wavefront_backtrace_ins1_open(wf_aligner,gap_open1,k);
const int64_t del = wavefront_backtrace_del1_open(wf_aligner,gap_open1,k);
const int64_t max_all = MAX(misms,MAX(ins,del));
// Traceback Matches
const int max_offset = BACKTRACE_PIGGYBACK_GET_OFFSET(max_all);
const int num_matches = offset - max_offset;
wavefronts_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
wavefront_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
offset = max_offset;
// Update coordinates
v = WAVEFRONT_V(k,offset);
Expand Down Expand Up @@ -301,7 +301,7 @@ void wavefront_backtrace_linear(
if (v > 0 && h > 0) { // score == 0
// Account for beginning series of matches
const int num_matches = MIN(v,h);
wavefronts_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
wavefront_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
v -= num_matches;
h -= num_matches;
}
Expand All @@ -323,7 +323,7 @@ void wavefront_backtrace_affine(
const int pattern_length = wf_aligner->pattern_length;
const int text_length = wf_aligner->text_length;
const distance_metric_t distance_metric = wf_aligner->penalties.distance_metric;
const wavefronts_penalties_t* const wavefront_penalties = &(wf_aligner->penalties);
const wavefront_penalties_t* const wavefront_penalties = &(wf_aligner->penalties);
// Prepare cigar
cigar_t* const cigar = wf_aligner->cigar;
cigar->end_offset = cigar->max_operations - 1;
Expand Down Expand Up @@ -359,48 +359,48 @@ void wavefront_backtrace_affine(
int64_t max_all;
switch (matrix_type) {
case affine2p_matrix_M: {
const int64_t misms = wavefronts_backtrace_misms(wf_aligner,mismatch,k);
const int64_t ins1_open = wavefronts_backtrace_ins1_open(wf_aligner,gap_open1,k);
const int64_t ins1_ext = wavefronts_backtrace_ins1_ext(wf_aligner,gap_extend1,k);
const int64_t misms = wavefront_backtrace_misms(wf_aligner,mismatch,k);
const int64_t ins1_open = wavefront_backtrace_ins1_open(wf_aligner,gap_open1,k);
const int64_t ins1_ext = wavefront_backtrace_ins1_ext(wf_aligner,gap_extend1,k);
const int64_t max_ins1 = MAX(ins1_open,ins1_ext);
const int64_t del1_open = wavefronts_backtrace_del1_open(wf_aligner,gap_open1,k);
const int64_t del1_ext = wavefronts_backtrace_del1_ext(wf_aligner,gap_extend1,k);
const int64_t del1_open = wavefront_backtrace_del1_open(wf_aligner,gap_open1,k);
const int64_t del1_ext = wavefront_backtrace_del1_ext(wf_aligner,gap_extend1,k);
const int64_t max_del1 = MAX(del1_open,del1_ext);
if (distance_metric == gap_affine) {
max_all = MAX(misms,MAX(max_ins1,max_del1)); break;
}
const int64_t ins2_open = wavefronts_backtrace_ins2_open(wf_aligner,gap_open2,k);
const int64_t ins2_ext = wavefronts_backtrace_ins2_ext(wf_aligner,gap_extend2,k);
const int64_t ins2_open = wavefront_backtrace_ins2_open(wf_aligner,gap_open2,k);
const int64_t ins2_ext = wavefront_backtrace_ins2_ext(wf_aligner,gap_extend2,k);
const int64_t max_ins2 = MAX(ins2_open,ins2_ext);
const int64_t del2_open = wavefronts_backtrace_del2_open(wf_aligner,gap_open2,k);
const int64_t del2_ext = wavefronts_backtrace_del2_ext(wf_aligner,gap_extend2,k);
const int64_t del2_open = wavefront_backtrace_del2_open(wf_aligner,gap_open2,k);
const int64_t del2_ext = wavefront_backtrace_del2_ext(wf_aligner,gap_extend2,k);
const int64_t max_del2 = MAX(del2_open,del2_ext);
const int64_t max_ins = MAX(max_ins1,max_ins2);
const int64_t max_del = MAX(max_del1,max_del2);
max_all = MAX(misms,MAX(max_ins,max_del));
break;
}
case affine2p_matrix_I1: {
const int64_t ins1_open = wavefronts_backtrace_ins1_open(wf_aligner,gap_open1,k);
const int64_t ins1_ext = wavefronts_backtrace_ins1_ext(wf_aligner,gap_extend1,k);
const int64_t ins1_open = wavefront_backtrace_ins1_open(wf_aligner,gap_open1,k);
const int64_t ins1_ext = wavefront_backtrace_ins1_ext(wf_aligner,gap_extend1,k);
max_all = MAX(ins1_open,ins1_ext);
break;
}
case affine2p_matrix_I2: {
const int64_t ins2_open = wavefronts_backtrace_ins2_open(wf_aligner,gap_open2,k);
const int64_t ins2_ext = wavefronts_backtrace_ins2_ext(wf_aligner,gap_extend2,k);
const int64_t ins2_open = wavefront_backtrace_ins2_open(wf_aligner,gap_open2,k);
const int64_t ins2_ext = wavefront_backtrace_ins2_ext(wf_aligner,gap_extend2,k);
max_all = MAX(ins2_open,ins2_ext);
break;
}
case affine2p_matrix_D1: {
const int64_t del1_open = wavefronts_backtrace_del1_open(wf_aligner,gap_open1,k);
const int64_t del1_ext = wavefronts_backtrace_del1_ext(wf_aligner,gap_extend1,k);
const int64_t del1_open = wavefront_backtrace_del1_open(wf_aligner,gap_open1,k);
const int64_t del1_ext = wavefront_backtrace_del1_ext(wf_aligner,gap_extend1,k);
max_all = MAX(del1_open,del1_ext);
break;
}
case affine2p_matrix_D2: {
const int64_t del2_open = wavefronts_backtrace_del2_open(wf_aligner,gap_open2,k);
const int64_t del2_ext = wavefronts_backtrace_del2_ext(wf_aligner,gap_extend2,k);
const int64_t del2_open = wavefront_backtrace_del2_open(wf_aligner,gap_open2,k);
const int64_t del2_ext = wavefront_backtrace_del2_ext(wf_aligner,gap_extend2,k);
max_all = MAX(del2_open,del2_ext);
break;
}
Expand All @@ -413,7 +413,7 @@ void wavefront_backtrace_affine(
if (matrix_type == affine2p_matrix_M) {
const int max_offset = BACKTRACE_PIGGYBACK_GET_OFFSET(max_all);
const int num_matches = offset - max_offset;
wavefronts_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
wavefront_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
offset = max_offset;
// Update coordinates
v = WAVEFRONT_V(k,offset);
Expand Down Expand Up @@ -497,7 +497,7 @@ void wavefront_backtrace_affine(
if (v > 0 && h > 0) { // score == 0
// Account for beginning series of matches
const int num_matches = MIN(v,h);
wavefronts_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
wavefront_backtrace_matches(wf_aligner,k,offset,num_matches,cigar);
v -= num_matches;
h -= num_matches;
}
Expand Down
12 changes: 6 additions & 6 deletions wavefront/wavefront_components.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void wavefront_components_dimensions_edit(
}
void wavefront_components_dimensions_linear(
wavefront_components_t* const wf_components,
wavefronts_penalties_t* const penalties,
wavefront_penalties_t* const penalties,
const int max_pattern_length,
const int max_text_length,
int* const max_score_scope,
Expand All @@ -79,7 +79,7 @@ void wavefront_components_dimensions_linear(
}
void wavefront_components_dimensions_affine(
wavefront_components_t* const wf_components,
wavefronts_penalties_t* const penalties,
wavefront_penalties_t* const penalties,
const int max_pattern_length,
const int max_text_length,
int* const max_score_scope,
Expand All @@ -99,7 +99,7 @@ void wavefront_components_dimensions_affine(
}
void wavefront_components_dimensions_affine2p(
wavefront_components_t* const wf_components,
wavefronts_penalties_t* const penalties,
wavefront_penalties_t* const penalties,
const int max_pattern_length,
const int max_text_length,
int* const max_score_scope,
Expand All @@ -123,7 +123,7 @@ void wavefront_components_dimensions_affine2p(
}
void wavefront_components_dimensions(
wavefront_components_t* const wf_components,
wavefronts_penalties_t* const penalties,
wavefront_penalties_t* const penalties,
const int max_pattern_length,
const int max_text_length,
int* const max_score_scope,
Expand Down Expand Up @@ -195,7 +195,7 @@ void wavefront_components_allocate(
wavefront_components_t* const wf_components,
const int max_pattern_length,
const int max_text_length,
wavefronts_penalties_t* const penalties,
wavefront_penalties_t* const penalties,
const bool memory_modular,
const bool bt_piggyback,
mm_allocator_t* const mm_allocator) {
Expand Down Expand Up @@ -279,7 +279,7 @@ void wavefront_components_resize(
wavefront_components_t* const wf_components,
const int max_pattern_length,
const int max_text_length,
wavefronts_penalties_t* const penalties) {
wavefront_penalties_t* const penalties) {
// Compute dimensions
int num_wavefronts = 0;
wavefront_components_dimensions(
Expand Down
4 changes: 2 additions & 2 deletions wavefront/wavefront_components.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void wavefront_components_allocate(
wavefront_components_t* const wf_components,
const int max_pattern_length,
const int max_text_length,
wavefronts_penalties_t* const penalties,
wavefront_penalties_t* const penalties,
const bool memory_modular,
const bool bt_piggyback,
mm_allocator_t* const mm_allocator);
Expand All @@ -88,7 +88,7 @@ void wavefront_components_resize(
wavefront_components_t* const wf_components,
const int max_pattern_length,
const int max_text_length,
wavefronts_penalties_t* const penalties);
wavefront_penalties_t* const penalties);
void wavefront_components_resize_null__victim(
wavefront_components_t* const wf_components,
const int lo,
Expand Down
2 changes: 1 addition & 1 deletion wavefront/wavefront_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void wavefront_compute_fetch_input(
wavefront_components_t* const wf_components = &wf_aligner->wf_components;
const distance_metric_t distance_metric = wf_aligner->penalties.distance_metric;
// Compute scores
const wavefronts_penalties_t* const penalties = &(wf_aligner->penalties);
const wavefront_penalties_t* const penalties = &(wf_aligner->penalties);
if (distance_metric == gap_linear) {
int mismatch = score - penalties->mismatch;
int gap_open1 = score - penalties->gap_opening1;
Expand Down
4 changes: 2 additions & 2 deletions wavefront/wavefront_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void wavefront_report_lite(
fprintf(stream,",");
wavefront_aligner_print_scope(stream,wf_aligner);
fprintf(stream,",");
wavefronts_penalties_print(stream,&wf_aligner->penalties);
wavefront_penalties_print(stream,&wf_aligner->penalties);
fprintf(stream,"]\t");
cigar_print(stream,wf_aligner->cigar,true);
if (wf_aligner->match_funct != NULL) {
Expand Down Expand Up @@ -179,7 +179,7 @@ void wavefront_report_verbose_begin(
wf_aligner->system.max_alignment_score);
// Penalties
fprintf(stream," Penalties=");
wavefronts_penalties_print(stream,&wf_aligner->penalties);
wavefront_penalties_print(stream,&wf_aligner->penalties);
// Heuristic
fprintf(stream," Heuristic=");
wavefront_heuristic_print(stream,&wf_aligner->heuristic);
Expand Down
2 changes: 1 addition & 1 deletion wavefront/wavefront_heuristic.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void wavefront_heuristic_zdrop(
wf_aligner,wavefront,score,sw_scores,
&cmax_sw_score,&cmax_k,&cmax_offset);
// Apply Z-Drop
wavefronts_penalties_t* const penalties = &wf_aligner->penalties;
wavefront_penalties_t* const penalties = &wf_aligner->penalties;
const int gap_e = (penalties->gap_extension1 > 0) ? penalties->gap_extension1 : 1;
const int zdrop = wf_heuristic->zdrop;
const int max_sw_score = wf_heuristic->max_sw_score;
Expand Down
Loading

0 comments on commit bc9aee9

Please sign in to comment.