40 Int4 hits_in_chain = 0;
49 if (backbone[index] ==
NULL) {
54 chain[0] = chain_size;
55 chain[1] = hits_in_chain;
56 backbone[index] = chain;
59 chain = backbone[index];
60 chain_size = chain[0];
61 hits_in_chain = chain[1];
65 if ((hits_in_chain + 2) == chain_size) {
66 chain_size = chain_size * 2;
67 chain = (
Int4 *) realloc(chain, chain_size *
sizeof(
Int4));
70 backbone[index] = chain;
71 chain[0] = chain_size;
75 chain[chain[1] + 2] = query_offset;
90 Uint1 invalid_mask = 0xff << charsize;
92 for (loc = locations; loc; loc = loc->
next) {
99 if (word_length > to - from + 1)
105 seq =
query->sequence + from;
106 word_target = seq + lut_word_length;
110 if (seq >= word_target) {
112 lut_word_length, charsize,
113 seq - lut_word_length,
114 offset - lut_word_length);
119 if (*seq & invalid_mask)
120 word_target = seq + lut_word_length + 1;
124 if (seq >= word_target) {
126 lut_word_length, charsize,
127 seq - lut_word_length,
128 offset - lut_word_length);
185 for (
i = 0;
i < wordsize;
i++) {
186 large_index = (large_index << charsize) | seq[
i];
202 if (backbone[index].num_offsets == 0) {
208 while (
b->next &&
b->word != large_index) {
213 if (
b->word == large_index) {
241 Int4 lut_word_length,
252 Uint1 invalid_mask = 0xff << charsize;
254 for (loc = locations; loc; loc = loc->
next) {
261 if (word_length > to - from + 1)
267 seq =
query->sequence + from;
268 word_target = seq + lut_word_length;
272 if (seq >= word_target) {
275 lut_word_length, charsize,
276 seq - lut_word_length,
284 if (*seq & invalid_mask)
285 word_target = seq + lut_word_length + 1;
289 if (seq >= word_target) {
292 lut_word_length, charsize,
293 seq - lut_word_length,
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
void BlastLookupAddWordHit(Int4 **backbone, Int4 wordsize, Int4 charsize, Uint1 *seq, Int4 query_offset)
Add a single query offset to a generic lookup table.
static Int2 s_AddWordHit(BackboneCell *backbone, Int4 *offsets, Int4 wordsize, Int4 charsize, Uint1 *seq, Int4 offset, TNaLookupHashFunction hash_func, Uint4 mask, PV_ARRAY_TYPE *pv_array)
BackboneCell * BackboneCellFree(BackboneCell *cell)
void BlastHashLookupIndexQueryExactMatches(BackboneCell *backbone, Int4 *offsets, Int4 word_length, Int4 charsize, Int4 lut_word_length, BLAST_SequenceBlk *query, BlastSeqLoc *locations, TNaLookupHashFunction hash_func, Uint4 mask, PV_ARRAY_TYPE *pv_array)
BackboneCell * BackboneCellNew(Uint4 word, Int4 offset)
Create a new cell for a given word and offset.
void BlastLookupIndexQueryExactMatches(Int4 **backbone, Int4 word_length, Int4 charsize, Int4 lut_word_length, BLAST_SequenceBlk *query, BlastSeqLoc *locations)
Add all applicable query offsets to a generic lookup table.
Int4 BackboneCellInit(BackboneCell *cell, Uint4 word, Int4 offset)
Initialize an olready allocated cell for a given word and offset.
Common definitions for protein and nucleotide lookup tables.
#define PV_ARRAY_BTS
bits-to-shift from lookup_index to pv_array index.
#define PV_TEST(lookup, index, shift)
Test the bit at position 'index' in the PV array bitfield within 'lookup'.
static NCBI_INLINE Int4 ComputeTableIndex(Int4 wordsize, Int4 charsize, const Uint1 *word)
Given a word, compute its index value from scratch.
Uint4(* TNaLookupHashFunction)(Uint1 *, Uint4)
Hash function type for the lookup table.
#define PV_ARRAY_TYPE
The pv_array 'native' type.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
uint8_t Uint1
1-byte (8-bit) unsigned integer
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
#define ASSERT
macro for assert.
static PCRE2_SIZE * offsets
Structure to hold a sequence.
Thin backbone cell for nucleotide lookup table with hashed words.
Used to hold a set of positions, mostly used for filtering.
SSeqRange * ssr
location data on the sequence.
struct BlastSeqLoc * next
next in linked list
Int4 left
left endpoint of range (zero based)
Int4 right
right endpoint of range (zero based)
voidp calloc(uInt items, uInt size)