Function
hashNext
Computes the hash value for the adjacent shape.
Overlapping q-grams can efficiently be hashed by calling hash on the first text position and hashNext on succeeding, adjacent positions. Alternatively, hashInit can be used to replace the first hash call by another hashNext call and hence ease loops iterating all overlapping q-grams.
hashNext(shape, it)
Include Headers
seqan/index.h
Parameters
shape
Shape to be used for hashing.
Types: Shape
it
Sequence iterator pointing to the first character of the adjacent shape.
Remarks
hash has to be called before.
Return Values
Hash value of the q-gram.
Member of
Examples
Hash loop example that outputs the hash values of all overlapping 3-grams using hash and hashNext.
1#include <seqan/sequence.h>
2#include <seqan/index.h>
3
4using namespace seqan;
5
6int main ()
7{
8    DnaString text = "AAAACACAGTTTGA";
9    Shape<Dna, UngappedShape<3> > myShape;
10
11    // output the hash value of all overlapping 3-grams
12    std::cout << hash(myShape, begin(text));
13    for (unsigned i = 1; i < length(text) - length(myShape) + 1; ++i)
14        std::cout << '\t' << hashNext(myShape, begin(text) + i);
15
16    return 0;
17}
The overlapping hash values are:
0    0    1    4    17    4    18    11    47    63    62    56
See Also
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:36