4 #define MISMATCH_SCORE -1 11 #define MAX(A,B) ( ((A)>(B))?(A):(B) ) 14 char alignedA[ALEN+BLEN],
char alignedB[ALEN+BLEN],
15 int M[(ALEN+1)*(BLEN+1)],
char ptr[(ALEN+1)*(BLEN+1)]){
20 int a_str_idx, b_str_idx;
22 init_row:
for(a_idx=0; a_idx<(ALEN+1); a_idx++){
25 init_col:
for(b_idx=0; b_idx<(BLEN+1); b_idx++){
30 fill_out:
for(b_idx=1; b_idx<(BLEN+1); b_idx++){
31 fill_in:
for(a_idx=1; a_idx<(ALEN+1); a_idx++){
32 if(SEQA[a_idx-1] == SEQB[b_idx-1]){
38 row_up = (b_idx-1)*(ALEN+1);
39 row = (b_idx)*(ALEN+1);
41 up_left =
M[row_up + (a_idx-1)] + score;
45 max =
MAX(up_left,
MAX(up, left));
49 ptr[row + a_idx] =
SKIPB;
51 ptr[row + a_idx] =
SKIPA;
53 ptr[row + a_idx] =
ALIGN;
64 trace:
while(a_idx>0 || b_idx>0) {
66 if (ptr[r + a_idx] ==
ALIGN){
67 alignedA[a_str_idx++] = SEQA[a_idx-1];
68 alignedB[b_str_idx++] = SEQB[b_idx-1];
72 else if (ptr[r + a_idx] ==
SKIPB){
73 alignedA[a_str_idx++] = SEQA[a_idx-1];
74 alignedB[b_str_idx++] =
'-';
78 alignedA[a_str_idx++] =
'-';
79 alignedB[b_str_idx++] = SEQB[b_idx-1];
85 pad_a:
for( ; a_str_idx<ALEN+
BLEN; a_str_idx++ ) {
86 alignedA[a_str_idx] =
'_';
88 pad_b:
for( ; b_str_idx<ALEN+
BLEN; b_str_idx++ ) {
89 alignedB[b_str_idx] =
'_';
void needwun(char SEQA[ALEN], char SEQB[BLEN], char alignedA[ALEN+BLEN], char alignedB[ALEN+BLEN], int M[(ALEN+1) *(BLEN+1)], char ptr[(ALEN+1) *(BLEN+1)])