1 /*
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 */
26 /*****************************************************************************
27 
28 File name: lookup.h
29 
30 Author: Tom Madden
31 
32 Contents: defines and prototype used by lookup.c.
33 
34 ******************************************************************************/
35 
36 /* File Name: lookup.h
37 *
38 * Author: Tom Madden
39 *
40 * Version Creation Date:   10/26/95
41 *
42 * $Revision: 6.36 $
43 *
44 * File Description:
45 *       Functions that format traditional BLAST output.
46 *
47 * Modifications:
48 * --------------------------------------------------------------------------
49 * Date     Name        Description of modification
50 * -------  ----------  -----------------------------------------------------
51 *
52 * ==========================================================================
53 *
54 *
55 * RCS Modification History:
56 * $Log: lookup.h,v $
57 * Revision 6.36  2007/03/14 16:39:29  papadopo
58 * force PV array to use 32-bit data types only, for compatibility with the new blast engine
59 *
60 * Revision 6.35  2005/07/28 14:57:10  coulouri
61 * remove dead code
62 *
63 * Revision 6.34  2004/02/04 21:54:53  dondosha
64 * Macro correction for 12/18 discontiguous template
65 *
66 * Revision 6.33  2003/01/10 17:48:01  dondosha
67 * Corrections in 2 macros
68 *
69 * Revision 6.32  2002/08/30 15:48:17  dondosha
70 * MegaBlastWordFinderDeallocate prototype moved from mblast.h
71 *
72 * Revision 6.31  2002/05/20 21:28:29  dondosha
73 * Tiny correction in macro definitions for the optimal 11/18 discontiguous word template
74 *
75 * Revision 6.30  2002/05/17 21:39:16  dondosha
76 * 1. Added 2 optimal discontiguoutemplates for length 21;
77 * 2. Changed the optimal template for length 18
78 *
79 * Revision 6.29  2002/05/14 22:20:20  dondosha
80 * Renamed maximal discontiguous template type into optimal
81 *
82 * Revision 6.28  2002/04/09 18:19:47  dondosha
83 * Changed #ifdefs to conditionals, allowing different discontiguous templates in a single binary
84 *
85 * Revision 6.27  2002/04/04 21:18:50  dondosha
86 * Added more macros to be used by discontiguous megablast
87 *
88 * Revision 6.26  2002/04/01 22:29:24  dondosha
89 * Added pair of parentheses in macro definition
90 *
91 * Revision 6.25  2002/03/26 21:15:55  dondosha
92 * Added macro definitions to allow template length 21
93 *
94 * Revision 6.24  2002/02/15 23:35:01  dondosha
95 * Allow hash table and two templates for megablast
96 *
97 * Revision 6.23  2001/12/28 20:46:21  dondosha
98 * 1. Mega BLAST related parameters moved into a separate structure
99 * 2. Environment variables for discontiguous words, etc. changed to options
100 * 3. Extension from discontiguous word with length 18 implemented
101 *
102 * Revision 6.22  2001/12/04 17:13:08  dondosha
103 * Made number of stacks for megablast word processing depend on query and database
104 *
105 * Revision 6.21  2001/11/13 18:22:13  dondosha
106 * Added another discontiguous model definition for Mega BLAST
107 *
108 * Revision 6.20  2001/10/12 21:32:46  dondosha
109 * Added discontiguous word capability to megablast
110 *
111 * Revision 6.19  2001/07/20 18:57:07  dondosha
112 * Added and changed some megablast related defines
113 *
114 * Revision 6.18  2000/07/10 17:17:37  dondosha
115 * Use several stacks in MegaBlast to speed up search for small word sizes
116 *
117 * Revision 6.17  2000/07/07 21:20:08  vakatov
118 * Get all "#include" out of the 'extern "C" { }' scope!
119 *
120 * Revision 6.16  2000/05/31 14:04:50  dondosha
121 * Added member stack_size to MbStack structure
122 *
123 * Revision 6.15  2000/03/03 18:00:11  dondosha
124 * Added prototype for MegaBlastLookupTableDup, plus cosmetic changes
125 *
126 * Revision 6.14  2000/02/17 19:00:45  shavirin
127 * Removed theCacheSize parameter from everywhere.
128 *
129 * Revision 6.13  2000/02/11 20:52:25  dondosha
130 * Added Webb Miller s lookup table and related prototypes
131 *
132 * Revision 6.12  2000/02/01 21:05:56  dondosha
133 * Added prototype for mb_lookup_position_aux_destruct - modification for megablast
134 *
135 * Revision 6.11  2000/01/11 17:27:02  shavirin
136 * Added elements theTable and theCacheSize into LookupTable
137 * Added parameters theCacheSize into lookup_new and BLAST_WordFinderNew
138 *
139 * Revision 6.9  1999/12/21 21:33:24  shavirin
140 * Added parameter mod_lookup_table_memory to the lookup structure.
141 *
142 * Revision 6.8  1999/09/29 17:20:12  madden
143 * Deallocate ModLookupPositionPtr memory
144 *
145 * Revision 6.7  1999/09/28 20:14:34  madden
146 * Joerg changes to mimize cache misses
147 *
148 * Revision 6.6  1999/09/16 16:56:39  madden
149 * Changes to lookup_new for long words
150 *
151 * Revision 6.5  1999/09/16 14:16:27  madden
152 * lookup_find_init returns Uint1Ptr instead of CharPtr
153 *
154 * Revision 6.4  1998/09/22 16:27:48  madden
155 * Added function lookup_position_aux_destruct
156 *
157 * Revision 6.3  1998/07/27 18:14:18  madden
158 * lookup_get_memory replaces call to MemNew
159 *
160 * Revision 6.2  1998/04/15 20:25:58  madden
161 * Auxillary structure added to speed-up saving words for queries
162 *
163 * Revision 6.1  1998/02/26 22:34:40  madden
164 * Changes for 16 bit windows
165 *
166 * Revision 6.0  1997/08/25 18:53:25  madden
167 * Revision changed to 6.0
168 *
169 * Revision 1.4  1996/09/25 14:17:30  madden
170 * removed discontiguous options.
171 *
172  * Revision 1.3  1996/09/12  21:12:59  madden
173  * Added new function to save an already computed index, lookup_add_index.
174  *
175  * Revision 1.2  1996/08/15  18:57:10  madden
176  * Changed context from Int1 to Int2.
177  *
178  * Revision 1.1  1996/08/05  19:48:50  madden
179  * Initial revision
180  *
181  * Revision 1.10  1996/07/18  22:00:02  madden
182  * Changes for multiple contexts.
183  *
184  * Revision 1.9  1996/06/20  17:00:11  madden
185  * Added "__cplusplus" define.
186  *
187  * Revision 1.8  1996/06/20  16:15:57  madden
188  * Replaced int's with Int4's.
189  *
190  * Revision 1.7  1996/05/22  20:22:43  madden
191  * removed unused prototypes.
192  *
193  * Revision 1.6  1996/05/16  19:50:15  madden
194  * Added documentation block.
195  *
196  * Revision 1.5  1996/05/03  19:55:24  madden
197  * Removed FnPtr for lookup_find.
198  *
199  * Revision 1.4  1996/04/04  20:47:55  madden
200  * Made lookup_find into two functions, that are statics.
201  *
202  * Revision 1.3  1996/02/28  21:38:36  madden
203  * Changed prototypes for discontiguous words.
204  *
205  * Revision 1.2  1995/12/26  20:28:54  madden
206  * *** empty log message ***
207  *
208  * Revision 1.1  1995/12/08  15:48:23  madden
209  * Initial revision
210  *
211 */
212 
213 #ifndef _LOOKUP_
214 #define _LOOKUP_
215 
216 #include <ncbi.h>
217 
218 #ifdef __cplusplus
219 extern "C" {
220 #endif
221 
222 /*
223 	Structure that keeps a block of memory for the functions in lookup.c
224 	Most often used instead of a MemNew call in AddPositionToLookupTable.
225 */
226 typedef struct lookup_memory {
227 	Uint1Ptr current,	/* Current position of pointer to memory. */
228 		start;		/* Start of memory (for deallocation). */
229 	size_t	remaining;	/* How much memory remains in allocated block. */
230 	struct 	lookup_memory *next;
231 } LookupMemory, PNTR LookupMemoryPtr;
232 
233 
234 
235 typedef struct orig_lookup_position {
236 	Int4	position;		/* position along the query */
237 	Int1 context;	/* "context" of hit, for use by BLASTContextStructPtr.*/
238 	struct orig_lookup_position *next;	/* other positions */
239 } OrigLookupPosition, PNTR OrigLookupPositionPtr;
240 
241 /* some defines for the pv_array, as this changes from 32-bit to 64-bit systems. */
242 #if 0           /* 64-bit versions turned off for new engine compatibility */
243 
244 #define PV_ARRAY_TYPE Uint8	/* The pv_array 'native' type. */
245 #define PV_ARRAY_BYTES 8	/* number of BYTES in 'native' type. */
246 #define PV_ARRAY_BTS 6		/* bits-to-shift from lookup_index to pv_array index. */
247 #define PV_ARRAY_MASK 63	/* amount to mask off. */
248 
249 #else
250 
251 #define PV_ARRAY_TYPE Uint4	/* The pv_array 'native' type. */
252 #define PV_ARRAY_BYTES 4	/* number of BYTES in 'native' type. */
253 #define PV_ARRAY_BTS 5		/* bits-to-shift from lookup_index to pv_array index. */
254 #define PV_ARRAY_MASK 31	/* amount to mask off. */
255 
256 #endif
257 
258 #define PV_ARRAY_FACTOR 0.5	/* The fraction of sites that must have at least one hit to not use PV_ARRAY. */
259 
260 /* Largest query length for which diagonal array is to be used in megablast */
261 #define MAX_DIAG_ARRAY 100000
262 
263 #define NUC_MASK 0xfc
264 
265 #define PACK_EXTRA_CODE(ecode,val,mask) {ecode = ((ecode<<2) & mask) | val;}
266 #define GET_NEXT_PACKED_NUCL(s,n,val) { n = (n-1)&0x03; s = s + (n&(n>>1)&0x01); val = ((*s)>>(n<<1)) & 0x00000003; }
267 
268 /* OPTIMAL templates */
269 
270 /*   1,110,110,110,110,111 - 12 of 16 */
271 /*   1,110,010,110,110,111 - 11 of 16 */
272 #define MASK1_OPT       0x0000003f
273 #define MASK2_OPT       0x00000f00
274 #define MASK3_OPT       0x0003c000
275 #define MASK4_12_OPT    0x00f00000
276 #define MASK4_11_OPT    0x00300000
277 #define MASK5_OPT       0xfc000000
278 /* 12 of 16 */
279 #define GET_WORD_INDEX_12_16_OPT(n) (((n)&MASK1_OPT) | (((n)&MASK2_OPT)>>2) | (((n)&MASK3_OPT)>>4) | (((n)&MASK4_12_OPT)>>6) | (((n)&MASK5_OPT)>>8))
280 /* 11 of 16 */
281 #define GET_WORD_INDEX_11_16_OPT(n) (((n)&MASK1_OPT) | (((n)&MASK2_OPT)>>2) | (((n)&MASK3_OPT)>>4) | (((n)&MASK4_11_OPT)>>6) | (((n)&MASK5_OPT)>>10))
282 
283 /* 111,010,110,010,110,111 - 12 of 18 */
284 /* 111,010,010,110,010,111 - 11 of 18 */
285 #define MASK1_18_OPT    0x00000003
286 #define MASK2_12_18_OPT 0x000000f0
287 #define MASK2_11_18_OPT 0x00000030
288 #define MASK3_11_18_OPT 0x00003c00
289 #define MASK3_12_18_OPT 0x00000c00
290 #define MASK4_11_18_OPT 0x00030000
291 #define MASK4_12_18_OPT 0x000f0000
292 #define MASK5_18_OPT    0x00c00000
293 #define MASK6_18_OPT    0xfc000000
294 /* 12 of 18 */
295 #define GET_WORD_INDEX_12_18_OPT(n) ((((n)&MASK1_18_OPT)<<4) | (((n)&MASK2_12_18_OPT)<<2) | ((n)&MASK3_12_18_OPT) | (((n)&MASK4_12_18_OPT)>>4) | (((n)&MASK5_18_OPT)>>6) | (((n)&MASK6_18_OPT)>>8))
296 /* 11 of 18 */
297 #define GET_WORD_INDEX_11_18_OPT(n) ((((n)&MASK1_18_OPT)<<4) | (((n)&MASK2_11_18_OPT)<<2) | (((n)&MASK3_11_18_OPT)>>2) | (((n)&MASK4_11_18_OPT)>>4) | (((n)&MASK5_18_OPT)>>8) | (((n)&MASK6_18_OPT)>>10))
298 #define MASK_EXTRA_OPT 0x0000000f
299 #define GET_EXTRA_CODE_18_OPT(s) (((*(s+1))<<2) | (*(s+2))) & MASK_EXTRA_OPT
300 
301 #define GET_EXTRA_CODE_PACKED_4_18_OPT(s) ((*(s+1))>>4)
302 #define GET_EXTRA_CODE_PACKED_18_OPT(s,b,val,ecode) {GET_NEXT_PACKED_NUCL(s,b,ecode); GET_NEXT_PACKED_NUCL(s,b,val); PACK_EXTRA_CODE(ecode, val,MASK_EXTRA_OPT);}
303 
304 #define GET_AMBIG_CONDITION_18_OPT(s) (((*(s+1))&NUC_MASK) | ((*(s+2))&NUC_MASK))
305 
306 /* 111,010,010,110,010,010,111 - 12 of 21 */
307 /* 111,010,010,100,010,010,111 - 11 of 21 */
308 #define MASK1_21_OPT    0x00000030
309 #define MASK2_12_21_OPT 0x00003c00
310 #define MASK2_11_21_OPT 0x00003000
311 #define MASK3_21_OPT    0x00030000
312 #define MASK4_21_OPT    0x00c00000
313 #define MASK5_21_OPT    0xfc000000
314 #define GET_WORD_INDEX_12_21_OPT(n) ((((n)&MASK1_21_OPT)<<4) | ((n)&MASK2_12_21_OPT) | (((n)&MASK3_21_OPT)>>2) | (((n)&MASK4_21_OPT)>>6) | (((n)&MASK5_21_OPT)>>8))
315 #define GET_WORD_INDEX_11_21_OPT(n) ((((n)&MASK1_21_OPT)<<4) | (((n)&MASK2_11_21_OPT)>>2) | (((n)&MASK3_21_OPT)>>4) | (((n)&MASK4_21_OPT)>>8) | (((n)&MASK5_21_OPT)>>10))
316 #define MASK_EXTRA_21_OPT 0x000000ff
317 #define GET_EXTRA_CODE_21_OPT(s) ((((*(s+1))<<6) | ((*(s+3))<<4) | ((*(s+4))<<2) | (*(s+5))) & MASK_EXTRA_21_OPT)
318 #define GET_AMBIG_CONDITION_21_OPT(s) (((*(s+1))&NUC_MASK) | ((*(s+3))&NUC_MASK) | ((*(s+4))&NUC_MASK) | ((*(s+5))&NUC_MASK))
319 #define GET_EXTRA_CODE_PACKED_4_21_OPT(s) ((((*(s+1))&0x0f)<<2)|((*(s+1))&0xc0)|((*(s+2))>>6))
320 #define GET_EXTRA_CODE_PACKED_21_OPT(s,b,val,ecode) {GET_NEXT_PACKED_NUCL(s,b,ecode); GET_NEXT_PACKED_NUCL(s,b,val); GET_NEXT_PACKED_NUCL(s,b,val); PACK_EXTRA_CODE(ecode,val,MASK_EXTRA_21_OPT); GET_NEXT_PACKED_NUCL(s,b,val); PACK_EXTRA_CODE(ecode,val,MASK_EXTRA_21_OPT); GET_NEXT_PACKED_NUCL(s,b,val); PACK_EXTRA_CODE(ecode,val,MASK_EXTRA_21_OPT);}
321 
322 
323 /* CODING TEMPLATES */
324 
325 /*    111,110,110,110,110,1 - 12 of 16 */
326 /*    110,110,110,110,110,1 - 11 of 16 */
327 #define MASK1    0x00000003
328 #define MASK2    0x000000f0
329 #define MASK3    0x00003c00
330 #define MASK4    0x000f0000
331 #define MASK5_12 0xffc00000
332 #define MASK5_11 0x03c00000
333 #define MASK6    0xf0000000
334 /* 12 of 16 */
335 #define GET_WORD_INDEX_12_16(n) (((n)&MASK1) | (((n)&MASK2)>>2) | (((n)&MASK3)>>4) | (((n)&MASK4)>>6) | (((n)&MASK5_12)>>8))
336 /* 11 of 16 */
337 #define GET_WORD_INDEX_11_16(n) (((n)&MASK1) | (((n)&MASK2)>>2) | (((n)&MASK3)>>4) | (((n)&MASK4)>>6) | (((n)&MASK5_11)>>8) | (((n)&MASK6)>>10))
338 
339 /* 10,110,110,110,110,110,1 - 12 of 18 */
340 /* 10,110,110,010,110,110,1 - 11 of 18 */
341 #define MASK1_18    0x0000000f
342 #define MASK2_18    0x000003c0
343 #define MASK3_11_18 0x00003000
344 #define MASK3_12_18 0x0000f000
345 #define MASK4_18    0x003c0000
346 #define MASK5_18    0x0f000000
347 #define MASK6_18    0xc0000000
348 
349 /* 12 of 18 */
350 #define GET_WORD_INDEX_12_18(n) ((((n)&MASK1_18)<<2) | ((n)&MASK2_18) | (((n)&MASK3_12_18)>>2) | (((n)&MASK4_18)>>4) | (((n)&MASK5_18)>>6) | (((n)&MASK6_18)>>8))
351 /* 11 of 18 */
352 #define GET_WORD_INDEX_11_18(n) ((((n)&MASK1_18)<<2) | ((n)&MASK2_18) | (((n)&MASK3_11_18)>>2) | (((n)&MASK4_18)>>6) | (((n)&MASK5_18)>>8) | (((n)&MASK6_18)>>10))
353 
354 #define MASK_EXTRA_18 0x00000003
355 #define GET_EXTRA_CODE_18(s) ((*(s+2)) & MASK_EXTRA_18)
356 #define GET_EXTRA_CODE_PACKED_4_18(s) (((*(s+1))>>4) & MASK_EXTRA_18)
357 #define GET_EXTRA_CODE_PACKED_18(s,b,val,ecode) {GET_NEXT_PACKED_NUCL(s,b,val); GET_NEXT_PACKED_NUCL(s,b,ecode);}
358 #define GET_AMBIG_CONDITION_18(s) ((*(s+2))&NUC_MASK)
359 
360 /* 10,010,110,110,110,010,110,1 - 12 of 21 */
361 /* 10,010,110,010,110,010,110,1 - 11 of 21 */
362 #define MASK1_21    0x00000003
363 #define MASK2_21    0x000003c0
364 #define MASK3_12_21 0x0000f000
365 #define MASK3_11_21 0x00003000
366 #define MASK4_21    0x003c0000
367 #define MASK5_21    0x03000000
368 #define MASK6_21    0xc0000000
369 #define GET_WORD_INDEX_12_21(n) ((((n)&MASK1_21)<<6) | (((n)&MASK2_21)<<2) | ((n)&MASK3_12_21) | (((n)&MASK4_21)>>2) | (((n)&MASK5_21)>>4) | (((n)&MASK6_21)>>8))
370 #define GET_WORD_INDEX_11_21(n) ((((n)&MASK1_21)<<6) | (((n)&MASK2_21)<<2) | ((n)&MASK3_11_21) | (((n)&MASK4_21)>>4) | (((n)&MASK5_21)>>6) | (((n)&MASK6_21)>>10))
371 #define MASK_EXTRA_21 0x0000003f
372 #define GET_EXTRA_CODE_21(s) ((((*(s+2))<<4) | ((*(s+3))<<2) | (*(s+5))) & MASK_EXTRA_21)
373 #define GET_AMBIG_CONDITION_21(s) (((*(s+2))&NUC_MASK) | ((*(s+3))&NUC_MASK) | ((*(s+5))&NUC_MASK))
374 #define GET_EXTRA_CODE_PACKED_4_21(s) (((*(s+1))&0x3c)|((*(s+2))>>6))
375 #define GET_EXTRA_CODE_PACKED_21(s,b,val,ecode) {GET_NEXT_PACKED_NUCL(s,b,val); GET_NEXT_PACKED_NUCL(s,b,ecode); GET_NEXT_PACKED_NUCL(s,b,val); PACK_EXTRA_CODE(ecode,val,MASK_EXTRA_21); GET_NEXT_PACKED_NUCL(s,b,val); GET_NEXT_PACKED_NUCL(s,b,val); PACK_EXTRA_CODE(ecode,val,MASK_EXTRA_21);}
376 
377 /* Define LookupPosition (ie a hit_info) such that it can be loaded into a register */
378 
379 typedef Uint4 ModLookupPosition;
380 typedef Uint4 *ModLookupPositionPtr;
381 
382 #define hinfo_get_pos(h) ((h)&0xffffff)
383 #define hinfo_get_context(h) (((h)>>24)&0xff)
384 
385 #define hinfo_set(ptr_hinfo,p,c) ( *(ptr_hinfo) = (( ((Uint4)(c)) << 24) | ((Uint4)(p))) )
386 
387 #if 1                           /* To be deleted */
388 typedef struct mod_lt_entry {
389     Int4 num_used;       /* num valid positions */
390     ModLookupPosition entries[3]; /* first postion */
391 } ModLAEntry, PNTR ModLAEntryPtr;
392 #endif
393 
394 typedef struct megablast_stack {
395    Int4 diag, level, length;
396 } MbStack, PNTR MbStackPtr;
397 
398 typedef struct megablast_lookup_table {
399    Int2 width;          /* Number of bytes in hash value   */
400    Int4 hashsize;       /* = 2^(8*width) - 1               */
401    Int2 lpm;            /* Minimal length of perfect match */
402    Int2 max_positions;  /* Maximal number of positions for one hash value */
403    Int4Ptr hashtable;   /* Array of positions              */
404    Int4Ptr hashtable2;  /* Array of positions for second template */
405    Int4Ptr next_pos;    /* Extra positions stored here     */
406    Int4Ptr next_pos2;   /* Extra positions for the second template */
407    Uint4 mask;
408    Int4Ptr stack_index; /* Current number of elements in each stack */
409    Int4Ptr stack_size;  /* Available memory for each stack */
410    MbStackPtr PNTR estack; /* Array of stacks for most recent hits */
411    Int4 num_stacks;
412 } MbLookupTable, PNTR MbLookupTablePtr;
413 
414 typedef struct lookup_table {
415     Int4 char_size,		/* number of bits per residue/bp */
416         wordsize,		/* size of "word" */
417         reduced_wordsize,       /* size of word */
418         array_size,		/* size of table's array. */
419         mask;		/* Used to mask off top set of bits. */
420     OrigLookupPositionPtr PNTR position;	/* positions of the hits. */
421     OrigLookupPositionPtr PNTR position_aux;	/* auxillary structure for keeping track of the last saved hit, to speed up saving of hits on very long sequences. */
422     LookupMemoryPtr mem_struct,	/* contains memory. */
423         mem_struct_start;	/* Start of LookupMemoryPtr chain. */
424     size_t memory_chunk;	/* chunk size of memory. */
425     PV_ARRAY_TYPE *pv_array;                /* presence vector, used for quick presence check */
426     Int4 num_pos_added;
427     Int4 num_unique_pos_added;
428 #if 1                           /* To be deleted */
429     ModLAEntry *mod_lt;	        /* The new&improved lookup table */
430 #endif
431     Uint4Ptr theTable;          /* Lookup table with variable length */
432     ModLookupPositionPtr 	mod_lookup_table_memory; /* Memory for new and improved lookup table. */
433     Int4 mod_lookup_table_size;/* Size for new and improved lookup table */
434    MbLookupTablePtr mb_lt; /* MegaBlast version of the lookup table */
435 } LookupTable, PNTR LookupTablePtr;
436 
437 
438 /*********************************************************************
439 	Structure for the BLAST_WordFinder, used to find the initial
440 	word-hits.
441 *********************************************************************/
442 typedef struct _blast_wordfinder {
443                 Int4     wordsize;
444 		Int2 compression_ratio;
445                 LookupTablePtr  lookup;
446         } BLAST_WordFinder, PNTR BLAST_WordFinderPtr;
447 
448 
449 LookupTablePtr LIBCALL lookup_new PROTO((Int2 alphabet_size, Int2 wordsize, Int2 reduced_wordsize));
450 
451 LookupTablePtr LIBCALL lookup_destruct PROTO((LookupTablePtr lookup));
452 
453 void LIBCALL lookup_add PROTO((LookupTablePtr lookup, CharPtr string, Int4 position, Int1 context));
454 
455 void LIBCALL lookup_add_index PROTO((LookupTablePtr lookup, Int4 lookup_index, Int4 position, Int1 context));
456 
457 Uint1Ptr LIBCALL lookup_find_init PROTO((LookupTablePtr lookup, Int4 PNTR lookup_index, Uint1Ptr string));
458 
459 Boolean lookup_position_aux_destruct PROTO((LookupTablePtr lookup));
460 Boolean mb_lookup_position_aux_destruct PROTO((LookupTablePtr lookup));
461 
462 LookupTablePtr MegaBlastLookupTableDup PROTO((LookupTablePtr lookup));
463 LookupTablePtr MegaBlastLookupTableDestruct PROTO((LookupTablePtr lookup));
464 
465 BLAST_WordFinderPtr BLAST_WordFinderDestruct PROTO((BLAST_WordFinderPtr wfp));
466 
467 BLAST_WordFinderPtr BLAST_WordFinderNew PROTO((Int2 alphabet_size, Int2 wordsize, Int2 compression_ratio, Boolean round_down));
468 
469 BLAST_WordFinderPtr
470 MegaBlastWordFinderDeallocate PROTO((BLAST_WordFinderPtr wfp));
471 
472 #ifdef __cplusplus
473 }
474 #endif
475 
476 #endif /* _LOOKUP_ */
477