| Function length The number of characters in the underlying text of the index is returned. length(index) Include Headers seqan/index.h Parameters
index | The index to return the number of characters of. Types: Index
Remarks If the underlying text is a StringSet then the sum of all characters of the sequneces in the string set is returned. Return Values The number of characters in the raw underlying text of the index is returned. Metafunctions: Size Member of Index Examples The following code shows how length can be used on an index in order to determine the number of characters in the underlying text. File "index_length_countSequences.cpp"
1 | #include <seqan/index.h>
2 |
3 | using namespace seqan;
4 |
5 | int main ()
6 | {
7 | typedef StringSet<String<char> > TText;
8 | typedef Index<TText> TIndex;
9 | typedef SAValue<TIndex>::Type TSAValue;
10 |
11 | TText text;
12 | appendValue(text, "MISSISSIPPI");
13 | appendValue(text, "MYMISSISAHAPPY");
14 |
15 | TIndex index(text);
16 | Finder<TIndex> finder(index);
17 |
18 | std::cout << "The text has " << length(index) << " characters and consists of " << countSequences(index) <<
19 | " sequences." << std::endl;
20 |
21 | // The Finder object has a pointer to the first, current and last hit
22 | // Each consecutive call sets the current pointer to the appropriate hit
23 | while (find(finder, "MISS"))
24 | std::cout << "Hit at position: " << position(finder) << std::endl;
25 |
26 | return 0;
27 | }
Hit at position: < 1 , 2 > Hit at position: < 0 , 0 > SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2014/10/13 16:12:57