Index Finder StringSet

| Example Program Index Finder StringSet Example for using a Finder of an Index of a StringSet. This example shows how to use the Finder class for an Index search. The Index was build for a given StringSet. File "index_find_stringset.cpp" A tutorial about an index based finder for a StringSet.
1 | #include <iostream>
2 | #include <seqan/index.h>
3 |
4 | using namespace seqan;
5 |
6 | int main ()
7 | {
First, we create a StringSet of 3 Strings.
8 | StringSet< String<char> > mySet;
9 | resize(mySet, 3);
10 | mySet[0] = "tobeornottobe";
11 | mySet[1] = "thebeeonthecomb";
12 | mySet[2] = "beingjohnmalkovich";
13 |
Then we create an Index of our StringSet and a Finder of the Index.
14 | Index< StringSet<String<char> > > myIndex(mySet);
15 | Finder< Index<StringSet<String<char> > > > myFinder(myIndex);
16 |
Finally we search for the string "be" and output all occurences
17 | ::std::cout << "hit at ";
18 | while (find(myFinder, "be"))
19 | ::std::cout << position(myFinder) << " ";
20 | ::std::cout << ::std::endl;
21 |
22 | return 0;
23 | }
Output weese@tanne:~/seqan$ cd demos weese@tanne:~/seqan/demos$ make index_find_stringset weese@tanne:~/seqan/demos$ ./index_find_stringset hit at < 0 , 11 > < 1 , 3 > < 2 , 0 > < 0 , 2 > weese@tanne:~/seqan/demos$ See Index, StringSet, find, Finder SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2012/03/14 16:34:46