-
Notifications
You must be signed in to change notification settings - Fork 21
/
search63.cc
90 lines (73 loc) · 2.05 KB
/
search63.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
SWIPE
Smith-Waterman database searches with Inter-sequence Parallel Execution
Copyright (C) 2008-2013 Torbjorn Rognes, University of Oslo,
Oslo University Hospital and Sencel Bioinformatics AS
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Torbjorn Rognes <[email protected]>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
*/
#include "swipe.h"
long fullsw(char * dseq,
char * dend,
char * qseq,
char * qend,
long * hearray,
long * score_matrix,
BYTE gapopenextend,
BYTE gapextend)
{
long h, n, e, f, s;
long *hep;
char *qp, *dp;
long * sp;
s = 0;
dp = dseq;
memset(hearray, 0, 2 * sizeof(long) * (qend-qseq));
while (dp < dend)
{
f = 0;
h = 0;
hep = hearray;
qp = qseq;
sp = score_matrix + (*dp << 5);
while (qp < qend)
{
n = *hep;
e = *(hep+1);
h += sp[(int)(*qp)];
if (e > h)
h = e;
if (f > h)
h = f;
if (h < 0)
h = 0;
if (h > s)
s = h;
*hep = h;
e -= gapextend;
f -= gapextend;
h -= gapopenextend;
if (h > e)
e = h;
if (h > f)
f = h;
*(hep+1) = e;
h = n;
hep += 2;
qp++;
}
dp++;
}
return s;
}