Class
Index
Contains preprocessing data of a fixed text. In combination with a Finder or a VSTree Iterator it allows fast dictionary look-up and advanced computations.
Include Headers
seqan/index.h
Remarks
Indices allow fast dictionary look-ups and other advanced computations because they contain pre-computated
information about the underlying text. These information are stored in so called fibres (see Fibre).
In order to search for a pattern one can use a Finder or a VSTree Iterator. The Finder
is especially useful when searching for exact matches while the VSTree Iterator allows to iterate an index as if
traversing a tree/trie.
These fibres are created on demand depending on the requirements of an algorithm.
Specializations
| An index based on the Burrows-Wheeler transform. | |
| The enhanced suffix array index is very fast index, requiring more memory than other indices. In addition to the suffix array an lcp (longest common prefix) table and a child table (containing structural information of the suffix tree) are provided. | |
| An index based on an array of sorted q-grams. Especially useful for q-gram/k-mer searches. | |
| An index based on a suffix array. | |
| This index represents a lazy suffix tree, meaning that a path from the tree of the index in only computed, if it is traversed. For details see Giegerich et al., "Efficient implementation of lazy suffix trees". | |
| An adapter for the Pizza & Chili index API. |
Metafunctions
| Type of a specific container member (fibre). | |
| The default alphabet type of a suffix array, i.e. the type to store a position of a string or string set. |
Functions
| Resets an object. | |
| Return the number of sequences in an index' underlying text. | |
| The end of a container. | |
| Returns a specific fibre of a container. | |
| Creates a specific Fibre. | |
| On-demand creation of a specific Fibre. | |
| Shortcut for | |
| Returns whether a specific Fibre is present. | |
| Shortcut for | |
| The number of characters in the underlying text of the index is returned. | |
| This functions opens an index from disk. | |
| This functions saves an index to disk. |
Examples
The following code shows how to search for exact matches between the reference "tobeornottobe" and the
pattern "to" with the means of a Finder.
File "index_finder.cpp"
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
Hit at position: 0
This code shows how an index can be used with iterators to achieve a pre-order tree like traversal
in DFS of the text "tobeornottobe". In order to do so a Top-Down History iterator is used.
File "index_iterator.cpp"
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 |
beornottobe
e
eornottobe
nottobe
o
obe
obeornottobe
ornottobe
ottobe
rnottobe
t
tobe
tobeornottobe
ttobe
Note that you can also use specialised iterators such as:
or
You can achieve a post-order traversal like this:
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 |
Snippet from "index_iterator_short.cpp"
be
eornottobe
e
nottobe
obeornottobe
obe
ornottobe
ottobe
o
rnottobe
tobeornottobe
tobe
ttobe
t
Example Programs
SeqAn - Sequence Analysis Library - www.seqan.de
