minimap2 0.2.22.0 → 0.2.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +60 -76
- data/ext/Rakefile +55 -0
- data/ext/cmappy/cmappy.c +129 -0
- data/ext/cmappy/cmappy.h +44 -0
- data/ext/minimap2/FAQ.md +46 -0
- data/ext/minimap2/LICENSE.txt +24 -0
- data/ext/minimap2/MANIFEST.in +10 -0
- data/ext/minimap2/Makefile +132 -0
- data/ext/minimap2/Makefile.simde +97 -0
- data/ext/minimap2/NEWS.md +821 -0
- data/ext/minimap2/README.md +403 -0
- data/ext/minimap2/align.c +1020 -0
- data/ext/minimap2/bseq.c +169 -0
- data/ext/minimap2/bseq.h +64 -0
- data/ext/minimap2/code_of_conduct.md +30 -0
- data/ext/minimap2/cookbook.md +243 -0
- data/ext/minimap2/esterr.c +64 -0
- data/ext/minimap2/example.c +63 -0
- data/ext/minimap2/format.c +559 -0
- data/ext/minimap2/hit.c +466 -0
- data/ext/minimap2/index.c +775 -0
- data/ext/minimap2/kalloc.c +205 -0
- data/ext/minimap2/kalloc.h +76 -0
- data/ext/minimap2/kdq.h +132 -0
- data/ext/minimap2/ketopt.h +120 -0
- data/ext/minimap2/khash.h +615 -0
- data/ext/minimap2/krmq.h +474 -0
- data/ext/minimap2/kseq.h +256 -0
- data/ext/minimap2/ksort.h +153 -0
- data/ext/minimap2/ksw2.h +184 -0
- data/ext/minimap2/ksw2_dispatch.c +96 -0
- data/ext/minimap2/ksw2_extd2_sse.c +402 -0
- data/ext/minimap2/ksw2_exts2_sse.c +416 -0
- data/ext/minimap2/ksw2_extz2_sse.c +313 -0
- data/ext/minimap2/ksw2_ll_sse.c +152 -0
- data/ext/minimap2/kthread.c +159 -0
- data/ext/minimap2/kthread.h +15 -0
- data/ext/minimap2/kvec.h +105 -0
- data/ext/minimap2/lchain.c +369 -0
- data/ext/minimap2/main.c +459 -0
- data/ext/minimap2/map.c +714 -0
- data/ext/minimap2/minimap.h +410 -0
- data/ext/minimap2/minimap2.1 +725 -0
- data/ext/minimap2/misc/README.md +179 -0
- data/ext/minimap2/misc/mmphase.js +335 -0
- data/ext/minimap2/misc/paftools.js +3149 -0
- data/ext/minimap2/misc.c +162 -0
- data/ext/minimap2/mmpriv.h +132 -0
- data/ext/minimap2/options.c +234 -0
- data/ext/minimap2/pe.c +177 -0
- data/ext/minimap2/python/README.rst +196 -0
- data/ext/minimap2/python/cmappy.h +152 -0
- data/ext/minimap2/python/cmappy.pxd +153 -0
- data/ext/minimap2/python/mappy.pyx +273 -0
- data/ext/minimap2/python/minimap2.py +39 -0
- data/ext/minimap2/sdust.c +213 -0
- data/ext/minimap2/sdust.h +25 -0
- data/ext/minimap2/seed.c +131 -0
- data/ext/minimap2/setup.py +55 -0
- data/ext/minimap2/sketch.c +143 -0
- data/ext/minimap2/splitidx.c +84 -0
- data/ext/minimap2/sse2neon/emmintrin.h +1689 -0
- data/ext/minimap2/test/MT-human.fa +278 -0
- data/ext/minimap2/test/MT-orang.fa +276 -0
- data/ext/minimap2/test/q-inv.fa +4 -0
- data/ext/minimap2/test/q2.fa +2 -0
- data/ext/minimap2/test/t-inv.fa +127 -0
- data/ext/minimap2/test/t2.fa +2 -0
- data/ext/minimap2/tex/Makefile +21 -0
- data/ext/minimap2/tex/bioinfo.cls +930 -0
- data/ext/minimap2/tex/blasr-mc.eval +17 -0
- data/ext/minimap2/tex/bowtie2-s3.sam.eval +28 -0
- data/ext/minimap2/tex/bwa-s3.sam.eval +52 -0
- data/ext/minimap2/tex/bwa.eval +55 -0
- data/ext/minimap2/tex/eval2roc.pl +33 -0
- data/ext/minimap2/tex/graphmap.eval +4 -0
- data/ext/minimap2/tex/hs38-simu.sh +10 -0
- data/ext/minimap2/tex/minialign.eval +49 -0
- data/ext/minimap2/tex/minimap2.bib +460 -0
- data/ext/minimap2/tex/minimap2.tex +724 -0
- data/ext/minimap2/tex/mm2-s3.sam.eval +62 -0
- data/ext/minimap2/tex/mm2-update.tex +240 -0
- data/ext/minimap2/tex/mm2.approx.eval +12 -0
- data/ext/minimap2/tex/mm2.eval +13 -0
- data/ext/minimap2/tex/natbib.bst +1288 -0
- data/ext/minimap2/tex/natbib.sty +803 -0
- data/ext/minimap2/tex/ngmlr.eval +38 -0
- data/ext/minimap2/tex/roc.gp +60 -0
- data/ext/minimap2/tex/snap-s3.sam.eval +62 -0
- data/ext/minimap2.patch +19 -0
- data/lib/minimap2/aligner.rb +4 -4
- data/lib/minimap2/alignment.rb +11 -11
- data/lib/minimap2/ffi/constants.rb +20 -16
- data/lib/minimap2/ffi/functions.rb +5 -0
- data/lib/minimap2/ffi.rb +4 -5
- data/lib/minimap2/version.rb +2 -2
- data/lib/minimap2.rb +51 -15
- metadata +97 -79
- data/lib/minimap2/ffi_helper.rb +0 -53
- data/vendor/libminimap2.so +0 -0
data/ext/minimap2/kseq.h
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
/* The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2008, 2009, 2011 Attractive Chaos <attractor@live.co.uk>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
20
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
21
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
22
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
/* Last Modified: 05MAR2012 */
|
27
|
+
|
28
|
+
#ifndef AC_KSEQ_H
|
29
|
+
#define AC_KSEQ_H
|
30
|
+
|
31
|
+
#include <ctype.h>
|
32
|
+
#include <string.h>
|
33
|
+
#include <stdlib.h>
|
34
|
+
|
35
|
+
#define KS_SEP_SPACE 0 // isspace(): \t, \n, \v, \f, \r
|
36
|
+
#define KS_SEP_TAB 1 // isspace() && !' '
|
37
|
+
#define KS_SEP_LINE 2 // line separator: "\n" (Unix) or "\r\n" (Windows)
|
38
|
+
#define KS_SEP_MAX 2
|
39
|
+
|
40
|
+
#ifndef klib_unused
|
41
|
+
#if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3)
|
42
|
+
#define klib_unused __attribute__ ((__unused__))
|
43
|
+
#else
|
44
|
+
#define klib_unused
|
45
|
+
#endif
|
46
|
+
#endif /* klib_unused */
|
47
|
+
|
48
|
+
#define __KS_TYPE(type_t) \
|
49
|
+
typedef struct __kstream_t { \
|
50
|
+
int begin, end; \
|
51
|
+
int is_eof:2, bufsize:30; \
|
52
|
+
type_t f; \
|
53
|
+
unsigned char *buf; \
|
54
|
+
} kstream_t;
|
55
|
+
|
56
|
+
#define ks_eof(ks) ((ks)->is_eof && (ks)->begin >= (ks)->end)
|
57
|
+
#define ks_rewind(ks) ((ks)->is_eof = (ks)->begin = (ks)->end = 0)
|
58
|
+
|
59
|
+
#define __KS_BASIC(SCOPE, type_t, __bufsize) \
|
60
|
+
SCOPE kstream_t *ks_init(type_t f) \
|
61
|
+
{ \
|
62
|
+
kstream_t *ks = (kstream_t*)calloc(1, sizeof(kstream_t)); \
|
63
|
+
ks->f = f; ks->bufsize = __bufsize; \
|
64
|
+
ks->buf = (unsigned char*)malloc(__bufsize); \
|
65
|
+
return ks; \
|
66
|
+
} \
|
67
|
+
SCOPE void ks_destroy(kstream_t *ks) \
|
68
|
+
{ \
|
69
|
+
if (!ks) return; \
|
70
|
+
free(ks->buf); \
|
71
|
+
free(ks); \
|
72
|
+
}
|
73
|
+
|
74
|
+
#define __KS_INLINED(__read) \
|
75
|
+
static inline klib_unused int ks_getc(kstream_t *ks) \
|
76
|
+
{ \
|
77
|
+
if (ks->is_eof && ks->begin >= ks->end) return -1; \
|
78
|
+
if (ks->begin >= ks->end) { \
|
79
|
+
ks->begin = 0; \
|
80
|
+
ks->end = __read(ks->f, ks->buf, ks->bufsize); \
|
81
|
+
if (ks->end < ks->bufsize) ks->is_eof = 1; \
|
82
|
+
if (ks->end == 0) return -1; \
|
83
|
+
} \
|
84
|
+
return (int)ks->buf[ks->begin++]; \
|
85
|
+
} \
|
86
|
+
static inline int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \
|
87
|
+
{ return ks_getuntil2(ks, delimiter, str, dret, 0); }
|
88
|
+
|
89
|
+
#ifndef KSTRING_T
|
90
|
+
#define KSTRING_T kstring_t
|
91
|
+
typedef struct __kstring_t {
|
92
|
+
size_t l, m;
|
93
|
+
char *s;
|
94
|
+
} kstring_t;
|
95
|
+
#endif
|
96
|
+
|
97
|
+
#ifndef kroundup32
|
98
|
+
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
|
99
|
+
#endif
|
100
|
+
|
101
|
+
#define __KS_GETUNTIL(SCOPE, __read) \
|
102
|
+
SCOPE int ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append) \
|
103
|
+
{ \
|
104
|
+
if (dret) *dret = 0; \
|
105
|
+
str->l = append? str->l : 0; \
|
106
|
+
if (ks->begin >= ks->end && ks->is_eof) return -1; \
|
107
|
+
for (;;) { \
|
108
|
+
int i; \
|
109
|
+
if (ks->begin >= ks->end) { \
|
110
|
+
if (!ks->is_eof) { \
|
111
|
+
ks->begin = 0; \
|
112
|
+
ks->end = __read(ks->f, ks->buf, ks->bufsize); \
|
113
|
+
if (ks->end < ks->bufsize) ks->is_eof = 1; \
|
114
|
+
if (ks->end == 0) break; \
|
115
|
+
} else break; \
|
116
|
+
} \
|
117
|
+
if (delimiter == KS_SEP_LINE) { \
|
118
|
+
for (i = ks->begin; i < ks->end; ++i) \
|
119
|
+
if (ks->buf[i] == '\n') break; \
|
120
|
+
} else if (delimiter > KS_SEP_MAX) { \
|
121
|
+
for (i = ks->begin; i < ks->end; ++i) \
|
122
|
+
if (ks->buf[i] == delimiter) break; \
|
123
|
+
} else if (delimiter == KS_SEP_SPACE) { \
|
124
|
+
for (i = ks->begin; i < ks->end; ++i) \
|
125
|
+
if (isspace(ks->buf[i])) break; \
|
126
|
+
} else if (delimiter == KS_SEP_TAB) { \
|
127
|
+
for (i = ks->begin; i < ks->end; ++i) \
|
128
|
+
if (isspace(ks->buf[i]) && ks->buf[i] != ' ') break; \
|
129
|
+
} else i = 0; /* never come to here! */ \
|
130
|
+
if (str->m - str->l < (size_t)(i - ks->begin + 1)) { \
|
131
|
+
str->m = str->l + (i - ks->begin) + 1; \
|
132
|
+
kroundup32(str->m); \
|
133
|
+
str->s = (char*)realloc(str->s, str->m); \
|
134
|
+
} \
|
135
|
+
memcpy(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \
|
136
|
+
str->l = str->l + (i - ks->begin); \
|
137
|
+
ks->begin = i + 1; \
|
138
|
+
if (i < ks->end) { \
|
139
|
+
if (dret) *dret = ks->buf[i]; \
|
140
|
+
break; \
|
141
|
+
} \
|
142
|
+
} \
|
143
|
+
if (str->s == 0) { \
|
144
|
+
str->m = 1; \
|
145
|
+
str->s = (char*)calloc(1, 1); \
|
146
|
+
} else if (delimiter == KS_SEP_LINE && str->l > 1 && str->s[str->l-1] == '\r') --str->l; \
|
147
|
+
str->s[str->l] = '\0'; \
|
148
|
+
return str->l; \
|
149
|
+
}
|
150
|
+
|
151
|
+
#define KSTREAM_INIT2(SCOPE, type_t, __read, __bufsize) \
|
152
|
+
__KS_TYPE(type_t) \
|
153
|
+
__KS_BASIC(SCOPE, type_t, __bufsize) \
|
154
|
+
__KS_GETUNTIL(SCOPE, __read) \
|
155
|
+
__KS_INLINED(__read)
|
156
|
+
|
157
|
+
#define KSTREAM_INIT(type_t, __read, __bufsize) KSTREAM_INIT2(static, type_t, __read, __bufsize)
|
158
|
+
|
159
|
+
#define KSTREAM_DECLARE(type_t, __read) \
|
160
|
+
__KS_TYPE(type_t) \
|
161
|
+
extern int ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append); \
|
162
|
+
extern kstream_t *ks_init(type_t f); \
|
163
|
+
extern void ks_destroy(kstream_t *ks); \
|
164
|
+
__KS_INLINED(__read)
|
165
|
+
|
166
|
+
/******************
|
167
|
+
* FASTA/Q parser *
|
168
|
+
******************/
|
169
|
+
|
170
|
+
#define kseq_rewind(ks) ((ks)->last_char = (ks)->f->is_eof = (ks)->f->begin = (ks)->f->end = 0)
|
171
|
+
|
172
|
+
#define __KSEQ_BASIC(SCOPE, type_t) \
|
173
|
+
SCOPE kseq_t *kseq_init(type_t fd) \
|
174
|
+
{ \
|
175
|
+
kseq_t *s = (kseq_t*)calloc(1, sizeof(kseq_t)); \
|
176
|
+
s->f = ks_init(fd); \
|
177
|
+
return s; \
|
178
|
+
} \
|
179
|
+
SCOPE void kseq_destroy(kseq_t *ks) \
|
180
|
+
{ \
|
181
|
+
if (!ks) return; \
|
182
|
+
free(ks->name.s); free(ks->comment.s); free(ks->seq.s); free(ks->qual.s); \
|
183
|
+
ks_destroy(ks->f); \
|
184
|
+
free(ks); \
|
185
|
+
}
|
186
|
+
|
187
|
+
/* Return value:
|
188
|
+
>=0 length of the sequence (normal)
|
189
|
+
-1 end-of-file
|
190
|
+
-2 truncated quality string
|
191
|
+
*/
|
192
|
+
#define __KSEQ_READ(SCOPE) \
|
193
|
+
SCOPE int kseq_read(kseq_t *seq) \
|
194
|
+
{ \
|
195
|
+
int c; \
|
196
|
+
kstream_t *ks = seq->f; \
|
197
|
+
if (seq->last_char == 0) { /* then jump to the next header line */ \
|
198
|
+
while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@'); \
|
199
|
+
if (c == -1) return -1; /* end of file */ \
|
200
|
+
seq->last_char = c; \
|
201
|
+
} /* else: the first header char has been read in the previous call */ \
|
202
|
+
seq->comment.l = seq->seq.l = seq->qual.l = 0; /* reset all members */ \
|
203
|
+
if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1; /* normal exit: EOF */ \
|
204
|
+
if (c != '\n') ks_getuntil(ks, KS_SEP_LINE, &seq->comment, 0); /* read FASTA/Q comment */ \
|
205
|
+
if (seq->seq.s == 0) { /* we can do this in the loop below, but that is slower */ \
|
206
|
+
seq->seq.m = 256; \
|
207
|
+
seq->seq.s = (char*)malloc(seq->seq.m); \
|
208
|
+
} \
|
209
|
+
while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \
|
210
|
+
if (c == '\n') continue; /* skip empty lines */ \
|
211
|
+
seq->seq.s[seq->seq.l++] = c; /* this is safe: we always have enough space for 1 char */ \
|
212
|
+
ks_getuntil2(ks, KS_SEP_LINE, &seq->seq, 0, 1); /* read the rest of the line */ \
|
213
|
+
} \
|
214
|
+
if (c == '>' || c == '@') seq->last_char = c; /* the first header char has been read */ \
|
215
|
+
if (seq->seq.l + 1 >= seq->seq.m) { /* seq->seq.s[seq->seq.l] below may be out of boundary */ \
|
216
|
+
seq->seq.m = seq->seq.l + 2; \
|
217
|
+
kroundup32(seq->seq.m); /* rounded to the next closest 2^k */ \
|
218
|
+
seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \
|
219
|
+
} \
|
220
|
+
seq->seq.s[seq->seq.l] = 0; /* null terminated string */ \
|
221
|
+
if (c != '+') return seq->seq.l; /* FASTA */ \
|
222
|
+
if (seq->qual.m < seq->seq.m) { /* allocate memory for qual in case insufficient */ \
|
223
|
+
seq->qual.m = seq->seq.m; \
|
224
|
+
seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m); \
|
225
|
+
} \
|
226
|
+
while ((c = ks_getc(ks)) != -1 && c != '\n'); /* skip the rest of '+' line */ \
|
227
|
+
if (c == -1) return -2; /* error: no quality string */ \
|
228
|
+
while (ks_getuntil2(ks, KS_SEP_LINE, &seq->qual, 0, 1) >= 0 && seq->qual.l < seq->seq.l); \
|
229
|
+
seq->last_char = 0; /* we have not come to the next header line */ \
|
230
|
+
if (seq->seq.l != seq->qual.l) return -2; /* error: qual string is of a different length */ \
|
231
|
+
return seq->seq.l; \
|
232
|
+
}
|
233
|
+
|
234
|
+
#define __KSEQ_TYPE(type_t) \
|
235
|
+
typedef struct { \
|
236
|
+
kstring_t name, comment, seq, qual; \
|
237
|
+
int last_char; \
|
238
|
+
kstream_t *f; \
|
239
|
+
} kseq_t;
|
240
|
+
|
241
|
+
#define KSEQ_INIT2(SCOPE, type_t, __read) \
|
242
|
+
KSTREAM_INIT2(SCOPE, type_t, __read, 16384) \
|
243
|
+
__KSEQ_TYPE(type_t) \
|
244
|
+
__KSEQ_BASIC(SCOPE, type_t) \
|
245
|
+
__KSEQ_READ(SCOPE)
|
246
|
+
|
247
|
+
#define KSEQ_INIT(type_t, __read) KSEQ_INIT2(static, type_t, __read)
|
248
|
+
|
249
|
+
#define KSEQ_DECLARE(type_t) \
|
250
|
+
__KS_TYPE(type_t) \
|
251
|
+
__KSEQ_TYPE(type_t) \
|
252
|
+
extern kseq_t *kseq_init(type_t fd); \
|
253
|
+
void kseq_destroy(kseq_t *ks); \
|
254
|
+
int kseq_read(kseq_t *seq);
|
255
|
+
|
256
|
+
#endif
|
@@ -0,0 +1,153 @@
|
|
1
|
+
/* The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2008, 2011 Attractive Chaos <attractor@live.co.uk>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
20
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
21
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
22
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
// This is a simplified version of ksort.h
|
27
|
+
|
28
|
+
#ifndef AC_KSORT_H
|
29
|
+
#define AC_KSORT_H
|
30
|
+
|
31
|
+
#include <stdlib.h>
|
32
|
+
#include <string.h>
|
33
|
+
#include <assert.h>
|
34
|
+
|
35
|
+
typedef struct {
|
36
|
+
void *left, *right;
|
37
|
+
int depth;
|
38
|
+
} ks_isort_stack_t;
|
39
|
+
|
40
|
+
#define KSORT_SWAP(type_t, a, b) { type_t t=(a); (a)=(b); (b)=t; }
|
41
|
+
|
42
|
+
#define KSORT_INIT(name, type_t, __sort_lt) \
|
43
|
+
void ks_heapdown_##name(size_t i, size_t n, type_t l[]) \
|
44
|
+
{ \
|
45
|
+
size_t k = i; \
|
46
|
+
type_t tmp = l[i]; \
|
47
|
+
while ((k = (k << 1) + 1) < n) { \
|
48
|
+
if (k != n - 1 && __sort_lt(l[k], l[k+1])) ++k; \
|
49
|
+
if (__sort_lt(l[k], tmp)) break; \
|
50
|
+
l[i] = l[k]; i = k; \
|
51
|
+
} \
|
52
|
+
l[i] = tmp; \
|
53
|
+
} \
|
54
|
+
void ks_heapmake_##name(size_t lsize, type_t l[]) \
|
55
|
+
{ \
|
56
|
+
size_t i; \
|
57
|
+
for (i = (lsize >> 1) - 1; i != (size_t)(-1); --i) \
|
58
|
+
ks_heapdown_##name(i, lsize, l); \
|
59
|
+
} \
|
60
|
+
type_t ks_ksmall_##name(size_t n, type_t arr[], size_t kk) \
|
61
|
+
{ \
|
62
|
+
type_t *low, *high, *k, *ll, *hh, *mid; \
|
63
|
+
low = arr; high = arr + n - 1; k = arr + kk; \
|
64
|
+
for (;;) { \
|
65
|
+
if (high <= low) return *k; \
|
66
|
+
if (high == low + 1) { \
|
67
|
+
if (__sort_lt(*high, *low)) KSORT_SWAP(type_t, *low, *high); \
|
68
|
+
return *k; \
|
69
|
+
} \
|
70
|
+
mid = low + (high - low) / 2; \
|
71
|
+
if (__sort_lt(*high, *mid)) KSORT_SWAP(type_t, *mid, *high); \
|
72
|
+
if (__sort_lt(*high, *low)) KSORT_SWAP(type_t, *low, *high); \
|
73
|
+
if (__sort_lt(*low, *mid)) KSORT_SWAP(type_t, *mid, *low); \
|
74
|
+
KSORT_SWAP(type_t, *mid, *(low+1)); \
|
75
|
+
ll = low + 1; hh = high; \
|
76
|
+
for (;;) { \
|
77
|
+
do ++ll; while (__sort_lt(*ll, *low)); \
|
78
|
+
do --hh; while (__sort_lt(*low, *hh)); \
|
79
|
+
if (hh < ll) break; \
|
80
|
+
KSORT_SWAP(type_t, *ll, *hh); \
|
81
|
+
} \
|
82
|
+
KSORT_SWAP(type_t, *low, *hh); \
|
83
|
+
if (hh <= k) low = ll; \
|
84
|
+
if (hh >= k) high = hh - 1; \
|
85
|
+
} \
|
86
|
+
} \
|
87
|
+
|
88
|
+
#define ks_ksmall(name, n, a, k) ks_ksmall_##name(n, a, k)
|
89
|
+
|
90
|
+
#define ks_lt_generic(a, b) ((a) < (b))
|
91
|
+
#define ks_lt_str(a, b) (strcmp((a), (b)) < 0)
|
92
|
+
|
93
|
+
typedef const char *ksstr_t;
|
94
|
+
|
95
|
+
#define KSORT_INIT_GENERIC(type_t) KSORT_INIT(type_t, type_t, ks_lt_generic)
|
96
|
+
#define KSORT_INIT_STR KSORT_INIT(str, ksstr_t, ks_lt_str)
|
97
|
+
|
98
|
+
#define RS_MIN_SIZE 64
|
99
|
+
#define RS_MAX_BITS 8
|
100
|
+
|
101
|
+
#define KRADIX_SORT_INIT(name, rstype_t, rskey, sizeof_key) \
|
102
|
+
typedef struct { \
|
103
|
+
rstype_t *b, *e; \
|
104
|
+
} rsbucket_##name##_t; \
|
105
|
+
void rs_insertsort_##name(rstype_t *beg, rstype_t *end) \
|
106
|
+
{ \
|
107
|
+
rstype_t *i; \
|
108
|
+
for (i = beg + 1; i < end; ++i) \
|
109
|
+
if (rskey(*i) < rskey(*(i - 1))) { \
|
110
|
+
rstype_t *j, tmp = *i; \
|
111
|
+
for (j = i; j > beg && rskey(tmp) < rskey(*(j-1)); --j) \
|
112
|
+
*j = *(j - 1); \
|
113
|
+
*j = tmp; \
|
114
|
+
} \
|
115
|
+
} \
|
116
|
+
void rs_sort_##name(rstype_t *beg, rstype_t *end, int n_bits, int s) \
|
117
|
+
{ \
|
118
|
+
rstype_t *i; \
|
119
|
+
int size = 1<<n_bits, m = size - 1; \
|
120
|
+
rsbucket_##name##_t *k, b[1<<RS_MAX_BITS], *be = b + size; \
|
121
|
+
assert(n_bits <= RS_MAX_BITS); \
|
122
|
+
for (k = b; k != be; ++k) k->b = k->e = beg; \
|
123
|
+
for (i = beg; i != end; ++i) ++b[rskey(*i)>>s&m].e; \
|
124
|
+
for (k = b + 1; k != be; ++k) \
|
125
|
+
k->e += (k-1)->e - beg, k->b = (k-1)->e; \
|
126
|
+
for (k = b; k != be;) { \
|
127
|
+
if (k->b != k->e) { \
|
128
|
+
rsbucket_##name##_t *l; \
|
129
|
+
if ((l = b + (rskey(*k->b)>>s&m)) != k) { \
|
130
|
+
rstype_t tmp = *k->b, swap; \
|
131
|
+
do { \
|
132
|
+
swap = tmp; tmp = *l->b; *l->b++ = swap; \
|
133
|
+
l = b + (rskey(tmp)>>s&m); \
|
134
|
+
} while (l != k); \
|
135
|
+
*k->b++ = tmp; \
|
136
|
+
} else ++k->b; \
|
137
|
+
} else ++k; \
|
138
|
+
} \
|
139
|
+
for (b->b = beg, k = b + 1; k != be; ++k) k->b = (k-1)->e; \
|
140
|
+
if (s) { \
|
141
|
+
s = s > n_bits? s - n_bits : 0; \
|
142
|
+
for (k = b; k != be; ++k) \
|
143
|
+
if (k->e - k->b > RS_MIN_SIZE) rs_sort_##name(k->b, k->e, n_bits, s); \
|
144
|
+
else if (k->e - k->b > 1) rs_insertsort_##name(k->b, k->e); \
|
145
|
+
} \
|
146
|
+
} \
|
147
|
+
void radix_sort_##name(rstype_t *beg, rstype_t *end) \
|
148
|
+
{ \
|
149
|
+
if (end - beg <= RS_MIN_SIZE) rs_insertsort_##name(beg, end); \
|
150
|
+
else rs_sort_##name(beg, end, RS_MAX_BITS, (sizeof_key - 1) * RS_MAX_BITS); \
|
151
|
+
}
|
152
|
+
|
153
|
+
#endif
|
data/ext/minimap2/ksw2.h
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
#ifndef KSW2_H_
|
2
|
+
#define KSW2_H_
|
3
|
+
|
4
|
+
#include <stdint.h>
|
5
|
+
|
6
|
+
#define KSW_NEG_INF -0x40000000
|
7
|
+
|
8
|
+
#define KSW_EZ_SCORE_ONLY 0x01 // don't record alignment path/cigar
|
9
|
+
#define KSW_EZ_RIGHT 0x02 // right-align gaps
|
10
|
+
#define KSW_EZ_GENERIC_SC 0x04 // without this flag: match/mismatch only; last symbol is a wildcard
|
11
|
+
#define KSW_EZ_APPROX_MAX 0x08 // approximate max; this is faster with sse
|
12
|
+
#define KSW_EZ_APPROX_DROP 0x10 // approximate Z-drop; faster with sse
|
13
|
+
#define KSW_EZ_EXTZ_ONLY 0x40 // only perform extension
|
14
|
+
#define KSW_EZ_REV_CIGAR 0x80 // reverse CIGAR in the output
|
15
|
+
#define KSW_EZ_SPLICE_FOR 0x100
|
16
|
+
#define KSW_EZ_SPLICE_REV 0x200
|
17
|
+
#define KSW_EZ_SPLICE_FLANK 0x400
|
18
|
+
|
19
|
+
// The subset of CIGAR operators used by ksw code.
|
20
|
+
// Use MM_CIGAR_* from minimap.h if you need the full list.
|
21
|
+
#define KSW_CIGAR_MATCH 0
|
22
|
+
#define KSW_CIGAR_INS 1
|
23
|
+
#define KSW_CIGAR_DEL 2
|
24
|
+
#define KSW_CIGAR_N_SKIP 3
|
25
|
+
|
26
|
+
#ifdef __cplusplus
|
27
|
+
extern "C" {
|
28
|
+
#endif
|
29
|
+
|
30
|
+
typedef struct {
|
31
|
+
uint32_t max:31, zdropped:1;
|
32
|
+
int max_q, max_t; // max extension coordinate
|
33
|
+
int mqe, mqe_t; // max score when reaching the end of query
|
34
|
+
int mte, mte_q; // max score when reaching the end of target
|
35
|
+
int score; // max score reaching both ends; may be KSW_NEG_INF
|
36
|
+
int m_cigar, n_cigar;
|
37
|
+
int reach_end;
|
38
|
+
uint32_t *cigar;
|
39
|
+
} ksw_extz_t;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* NW-like extension
|
43
|
+
*
|
44
|
+
* @param km memory pool, when used with kalloc
|
45
|
+
* @param qlen query length
|
46
|
+
* @param query query sequence with 0 <= query[i] < m
|
47
|
+
* @param tlen target length
|
48
|
+
* @param target target sequence with 0 <= target[i] < m
|
49
|
+
* @param m number of residue types
|
50
|
+
* @param mat m*m scoring mattrix in one-dimension array
|
51
|
+
* @param gapo gap open penalty; a gap of length l cost "-(gapo+l*gape)"
|
52
|
+
* @param gape gap extension penalty
|
53
|
+
* @param w band width (<0 to disable)
|
54
|
+
* @param zdrop off-diagonal drop-off to stop extension (positive; <0 to disable)
|
55
|
+
* @param flag flag (see KSW_EZ_* macros)
|
56
|
+
* @param ez (out) scores and cigar
|
57
|
+
*/
|
58
|
+
void ksw_extz(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
59
|
+
int8_t q, int8_t e, int w, int zdrop, int flag, ksw_extz_t *ez);
|
60
|
+
|
61
|
+
void ksw_extz2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
62
|
+
int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
|
63
|
+
|
64
|
+
void ksw_extd(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
65
|
+
int8_t gapo, int8_t gape, int8_t gapo2, int8_t gape2, int w, int zdrop, int flag, ksw_extz_t *ez);
|
66
|
+
|
67
|
+
void ksw_extd2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
68
|
+
int8_t gapo, int8_t gape, int8_t gapo2, int8_t gape2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
|
69
|
+
|
70
|
+
void ksw_exts2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
71
|
+
int8_t gapo, int8_t gape, int8_t gapo2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez);
|
72
|
+
|
73
|
+
void ksw_extf2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t mch, int8_t mis, int8_t e, int w, int xdrop, ksw_extz_t *ez);
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Global alignment
|
77
|
+
*
|
78
|
+
* (first 10 parameters identical to ksw_extz_sse())
|
79
|
+
* @param m_cigar (modified) max CIGAR length; feed 0 if cigar==0
|
80
|
+
* @param n_cigar (out) number of CIGAR elements
|
81
|
+
* @param cigar (out) BAM-encoded CIGAR; caller need to deallocate with kfree(km, )
|
82
|
+
*
|
83
|
+
* @return score of the alignment
|
84
|
+
*/
|
85
|
+
int ksw_gg(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t gapo, int8_t gape, int w, int *m_cigar_, int *n_cigar_, uint32_t **cigar_);
|
86
|
+
int ksw_gg2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t gapo, int8_t gape, int w, int *m_cigar_, int *n_cigar_, uint32_t **cigar_);
|
87
|
+
int ksw_gg2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t gapo, int8_t gape, int w, int *m_cigar_, int *n_cigar_, uint32_t **cigar_);
|
88
|
+
|
89
|
+
void *ksw_ll_qinit(void *km, int size, int qlen, const uint8_t *query, int m, const int8_t *mat);
|
90
|
+
int ksw_ll_i16(void *q, int tlen, const uint8_t *target, int gapo, int gape, int *qe, int *te);
|
91
|
+
|
92
|
+
#ifdef __cplusplus
|
93
|
+
}
|
94
|
+
#endif
|
95
|
+
|
96
|
+
/************************************
|
97
|
+
*** Private macros and functions ***
|
98
|
+
************************************/
|
99
|
+
|
100
|
+
#ifdef HAVE_KALLOC
|
101
|
+
#include "kalloc.h"
|
102
|
+
#else
|
103
|
+
#include <stdlib.h>
|
104
|
+
#define kmalloc(km, size) malloc((size))
|
105
|
+
#define kcalloc(km, count, size) calloc((count), (size))
|
106
|
+
#define krealloc(km, ptr, size) realloc((ptr), (size))
|
107
|
+
#define kfree(km, ptr) free((ptr))
|
108
|
+
#endif
|
109
|
+
|
110
|
+
static inline uint32_t *ksw_push_cigar(void *km, int *n_cigar, int *m_cigar, uint32_t *cigar, uint32_t op, int len)
|
111
|
+
{
|
112
|
+
if (*n_cigar == 0 || op != (cigar[(*n_cigar) - 1]&0xf)) {
|
113
|
+
if (*n_cigar == *m_cigar) {
|
114
|
+
*m_cigar = *m_cigar? (*m_cigar)<<1 : 4;
|
115
|
+
cigar = (uint32_t*)krealloc(km, cigar, (*m_cigar) << 2);
|
116
|
+
}
|
117
|
+
cigar[(*n_cigar)++] = len<<4 | op;
|
118
|
+
} else cigar[(*n_cigar)-1] += len<<4;
|
119
|
+
return cigar;
|
120
|
+
}
|
121
|
+
|
122
|
+
// In the backtrack matrix, value p[] has the following structure:
|
123
|
+
// bit 0-2: which type gets the max - 0 for H, 1 for E, 2 for F, 3 for \tilde{E} and 4 for \tilde{F}
|
124
|
+
// bit 3/0x08: 1 if a continuation on the E state (bit 5/0x20 for a continuation on \tilde{E})
|
125
|
+
// bit 4/0x10: 1 if a continuation on the F state (bit 6/0x40 for a continuation on \tilde{F})
|
126
|
+
static inline void ksw_backtrack(void *km, int is_rot, int is_rev, int min_intron_len, const uint8_t *p, const int *off, const int *off_end, int n_col, int i0, int j0,
|
127
|
+
int *m_cigar_, int *n_cigar_, uint32_t **cigar_)
|
128
|
+
{ // p[] - lower 3 bits: which type gets the max; bit
|
129
|
+
int n_cigar = 0, m_cigar = *m_cigar_, i = i0, j = j0, r, state = 0;
|
130
|
+
uint32_t *cigar = *cigar_, tmp;
|
131
|
+
while (i >= 0 && j >= 0) { // at the beginning of the loop, _state_ tells us which state to check
|
132
|
+
int force_state = -1;
|
133
|
+
if (is_rot) {
|
134
|
+
r = i + j;
|
135
|
+
if (i < off[r]) force_state = 2;
|
136
|
+
if (off_end && i > off_end[r]) force_state = 1;
|
137
|
+
tmp = force_state < 0? p[(size_t)r * n_col + i - off[r]] : 0;
|
138
|
+
} else {
|
139
|
+
if (j < off[i]) force_state = 2;
|
140
|
+
if (off_end && j > off_end[i]) force_state = 1;
|
141
|
+
tmp = force_state < 0? p[(size_t)i * n_col + j - off[i]] : 0;
|
142
|
+
}
|
143
|
+
if (state == 0) state = tmp & 7; // if requesting the H state, find state one maximizes it.
|
144
|
+
else if (!(tmp >> (state + 2) & 1)) state = 0; // if requesting other states, _state_ stays the same if it is a continuation; otherwise, set to H
|
145
|
+
if (state == 0) state = tmp & 7; // TODO: probably this line can be merged into the "else if" line right above; not 100% sure
|
146
|
+
if (force_state >= 0) state = force_state;
|
147
|
+
if (state == 0) cigar = ksw_push_cigar(km, &n_cigar, &m_cigar, cigar, KSW_CIGAR_MATCH, 1), --i, --j;
|
148
|
+
else if (state == 1 || (state == 3 && min_intron_len <= 0)) cigar = ksw_push_cigar(km, &n_cigar, &m_cigar, cigar, KSW_CIGAR_DEL, 1), --i;
|
149
|
+
else if (state == 3 && min_intron_len > 0) cigar = ksw_push_cigar(km, &n_cigar, &m_cigar, cigar, KSW_CIGAR_N_SKIP, 1), --i;
|
150
|
+
else cigar = ksw_push_cigar(km, &n_cigar, &m_cigar, cigar, KSW_CIGAR_INS, 1), --j;
|
151
|
+
}
|
152
|
+
if (i >= 0) cigar = ksw_push_cigar(km, &n_cigar, &m_cigar, cigar, min_intron_len > 0 && i >= min_intron_len? KSW_CIGAR_N_SKIP : KSW_CIGAR_DEL, i + 1); // first deletion
|
153
|
+
if (j >= 0) cigar = ksw_push_cigar(km, &n_cigar, &m_cigar, cigar, KSW_CIGAR_INS, j + 1); // first insertion
|
154
|
+
if (!is_rev)
|
155
|
+
for (i = 0; i < n_cigar>>1; ++i) // reverse CIGAR
|
156
|
+
tmp = cigar[i], cigar[i] = cigar[n_cigar-1-i], cigar[n_cigar-1-i] = tmp;
|
157
|
+
*m_cigar_ = m_cigar, *n_cigar_ = n_cigar, *cigar_ = cigar;
|
158
|
+
}
|
159
|
+
|
160
|
+
static inline void ksw_reset_extz(ksw_extz_t *ez)
|
161
|
+
{
|
162
|
+
ez->max_q = ez->max_t = ez->mqe_t = ez->mte_q = -1;
|
163
|
+
ez->max = 0, ez->score = ez->mqe = ez->mte = KSW_NEG_INF;
|
164
|
+
ez->n_cigar = 0, ez->zdropped = 0, ez->reach_end = 0;
|
165
|
+
}
|
166
|
+
|
167
|
+
static inline int ksw_apply_zdrop(ksw_extz_t *ez, int is_rot, int32_t H, int a, int b, int zdrop, int8_t e)
|
168
|
+
{
|
169
|
+
int r, t;
|
170
|
+
if (is_rot) r = a, t = b;
|
171
|
+
else r = a + b, t = a;
|
172
|
+
if (H > (int32_t)ez->max) {
|
173
|
+
ez->max = H, ez->max_t = t, ez->max_q = r - t;
|
174
|
+
} else if (t >= ez->max_t && r - t >= ez->max_q) {
|
175
|
+
int tl = t - ez->max_t, ql = (r - t) - ez->max_q, l;
|
176
|
+
l = tl > ql? tl - ql : ql - tl;
|
177
|
+
if (zdrop >= 0 && ez->max - H > zdrop + l * e) {
|
178
|
+
ez->zdropped = 1;
|
179
|
+
return 1;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
return 0;
|
183
|
+
}
|
184
|
+
#endif
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#ifdef KSW_CPU_DISPATCH
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include "ksw2.h"
|
4
|
+
|
5
|
+
#define SIMD_SSE 0x1
|
6
|
+
#define SIMD_SSE2 0x2
|
7
|
+
#define SIMD_SSE3 0x4
|
8
|
+
#define SIMD_SSSE3 0x8
|
9
|
+
#define SIMD_SSE4_1 0x10
|
10
|
+
#define SIMD_SSE4_2 0x20
|
11
|
+
#define SIMD_AVX 0x40
|
12
|
+
#define SIMD_AVX2 0x80
|
13
|
+
#define SIMD_AVX512F 0x100
|
14
|
+
|
15
|
+
#ifndef _MSC_VER
|
16
|
+
// adapted from https://github.com/01org/linux-sgx/blob/master/common/inc/internal/linux/cpuid_gnu.h
|
17
|
+
void __cpuidex(int cpuid[4], int func_id, int subfunc_id)
|
18
|
+
{
|
19
|
+
#if defined(__x86_64__)
|
20
|
+
__asm__ volatile ("cpuid"
|
21
|
+
: "=a" (cpuid[0]), "=b" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
|
22
|
+
: "0" (func_id), "2" (subfunc_id));
|
23
|
+
#else // on 32bit, ebx can NOT be used as PIC code
|
24
|
+
__asm__ volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
|
25
|
+
: "=a" (cpuid[0]), "=r" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
|
26
|
+
: "0" (func_id), "2" (subfunc_id));
|
27
|
+
#endif
|
28
|
+
}
|
29
|
+
#endif
|
30
|
+
|
31
|
+
static int ksw_simd = -1;
|
32
|
+
|
33
|
+
static int x86_simd(void)
|
34
|
+
{
|
35
|
+
int flag = 0, cpuid[4], max_id;
|
36
|
+
__cpuidex(cpuid, 0, 0);
|
37
|
+
max_id = cpuid[0];
|
38
|
+
if (max_id == 0) return 0;
|
39
|
+
__cpuidex(cpuid, 1, 0);
|
40
|
+
if (cpuid[3]>>25&1) flag |= SIMD_SSE;
|
41
|
+
if (cpuid[3]>>26&1) flag |= SIMD_SSE2;
|
42
|
+
if (cpuid[2]>>0 &1) flag |= SIMD_SSE3;
|
43
|
+
if (cpuid[2]>>9 &1) flag |= SIMD_SSSE3;
|
44
|
+
if (cpuid[2]>>19&1) flag |= SIMD_SSE4_1;
|
45
|
+
if (cpuid[2]>>20&1) flag |= SIMD_SSE4_2;
|
46
|
+
if (cpuid[2]>>28&1) flag |= SIMD_AVX;
|
47
|
+
if (max_id >= 7) {
|
48
|
+
__cpuidex(cpuid, 7, 0);
|
49
|
+
if (cpuid[1]>>5 &1) flag |= SIMD_AVX2;
|
50
|
+
if (cpuid[1]>>16&1) flag |= SIMD_AVX512F;
|
51
|
+
}
|
52
|
+
return flag;
|
53
|
+
}
|
54
|
+
|
55
|
+
void ksw_extz2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez)
|
56
|
+
{
|
57
|
+
extern void ksw_extz2_sse2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
|
58
|
+
extern void ksw_extz2_sse41(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat, int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
|
59
|
+
if (ksw_simd < 0) ksw_simd = x86_simd();
|
60
|
+
if (ksw_simd & SIMD_SSE4_1)
|
61
|
+
ksw_extz2_sse41(km, qlen, query, tlen, target, m, mat, q, e, w, zdrop, end_bonus, flag, ez);
|
62
|
+
else if (ksw_simd & SIMD_SSE2)
|
63
|
+
ksw_extz2_sse2(km, qlen, query, tlen, target, m, mat, q, e, w, zdrop, end_bonus, flag, ez);
|
64
|
+
else abort();
|
65
|
+
}
|
66
|
+
|
67
|
+
void ksw_extd2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
68
|
+
int8_t q, int8_t e, int8_t q2, int8_t e2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez)
|
69
|
+
{
|
70
|
+
extern void ksw_extd2_sse2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
71
|
+
int8_t q, int8_t e, int8_t q2, int8_t e2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
|
72
|
+
extern void ksw_extd2_sse41(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
73
|
+
int8_t q, int8_t e, int8_t q2, int8_t e2, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez);
|
74
|
+
if (ksw_simd < 0) ksw_simd = x86_simd();
|
75
|
+
if (ksw_simd & SIMD_SSE4_1)
|
76
|
+
ksw_extd2_sse41(km, qlen, query, tlen, target, m, mat, q, e, q2, e2, w, zdrop, end_bonus, flag, ez);
|
77
|
+
else if (ksw_simd & SIMD_SSE2)
|
78
|
+
ksw_extd2_sse2(km, qlen, query, tlen, target, m, mat, q, e, q2, e2, w, zdrop, end_bonus, flag, ez);
|
79
|
+
else abort();
|
80
|
+
}
|
81
|
+
|
82
|
+
void ksw_exts2_sse(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
83
|
+
int8_t q, int8_t e, int8_t q2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez)
|
84
|
+
{
|
85
|
+
extern void ksw_exts2_sse2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
86
|
+
int8_t q, int8_t e, int8_t q2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez);
|
87
|
+
extern void ksw_exts2_sse41(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
|
88
|
+
int8_t q, int8_t e, int8_t q2, int8_t noncan, int zdrop, int8_t junc_bonus, int flag, const uint8_t *junc, ksw_extz_t *ez);
|
89
|
+
if (ksw_simd < 0) ksw_simd = x86_simd();
|
90
|
+
if (ksw_simd & SIMD_SSE4_1)
|
91
|
+
ksw_exts2_sse41(km, qlen, query, tlen, target, m, mat, q, e, q2, noncan, zdrop, junc_bonus, flag, junc, ez);
|
92
|
+
else if (ksw_simd & SIMD_SSE2)
|
93
|
+
ksw_exts2_sse2(km, qlen, query, tlen, target, m, mat, q, e, q2, noncan, zdrop, junc_bonus, flag, junc, ez);
|
94
|
+
else abort();
|
95
|
+
}
|
96
|
+
#endif
|