Function
countSequences
Return the number of sequences in an index' underlying text.
countSequences(index)
Include Headers
seqan/index.h
Parameters

index | The index to return the number of sequences of. Types: Index

Return Values
The number of sequences in the index' underlying text.
Metafunctions: Size
Member of
Index
Examples
The following code shows how countSequences can be used on an index in order to determine the number of sequences in the underlying text (which can be a StringSet).
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 >
Example Programs
Index countOccurrencesMultiple
SeqAn - Sequence Analysis Library - www.seqan.de

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