Function
hashInit
Preprocessing step of a pure hashNext loop.
Overlapping q-grams can efficiently be hashed by calling hash on the first text position and hashNext on succeeding, adjacent positions. One drawback of this scenario is that for-loops cannot start with the first position directly and become more complicated. As a remedy, hashInit was introduced which initializes the Shape to be used with hashNext on the first position directly.
Include Headers
seqan/index.h
Parameters
Shape to be used for hashing. Types: Shape | |
Sequence iterator pointing to the first text character of the shape. |
Member of
Examples
Two hash loop examples. The first loop uses hash/hashNext while the second use hashInit/hashNext and can process all hashes within the loop.
File "shape_hash_init.cpp"
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 |
The two loops produce the same hash values:
0 0 1 4 17 4 18 11 47 63 62 56
See Also
SeqAn - Sequence Analysis Library - www.seqan.de