~ubuntu-branches/ubuntu/oneiric/ncbi-tools6/oneiric

« back to all changes in this revision

Viewing changes to algo/blast/core/blast_lookup.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: blast_lookup.h,v 1.30 2006/04/27 19:32:48 madden Exp $
 
1
/* $Id: blast_lookup.h,v 1.31 2006/11/21 16:42:03 papadopo Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
25
25
 */
26
26
 
27
27
/** @file blast_lookup.h
28
 
 *  Routines for creating protein and nucleotide BLAST lookup tables.
29
 
 *  Contains definitions and prototypes for the lookup table
30
 
 *  construction and scanning phase of blastn, blastp, and RPS blast.
31
 
 * @todo: Re-examine code here and in unit tests for 32/64 bit portability.
 
28
 *  Common definitions for protein and nucleotide lookup tables
32
29
 */
33
30
 
 
31
#ifndef ALGO_BLAST_CORE__BLAST_LOOKUP__H
 
32
#define ALGO_BLAST_CORE__BLAST_LOOKUP__H
 
33
 
 
34
#include <algo/blast/core/ncbi_std.h>
34
35
#include <algo/blast/core/blast_def.h>
35
 
#include <algo/blast/core/blast_options.h>
36
 
#include <algo/blast/core/blast_rps.h>
37
 
#include <algo/blast/core/lookup_wrap.h>
38
 
 
39
 
#ifndef BLAST_LOOKUP__H
40
 
#define BLAST_LOOKUP__H
41
36
 
42
37
#ifdef __cplusplus
43
38
extern "C" {
44
39
#endif
45
40
 
46
 
/* some defines for the pv_array, as this changes from 32-bit to 64-bit systems. */
47
 
 
48
 
#if 0
49
 
/*The 64 bit versions are disabled for now.*/
50
 
 
51
 
#define PV_ARRAY_TYPE Uint8     /**< The pv_array 'native' type. */
52
 
#define PV_ARRAY_BYTES 8        /**< number of BYTES in 'native' type. */
53
 
#define PV_ARRAY_BTS 6          /**< bits-to-shift from lookup_index to pv_array index. */
54
 
#define PV_ARRAY_MASK 63        /**< amount to mask off. */
55
 
 
56
 
#endif
57
 
 
58
41
#define PV_ARRAY_TYPE Uint4     /**< The pv_array 'native' type. */
59
42
#define PV_ARRAY_BYTES 4        /**< number of BYTES in 'native' type. */
60
43
#define PV_ARRAY_BTS 5          /**< bits-to-shift from lookup_index to pv_array index. */
63
46
/** Set the bit at position 'index' in the PV 
64
47
 *  array bitfield within 'lookup'
65
48
 */
66
 
#define PV_SET(lookup, index) ( (lookup)->pv[(index)>>PV_ARRAY_BTS] |= (PV_ARRAY_TYPE)1 << ((index) & PV_ARRAY_MASK) )
 
49
#define PV_SET(lookup, index, shift)    \
 
50
    lookup[(index) >> (shift)] |= (PV_ARRAY_TYPE)1 << ((index) & PV_ARRAY_MASK)
 
51
 
67
52
/** Test the bit at position 'index' in the PV 
68
53
 *  array bitfield within 'lookup'
69
54
 */
70
 
#define PV_TEST(lookup, index) ( (lookup)->pv[(index)>>PV_ARRAY_BTS] & (PV_ARRAY_TYPE)1 << ((index) & PV_ARRAY_MASK) )
71
 
 
72
 
#define FULL_BYTE_SHIFT 8 /**< Number of bits to shift in lookup 
73
 
                               index calculation when scanning 
74
 
                               compressed nucleotide sequence */
75
 
 
76
 
#define HITS_ON_BACKBONE 3 /**< maximum number of hits in one lookup
77
 
                                table cell */
78
 
 
79
 
/** structure defining one cell of the compacted lookup table */
80
 
typedef struct LookupBackboneCell {
81
 
    Int4 num_used;       /**< number of hits stored for this cell */
82
 
 
83
 
    union {
84
 
      Int4 overflow_cursor; /**< integer offset into the overflow array
85
 
                                 where the list of hits for this cell begins */
86
 
      Int4 entries[HITS_ON_BACKBONE];  /**< if the number of hits for this
87
 
                                            cell is HITS_ON_BACKBONE or less,
88
 
                                            the hits are all stored directly in
89
 
                                            the cell */
90
 
    } payload;  /**< UNION that specifies either entries stored right on the backbone
91
 
                    if fewer than HITS_ON_BACKBONE are present or a pointer to 
92
 
                    where the hits are stored (off-backbone). */
93
 
} LookupBackboneCell;
94
 
    
95
 
/** The basic lookup table structure for blastn
96
 
 *  and blastp searches
97
 
 */
98
 
typedef struct BlastLookupTable {
99
 
    Int4 threshold;        /**< the score threshold for neighboring words */
100
 
    Int4 neighbor_matches; /**< the number of neighboring words found while 
101
 
                                indexing the queries, used for informational/
102
 
                                debugging purposes */
103
 
    Int4 exact_matches;    /**< the number of exact matches found while 
104
 
                                indexing the queries, used for informational/
105
 
                                debugging purposes */
106
 
    Int4 mask;             /**< part of index to mask off, that is, top 
107
 
                                (wordsize*charsize) bits should be discarded. */
108
 
    Int4 word_length;      /**< Length in bases of the full word match 
109
 
                                required to trigger extension */
110
 
    Int4 lut_word_length;  /**< Length in bases of a word indexed by the
111
 
                                lookup table */
112
 
    Int4 charsize;         /**< number of bits for a base/residue */
113
 
    Int4 scan_step;        /**< number of bases between successive words */
114
 
    Int4 alphabet_size;    /**< number of letters in the alphabet */
115
 
    Int4 backbone_size;    /**< number of cells in the backbone */
116
 
    Int4 longest_chain;    /**< length of the longest chain on the backbone */
117
 
    Int4 ** thin_backbone; /**< the "thin" backbone. for each index cell, 
118
 
                                maintain a pointer to a dynamically-allocated 
119
 
                                chain of hits. */
120
 
    LookupBackboneCell * thick_backbone; /**< the "thick" backbone. after 
121
 
                                              queries are indexed, compact the 
122
 
                                              backbone to put at most 
123
 
                                              HITS_ON_BACKBONE hits on the 
124
 
                                              backbone, otherwise point to 
125
 
                                              some overflow storage */
126
 
    Int4 * overflow;       /**< the overflow array for the compacted 
127
 
                                lookup table */
128
 
    Int4  overflow_size;   /**< Number of elements in the overflow array */
129
 
    PV_ARRAY_TYPE *pv;     /**< Presence vector bitfield; bit positions that
130
 
                                are set indicate that the corresponding thick
131
 
                                backbone cell contains hits */
132
 
    Boolean use_pssm;      /**< if TRUE, lookup table construction will assume
133
 
                                that the underlying score matrix is position-
134
 
                                specific */
135
 
    Boolean ag_scanning_mode;  /**< Using AG scanning mode (or stride) if TRUE, so that 
136
 
                               not every base is checked.  */
137
 
  } BlastLookupTable;
138
 
  
139
 
  /** Create a mapping from word w to the supplied query offset
 
55
#define PV_TEST(lookup, index, shift)                   \
 
56
      ( lookup[(index) >> (shift)] &                    \
 
57
        ((PV_ARRAY_TYPE)1 << ((index) & PV_ARRAY_MASK)) )
 
58
 
 
59
/** Add a single query offset to a generic lookup table
140
60
 *
141
 
 * @param lookup the lookup table [in]
142
 
 * @param w pointer to the beginning of the word [in]
 
61
 * @param backbone The current list of hashtable cells [in][out]
 
62
 * @param wordsize Number of letters in a word [in]
 
63
 * @param charsize Number of bits in one letter [in]
 
64
 * @param seq pointer to the beginning of the word [in]
143
65
 * @param query_offset the offset in the query where the word occurs [in]
144
 
 * @return Zero.
145
 
 */
146
 
 
147
 
Int4 BlastAaLookupAddWordHit(BlastLookupTable* lookup,
148
 
                             Uint1* w,
149
 
                             Int4 query_offset);
150
 
 
151
 
/** Convert the chained lookup table to the pv_array and thick_backbone.
152
 
 *
153
 
 * @param lookup the lookup table [in]
154
 
 * @return Zero.
155
 
 */
156
 
Int4 _BlastAaLookupFinalize(BlastLookupTable* lookup);
157
 
 
158
 
/**
159
 
 * Scans the subject sequence from "offset" to the end of the sequence.
160
 
 * Copies at most array_size hits.
161
 
 * Returns the number of hits found.
162
 
 * If there isn't enough room to copy all the hits, return early, and update
163
 
 * "offset". 
164
 
 *
165
 
 * @param lookup_wrap the lookup table [in]
166
 
 * @param subject the subject sequence [in]
167
 
 * @param offset the offset in the subject at which to begin scanning [in/out]
168
 
 * @param offset_pairs Array to which hits will be copied [out]
169
 
 * @param array_size length of the offset arrays [in]
170
 
 * @return The number of hits found.
171
 
 */
172
 
Int4 BlastAaScanSubject(const LookupTableWrap* lookup_wrap,
173
 
                        const BLAST_SequenceBlk *subject,
174
 
                        Int4* offset,
175
 
                        BlastOffsetPair* NCBI_RESTRICT offset_pairs,
176
 
                        Int4 array_size);
177
 
 
178
 
/**
179
 
 * Scans the RPS query sequence from "offset" to the end of the sequence.
180
 
 * Copies at most array_size hits.
181
 
 * Returns the number of hits found.
182
 
 * If there isn't enough room to copy all the hits, return early, and update
183
 
 * "offset". 
184
 
 *
185
 
 * @param lookup_wrap the lookup table [in]
186
 
 * @param sequence the subject sequence [in]
187
 
 * @param offset the offset in the subject at which to begin scanning [in/out]
188
 
 * @return The number of hits found.
189
 
 */
190
 
Int4 BlastRPSScanSubject(const LookupTableWrap* lookup_wrap,
191
 
                        const BLAST_SequenceBlk *sequence,
192
 
                        Int4* offset);
193
 
 
194
 
/** Create a new protein lookup table.
195
 
  * @param opt pointer to lookup table options structure [in]
196
 
  * @param lut handle to lookup table structure [in/modified]
197
 
  * @return 0 if successful, nonzero on failure
198
 
  */
199
 
  
200
 
Int4 BlastAaLookupNew(const LookupTableOptions* opt, BlastLookupTable* * lut);
201
 
 
202
 
 
203
 
/** Create a new lookup table.
204
 
  * @param opt pointer to lookup table options structure [in]
205
 
  * @param lut handle to lookup table [in/modified]
206
 
  * @param approx_num_entries an estimate of the number of words
207
 
  *        to be added to the lookup table. Only used for nucleotide
208
 
  *        lookup tables [in]
209
 
  * @param is_protein boolean indicating protein or nucleotide [in]
210
 
  * @return 0 if successful, nonzero on failure
211
 
  */
212
 
  
213
 
Int4 LookupTableNew(const LookupTableOptions* opt, 
214
 
                    BlastLookupTable* * lut, 
215
 
                    Int4 approx_num_entries,
216
 
                    Boolean is_protein);
217
 
 
218
 
/** Free the lookup table.
219
 
 *  @param lookup The lookup table structure to be frees
220
 
 *  @return NULL
221
 
 */
222
 
BlastLookupTable* LookupTableDestruct(BlastLookupTable* lookup);
223
 
 
224
 
/** Index a protein query.
225
 
 *
226
 
 * @param lookup the lookup table [in/modified]
227
 
 * @param matrix the substitution matrix [in]
228
 
 * @param query the array of queries to index
229
 
 * @param unmasked_regions an array of BlastSeqLoc*s, each of which points to a (list of) integer pair(s) which specify the unmasked region(s) of the query [in]
230
 
 * @return Zero.
231
 
 */
232
 
Int4 BlastAaLookupIndexQuery(BlastLookupTable* lookup,
233
 
                               Int4 ** matrix,
234
 
                               BLAST_SequenceBlk* query,
235
 
                               BlastSeqLoc* unmasked_regions);
236
 
 
237
 
/** Index a single query.
238
 
 *
239
 
 * @param lookup the lookup table [in/modified]
240
 
 * @param matrix the substitution matrix [in]
241
 
 * @param query the array of queries to index
242
 
 * @param unmasked_regions a BlastSeqLoc* which points to a (list of) integer pair(s) which specify the unmasked region(s) of the query [in]
243
 
 * @param query_bias number added to each offset put into lookup table (only used for RPS blast database creation, otherwise 0) [in]
244
 
 * @return Zero.
245
 
 */
246
 
 
247
 
Int4 _BlastAaLookupIndexQuery(BlastLookupTable* lookup,
248
 
                              Int4 ** matrix,
249
 
                              BLAST_SequenceBlk* query,
250
 
                              BlastSeqLoc* unmasked_regions,
251
 
                              Int4 query_bias);
252
 
 
253
 
/**
254
 
 * Index a query sequence; i.e. fill a lookup table with the offsets
255
 
 * of query words score exceeds a threshold.
256
 
 *
257
 
 * @param lookup the lookup table [in/modified]
258
 
 * @param matrix the substitution matrix [in]
259
 
 * @param query the query sequence [in]
260
 
 * @param query_bias number added to each offset put into lookup table
261
 
 *                      (ordinarily 0; a nonzero value allows a succession of
262
 
 *                      query sequences to update the same lookup table)
263
 
 * @param locations the list of ranges of query offsets to examine for indexing [in]
264
 
 * @return Zero.
265
 
 */
266
 
Int4 AddNeighboringWords(BlastLookupTable* lookup,
267
 
                         Int4 ** matrix,
268
 
                         BLAST_SequenceBlk* query,
269
 
                         Int4 query_bias,
270
 
                         BlastSeqLoc* locations);
271
 
 
272
 
/**
273
 
 * A position-specific version of AddNeighboringWords. Note that
274
 
 * only the score matrix matters for indexing purposes, so an
275
 
 * actual query sequence is unneccessary
276
 
 *
277
 
 * @param lookup the lookup table [in/modified]
278
 
 * @param matrix the substitution matrix [in]
279
 
 * @param query_bias number added to each offset put into lookup table
280
 
 *                      (ordinarily 0; a nonzero value allows a succession of
281
 
 *                      query sequences to update the same lookup table)
282
 
 * @param locations the list of ranges of query offsets to examine for indexing
283
 
 * @return Zero.
284
 
 */
285
 
Int4 AddPSSMNeighboringWords(BlastLookupTable* lookup,
286
 
                         Int4 ** matrix,
287
 
                         Int4 query_bias,
288
 
                         BlastSeqLoc* locations);
289
 
 
290
 
/* RPS blast structures and functions */
291
 
 
292
 
#define RPS_HITS_PER_CELL 3 /**< maximum number of hits in an RPS backbone
293
 
                                 cell; this may be redundant (have the same
294
 
                                 value as HITS_ON_BACKBONE) but must be
295
 
                                 separate to guarantee binary compatibility
296
 
                                 with existing RPS blast databases */
297
 
 
298
 
/** structure defining one cell of the RPS lookup table */
299
 
typedef struct RPSBackboneCell {
300
 
    Int4 num_used;                   /**< number of hits in this cell */
301
 
    Int4 entries[RPS_HITS_PER_CELL]; /**< if the number of hits in this cell
302
 
                                          is RPS_HITS_PER_CELL or less, all
303
 
                                          hits go into this array. Otherwise,
304
 
                                          the first hit in the list goes into
305
 
                                          element 0 of the array, and element 1
306
 
                                          contains the byte offset into the 
307
 
                                          overflow array where the list of the
308
 
                                          remaining hits begins */
309
 
} RPSBackboneCell;
310
 
 
311
 
/** structure used for bucket sorting offsets retrieved
312
 
    from the RPS blast lookup table. */
313
 
typedef struct RPSBucket {
314
 
    Int4 num_filled;    /**< number of offset pairs currently in bucket */
315
 
    Int4 num_alloc;     /**< max number of offset pairs bucket can hold */
316
 
    BlastOffsetPair *offset_pairs; /**< list of offset pairs */
317
 
} RPSBucket;
318
 
 
319
 
/** 
320
 
 * The basic lookup table structure for RPS blast searches
321
 
 */
322
 
typedef struct BlastRPSLookupTable {
323
 
    Int4 wordsize;      /**< number of full bytes in a full word */
324
 
    Int4 mask;          /**< part of index to mask off, that is, 
325
 
                             top (wordsize*charsize) bits should be 
326
 
                             discarded. */
327
 
    Int4 alphabet_size; /**< number of letters in the alphabet */
328
 
    Int4 charsize;      /**< number of bits for a base/residue */
329
 
    Int4 backbone_size; /**< number of cells in the backbone */
330
 
    RPSBackboneCell * rps_backbone; /**< the lookup table used for RPS blast */
331
 
    Int4 ** rps_pssm;   /**< Pointer to memory-mapped RPS Blast profile file */
332
 
    Int4 * rps_seq_offsets; /**< array of start offsets for each RPS DB seq. */
333
 
    Int4 num_profiles; /**< Number of profiles in RPS database. */
334
 
    Int4 * overflow;    /**< the overflow array for the compacted 
335
 
                             lookup table */
336
 
    Int4  overflow_size;/**< Number of elements in the overflow array */
337
 
    PV_ARRAY_TYPE *pv;     /**< Presence vector bitfield; bit positions that
338
 
                                are set indicate that the corresponding thick
339
 
                                backbone cell contains hits */
340
 
 
341
 
    Int4 num_buckets;        /**< number of buckets used to sort offsets
342
 
                                  retrieved from the lookup table */
343
 
    RPSBucket *bucket_array; /**< list of buckets */
344
 
} BlastRPSLookupTable;
345
 
  
346
 
/** Create a new RPS blast lookup table.
347
 
  * @param rps_info pointer to structure with RPS setup information [in]
348
 
  * @param lut handle to lookup table [in/modified]
349
 
  * @return 0 if successful, nonzero on failure
350
 
  */
351
 
  
352
 
Int2 RPSLookupTableNew(const BlastRPSInfo *rps_info, 
353
 
                       BlastRPSLookupTable* * lut);
354
 
 
355
 
/** Free the lookup table. 
356
 
 *  @param lookup The lookup table structure to free; note that
357
 
 *          the rps_backbone and rps_seq_offsets fields are not freed
358
 
 *          by this call, since they may refer to memory-mapped arrays
359
 
 *  @return NULL
360
 
 */
361
 
BlastRPSLookupTable* RPSLookupTableDestruct(BlastRPSLookupTable* lookup);
362
 
 
363
 
/********************* Nucleotide functions *******************/
364
 
 
365
 
/** Macro to test the presence vector array value for a lookup table index */
366
 
#define NA_PV_TEST(pv_array, index, pv_array_bts) (pv_array[(index)>>pv_array_bts]&(((PV_ARRAY_TYPE) 1)<<((index)&PV_ARRAY_MASK)))
367
 
 
368
 
/** Scan the compressed subject sequence, returning all word hits, using the 
369
 
 *  old BLASTn approach - looking up words at every byte (4 bases) of the 
370
 
 *  sequence. Lookup table is presumed to have a traditional BLASTn structure.
371
 
 * @param lookup_wrap Pointer to the (wrapper to) lookup table [in]
372
 
 * @param subject The (compressed) sequence to be scanned for words [in]
373
 
 * @param start_offset The offset into the sequence in actual coordinates [in]
374
 
 * @param offset_pairs Array of query and subject positions where words are 
375
 
 *                found [out]
376
 
 * @param max_hits The allocated size of the above array - how many offsets 
377
 
 *        can be returned [in]
378
 
 * @param end_offset Where the scanning should stop [in], has stopped [out]
379
 
*/
380
 
Int4 BlastNaScanSubject(const LookupTableWrap* lookup_wrap,
381
 
                        const BLAST_SequenceBlk* subject,
382
 
                        Int4 start_offset,
383
 
                        BlastOffsetPair* NCBI_RESTRICT offset_pairs,
384
 
                        Int4 max_hits, 
385
 
                        Int4* end_offset);
386
 
 
387
 
/** Scan the compressed subject sequence, returning all word hits, using the 
388
 
 *  arbitrary stride. Lookup table is presumed to have a traditional BLASTn 
389
 
 *  structure. 
390
 
 * @param lookup_wrap Pointer to the (wrapper to) lookup table [in]
391
 
 * @param subject The (compressed) sequence to be scanned for words [in]
392
 
 * @param start_offset The offset into the sequence in actual coordinates [in]
393
 
 * @param offset_pairs Array of query and subject positions where words are 
394
 
 *                     found [out]
395
 
 * @param max_hits The allocated size of the above array - how many offsets 
396
 
 *        can be returned [in]
397
 
 * @param end_offset Where the scanning should stop [in], has stopped [out]
398
 
 * @return The number of hits found from the lookup table
399
 
*/
400
 
Int4 BlastNaScanSubject_AG(const LookupTableWrap* lookup_wrap,
401
 
                        const BLAST_SequenceBlk* subject,
402
 
                        Int4 start_offset,
403
 
                        BlastOffsetPair* NCBI_RESTRICT offset_pairs,
404
 
                        Int4 max_hits, 
405
 
                        Int4* end_offset);
406
 
 
407
 
/** Fill the lookup table for a given query sequence or partial sequence.
408
 
 * @param lookup Pointer to the lookup table structure [in] [out]
 
66
 */
 
67
void BlastLookupAddWordHit(Int4 **backbone, Int4 wordsize,
 
68
                           Int4 charsize, Uint1* seq,
 
69
                           Int4 query_offset);
 
70
 
 
71
/** Add all applicable query offsets to a generic lookup table
 
72
 *
 
73
 * @param backbone The current list of hashtable cells [in][out]
 
74
 * @param word_length Number of letters in a word [in]
 
75
 * @param charsize Number of bits in one letter [in]
 
76
 * @param lut_word_length Width of the lookup table in letters
 
77
 *                      (must be <= word_length) [in]
409
78
 * @param query The query sequence [in]
410
 
 * @param location What locations on the query sequence to index? [in]
411
 
 * @return Always 0
412
 
 */
413
 
Int4 BlastNaLookupIndexQuery(BlastLookupTable* lookup, 
414
 
                             BLAST_SequenceBlk* query,
415
 
                             BlastSeqLoc* location);
 
79
 * @param locations What locations on the query sequence to index? [in]
 
80
 */
 
81
void BlastLookupIndexQueryExactMatches(Int4 **backbone,
 
82
                                       Int4 word_length,
 
83
                                       Int4 charsize,
 
84
                                       Int4 lut_word_length,
 
85
                                       BLAST_SequenceBlk * query,
 
86
                                       BlastSeqLoc * locations);
 
87
 
 
88
/** Given a word, compute its index value from scratch.
 
89
 *
 
90
 * @param wordsize length of the word, in residues [in]
 
91
 * @param charsize length of one residue, in bits [in]
 
92
 * @param word pointer to the beginning of the word [in]
 
93
 * @return the computed index value
 
94
 */
 
95
 
 
96
static NCBI_INLINE Int4 ComputeTableIndex(Int4 wordsize,
 
97
                                  Int4 charsize,
 
98
                                  const Uint1* word)
 
99
{
 
100
  Int4 i;
 
101
  Int4 index = 0;
 
102
 
 
103
  for(i = 0; i < wordsize; i++) {
 
104
    index = (index << charsize) | word[i];
 
105
  }
 
106
 
 
107
  return index;
 
108
}
 
109
 
 
110
/** Given a word, compute its index value, reusing a previously 
 
111
 *  computed index value.
 
112
 *
 
113
 * @param wordsize length of the word - 1, in residues [in]
 
114
 * @param charsize length of one residue, in bits [in]
 
115
 * @param mask value used to mask the index so that only the bottom wordsize * charsize bits remain [in]
 
116
 * @param word pointer to the beginning of the word [in]
 
117
 * @param index the current value of the index [in]
 
118
 * @return the computed index value
 
119
 */
 
120
 
 
121
static NCBI_INLINE Int4 ComputeTableIndexIncremental(Int4 wordsize,
 
122
                                             Int4 charsize,
 
123
                                             Int4 mask,
 
124
                                             const Uint1* word,
 
125
                                             Int4 index)
 
126
{
 
127
  return ((index << charsize) | word[wordsize - 1]) & mask;
 
128
}
416
129
 
417
130
#ifdef __cplusplus
418
131
}
419
132
#endif
420
133
 
421
 
#endif /* BLAST_LOOKUP__H */
 
134
#endif /* !ALGO_BLAST_CORE__BLAST_LOOKUP__H */