Class
Shape
Stores hash value and shape for an ungapped or gapped q-gram.

Shape

GappedShape | GenericShape | OneGappedShape | SimpleShape | UngappedShape

Shape<TValue, TSpec>
Parameters

TValue | The Value type of the string the shape is applied to (e.g. Dna).
TSpec | The specializing type. Default: SimpleShape, for ungapped q-grams.

Remarks
The ValueSize of Shape is the ValueSize of TValue which is the alphabet size.
To get the span or the weight of a shape call length or weight.
Specializations

GappedShape | A fixed gapped shape.
GenericShape | A variable gapped shape.
OneGappedShape | A variable shape with one optional gap.
SimpleShape | A variable length ungapped shape (also called q-gram or k-mer).
UngappedShape | A fixed length ungapped shape (also called q-gram or k-mer).

Metafunctions

Host | Type of the object a given object depends on.
LENGTH | Number of elements in a fixed-size container.
Size | Type of an object that is suitable to hold size information.
Value | Type of the items in the container or behind an iterator.
ValueSize | Number of different values a value type object can have.
WEIGHT | Number of relevant positions in a shape.

Member Functions

Shape | Constructor

Functions

countOccurrences | Returns the number of occurrences of representative substring or a q-gram in the index text.
countOccurrencesMultiple | Returns the number of occurrences of a q-gram for every sequence of a StringSet .
createCountArray | Builds an index on a StringSet storing how often a q-gram occurs in each sequence.
createQGramIndex | Builds a q-gram index on a sequence.
createQGramIndexDirOnly | Builds the directory of a q-gram index on a sequence.
createQGramIndexSAOnly | Builds the suffix array of a q-gram index on a sequence.
getOccurrence | Returns an occurrence of the representative substring or a q-gram in the index text.
getOccurrences | Returns all occurrences of the representative substring or a q-gram in the index text.
hash | Computes a (lower) hash value for a shape applied to a sequence.
hash2 | Computes an unique hash value of a shape applied to a sequence, even if the sequence is shorter than the shape span
hash2Next | Computes a unique hash value for the adjacent shape, even if it is shorter than q.
hash2Upper | Computes an upper unique hash value of a shape applied to a sequence, even if the sequence is shorter than the shape span.
hashInit | Preprocessing step of a pure hashNext loop.
hashNext | Computes the hash value for the adjacent shape.
hashUpper | Computes an upper hash value for a shape applied to a sequence.
indexShape | Shortcut for getFibre(.., QGramShape).
length | The number of items/characters.
range | Returns the suffix array interval borders of occurrences of representative substring or a q-gram in the index text.
shapeToString | Converts a given shape into a sequence of '1' (relevant position) and '0' (irrelevant position).
value | Reference to the value.
weight | Number of relevant positions in a shape.

Examples
The following code shows how one can use a gapped shape to search for the pattern "ACxA" in a reference. First we assign a form to the shape and then compute the corresponding hash value. The hash value of a string and a Shape object is unique, such that one can retrieve the string from a shape if the hash value is known.
File "shape.cpp"

1 | #include <seqan/sequence.h>
2 | #include <seqan/index.h>
3 |
4 | using namespace seqan;
5 |
6 | int main ()
7 | {
8 | DnaString genome = "ACGACGTGCAACGTACGACTAGCATCGGATCAGCAT";
9 |
10 | Shape<Dna, OneGappedShape> myShape;
11 | stringToShape(myShape, "1101");
12 |
13 | // compute hash of a search pattern
14 | unsigned hashedPattern = hash(myShape, "ACGA");
15 | std::cout << "The hash is: " << hashedPattern << std::endl;
16 |
17 | // compute all overlapping hashes and compare with hash of pattern
18 | for (unsigned i = 0; i < length(genome) - length(myShape) + 1; ++i)
19 | if (hash(myShape, begin(genome) + i) == hashedPattern)
20 | std::cout << "Hit at position: " << i <<std::endl;
21 |
22 | return 0;
23 | }

The hash is: 4
Hit at position: 0
Hit at position: 14
Hit at position: 17
SeqAn - Sequence Analysis Library - www.seqan.de

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