Skip to content

Commit

Permalink
- typo :: gap_lineal => gap_linear
Browse files Browse the repository at this point in the history
- Unified ends-free and end2end code for termination
- Added support for indel, edit, and gap-linear (SW)
  • Loading branch information
smarco committed Feb 11, 2022
1 parent 0b1f66e commit e0dcb68
Show file tree
Hide file tree
Showing 37 changed files with 923 additions and 275 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SUBDIRS=alignment \
edit \
gap_affine \
gap_affine2p \
gap_lineal \
gap_linear \
system \
utils \
wavefront
Expand Down
4 changes: 2 additions & 2 deletions alignment/cigar.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ int cigar_score_edit(
}
return score;
}
int cigar_score_gap_lineal(
int cigar_score_gap_linear(
cigar_t* const cigar,
lineal_penalties_t* const penalties) {
linear_penalties_t* const penalties) {
int score = 0, i;
for (i=cigar->begin_offset;i<cigar->end_offset;++i) {
switch (cigar->operations[i]) {
Expand Down
6 changes: 3 additions & 3 deletions alignment/cigar.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "utils/commons.h"
#include "system/mm_allocator.h"
#include "gap_lineal/lineal_penalties.h"
#include "gap_linear/linear_penalties.h"
#include "gap_affine/affine_penalties.h"
#include "gap_affine2p/affine2p_penalties.h"

Expand Down Expand Up @@ -85,9 +85,9 @@ void cigar_add_mismatches(
*/
int cigar_score_edit(
cigar_t* const cigar);
int cigar_score_gap_lineal(
int cigar_score_gap_linear(
cigar_t* const cigar,
lineal_penalties_t* const penalties);
linear_penalties_t* const penalties);
int cigar_score_gap_affine(
cigar_t* const cigar,
affine_penalties_t* const penalties);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MODULES=benchmark_check \
benchmark_edit \
benchmark_gap_affine \
benchmark_gap_affine2p \
benchmark_gap_lineal \
benchmark_gap_linear \
benchmark_utils

SRCS=$(addsuffix .c, $(MODULES))
Expand Down
18 changes: 9 additions & 9 deletions benchmark/benchmark_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "benchmark/benchmark_check.h"
#include "alignment/score_matrix.h"
#include "edit/edit_dp.h"
#include "gap_lineal/nw.h"
#include "gap_linear/nw.h"
#include "gap_affine/affine_matrix.h"
#include "gap_affine/swg.h"

Expand Down Expand Up @@ -70,7 +70,7 @@ void benchmark_check_alignment_edit(
score_matrix_free(&score_matrix);
cigar_free(&cigar);
}
void benchmark_check_alignment_gap_lineal(
void benchmark_check_alignment_gap_linear(
align_input_t* const align_input,
cigar_t* const cigar_computed) {
// Compute correct
Expand All @@ -83,13 +83,13 @@ void benchmark_check_alignment_gap_lineal(
align_input->pattern_length+align_input->text_length,
align_input->mm_allocator);
nw_compute(&score_matrix,
align_input->check_lineal_penalties,
align_input->check_linear_penalties,
align_input->pattern,align_input->pattern_length,
align_input->text,align_input->text_length,&cigar);
const int score_correct = cigar_score_gap_lineal(
&cigar,align_input->check_lineal_penalties);
const int score_computed = cigar_score_gap_lineal(
cigar_computed,align_input->check_lineal_penalties);
const int score_correct = cigar_score_gap_linear(
&cigar,align_input->check_linear_penalties);
const int score_computed = cigar_score_gap_linear(
cigar_computed,align_input->check_linear_penalties);
// Check alignment
benchmark_check_alignment_using_solution(
align_input,cigar_computed,score_computed,
Expand Down Expand Up @@ -141,8 +141,8 @@ void benchmark_check_alignment(
(align_input->debug_flags & ALIGN_DEBUG_CHECK_ALIGNMENT)) {
if (align_input->debug_flags & ALIGN_DEBUG_CHECK_DISTANCE_METRIC_GAP_AFFINE) {
benchmark_check_alignment_gap_affine(align_input,cigar_computed);
} else if(align_input->debug_flags & ALIGN_DEBUG_CHECK_DISTANCE_METRIC_GAP_LINEAL) {
benchmark_check_alignment_gap_lineal(align_input,cigar_computed);
} else if(align_input->debug_flags & ALIGN_DEBUG_CHECK_DISTANCE_METRIC_GAP_LINEAR) {
benchmark_check_alignment_gap_linear(align_input,cigar_computed);
} else { // ALIGN_DEBUG_CHECK_DISTANCE_METRIC_EDIT
benchmark_check_alignment_edit(align_input,cigar_computed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
*
* PROJECT: Wavefront Alignments Algorithms
* AUTHOR(S): Santiago Marco-Sola <santiagomsola@gmail.com>
* DESCRIPTION: Gap-lineal alignment algorithms wrapper
* DESCRIPTION: Gap-linear alignment algorithms wrapper
*/

#include "benchmark/benchmark_gap_lineal.h"
#include "benchmark/benchmark_gap_linear.h"
#include "benchmark/benchmark_check.h"
#include "gap_lineal/nw.h"
#include "gap_linear/nw.h"

/*
* Benchmark NW
*/
void benchmark_gap_lineal_nw(
void benchmark_gap_linear_nw(
align_input_t* const align_input,
lineal_penalties_t* const penalties) {
linear_penalties_t* const penalties) {
// Allocate
score_matrix_t score_matrix;
score_matrix_allocate(
Expand All @@ -60,7 +60,7 @@ void benchmark_gap_lineal_nw(
}
// Output
if (align_input->output_file) {
const int score = cigar_score_gap_lineal(&cigar,penalties);
const int score = cigar_score_gap_linear(&cigar,penalties);
FILE* const output_file = align_input->output_file;
if (align_input->output_full) {
benchmark_print_output_full(output_file,align_input,score,&cigar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
*
* PROJECT: Wavefront Alignments Algorithms
* AUTHOR(S): Santiago Marco-Sola <santiagomsola@gmail.com>
* DESCRIPTION: Gap-lineal alignment algorithms wrapper
* DESCRIPTION: Gap-linear alignment algorithms wrapper
*/

#ifndef BENCHMARK_GAP_LINEAL_H_
#define BENCHMARK_GAP_LINEAL_H_
#ifndef BENCHMARK_GAP_LINEAR_H_
#define BENCHMARK_GAP_LINEAR_H_

#include "gap_lineal/nw.h"
#include "gap_linear/nw.h"
#include "benchmark/benchmark_utils.h"

/*
* Benchmark NW
*/
void benchmark_gap_lineal_nw(
void benchmark_gap_linear_nw(
align_input_t* const align_input,
lineal_penalties_t* const penalties);
linear_penalties_t* const penalties);

#endif /* BENCHMARK_GAP_LINEAL_H_ */
#endif /* BENCHMARK_GAP_LINEAR_H_ */
2 changes: 1 addition & 1 deletion benchmark/benchmark_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "benchmark/benchmark_utils.h"
#include "alignment/score_matrix.h"
#include "edit/edit_dp.h"
#include "gap_lineal/nw.h"
#include "gap_linear/nw.h"
#include "gap_affine/affine_matrix.h"
#include "gap_affine/swg.h"

Expand Down
4 changes: 2 additions & 2 deletions benchmark/benchmark_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define ALIGN_DEBUG_DISPLAY_INFO 0x00000008

#define ALIGN_DEBUG_CHECK_DISTANCE_METRIC_EDIT 0x00000010
#define ALIGN_DEBUG_CHECK_DISTANCE_METRIC_GAP_LINEAL 0x00000040
#define ALIGN_DEBUG_CHECK_DISTANCE_METRIC_GAP_LINEAR 0x00000040
#define ALIGN_DEBUG_CHECK_DISTANCE_METRIC_GAP_AFFINE 0x00000080

/*
Expand Down Expand Up @@ -87,7 +87,7 @@ typedef struct {
profiler_counter_t align_ins;
// DEBUG
int debug_flags;
lineal_penalties_t* check_lineal_penalties;
linear_penalties_t* check_linear_penalties;
affine_penalties_t* check_affine_penalties;
int check_bandwidth;
bool verbose;
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions gap_lineal/lineal_penalties.h → gap_linear/linear_penalties.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
*
* PROJECT: Wavefront Alignments Algorithms
* AUTHOR(S): Santiago Marco-Sola <santiagomsola@gmail.com>
* DESCRIPTION: Gap-lineal penalties
* DESCRIPTION: Gap-linear penalties
*/

#ifndef LINEAL_PENALTIES_H_
#define LINEAL_PENALTIES_H_
#ifndef LINEAR_PENALTIES_H_
#define LINEAR_PENALTIES_H_

typedef struct {
int match; // (Penalty representation; usually M <= 0)
int mismatch; // (Penalty representation; usually X > 0)
int insertion; // (Penalty representation; usually I > 0)
int deletion; // (Penalty representation; usually D > 0)
} lineal_penalties_t;
} linear_penalties_t;

#endif /* LINEAL_PENALTIES_H_ */
#endif /* LINEAR_PENALTIES_H_ */
8 changes: 4 additions & 4 deletions gap_lineal/nw.c → gap_linear/nw.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
* PROJECT: Wavefront Alignments Algorithms
* AUTHOR(S): Santiago Marco-Sola <santiagomsola@gmail.com>
* DESCRIPTION: Dynamic-programming alignment algorithm for computing
* gap-lineal pairwise alignment (Needleman-Wunsch - NW)
* gap-linear pairwise alignment (Needleman-Wunsch - NW)
*/

#include "gap_lineal/nw.h"
#include "gap_linear/nw.h"

/*
* NW Traceback
*/
void nw_traceback(
score_matrix_t* const score_matrix,
lineal_penalties_t* const penalties,
linear_penalties_t* const penalties,
cigar_t* const cigar) {
// Parameters
int** const dp = score_matrix->columns;
Expand Down Expand Up @@ -67,7 +67,7 @@ void nw_traceback(
}
void nw_compute(
score_matrix_t* const score_matrix,
lineal_penalties_t* const penalties,
linear_penalties_t* const penalties,
const char* const pattern,
const int pattern_length,
const char* const text,
Expand Down
4 changes: 2 additions & 2 deletions gap_lineal/nw.h → gap_linear/nw.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* PROJECT: Wavefront Alignments Algorithms
* AUTHOR(S): Santiago Marco-Sola <santiagomsola@gmail.com>
* DESCRIPTION: Dynamic-programming alignment algorithm for computing
* gap-lineal pairwise alignment (Needleman-Wunsch - NW)
* gap-linear pairwise alignment (Needleman-Wunsch - NW)
*/

#ifndef NW_H_
Expand All @@ -41,7 +41,7 @@
*/
void nw_compute(
score_matrix_t* const score_matrix,
lineal_penalties_t* const penalties,
linear_penalties_t* const penalties,
const char* const pattern,
const int pattern_length,
const char* const text,
Expand Down
Loading

0 comments on commit e0dcb68

Please sign in to comment.