Concept TextConcept
Concept for a type that can be as text of an index.

Defined in <seqan/sequence.h>
Signature concept TextConcept;

Detailed Description

Certain algorithms and data structures can work for both strings and string sets but need to treat these two types slightly different. Examples are index data structures and algorithms that build the indices and use the indices for lookup.

To facilitate writing of generic algorithms, the TextConcept concept gives a common interface to both for this kind of algorithms.

See Also

Interface Function Overview

Interface Metafunction Overview

Interface Functions Detail

TSeqNo getSeqNo(pos[, limits]);

Returns the sequence number of a position.

Parameters

pos A position. Types: Pair
limits The limits string returned by stringSetLimits.

Returns

TSeqNo A single integer value that identifies the string within the stringset pos points at. If limits is omitted or Nothing getSeqNo returns 0.If pos is a local position (of class Pair) then i1 is returned.If pos is a global position (integer type and limits is a String) then pos is converted to a local position and i1 is returned.

TOffset getSeqOffset(pos[, limits]);

Returns the local sequence offset of a position.

Parameters

pos A position. Types: Pair
limits The limits string returned by stringSetLimits.

Returns

TOffset A single integer value that identifies the position within the string pos points at.If limits is omitted or Nothing getSeqNo returns pos. If pos is a local position (of class Pair) then i2 is returned.If pos is a global position (integer type and limits is a String) then pos is converted to a local position and i2 is returned.

TPos posGlobalize(pos, limits)

Converts a local/global to a global position.

Parameters

pos A local or global position (pair or integer value). Types: Pair
limits The limits string returned by stringSetLimits.

Returns

TPos The corresponding global position of pos. If pos is an integral type pos is returned. If not, limits[getSeqNo(pos, limits)] + getSeqOffset(pos, limits) is returned.

void posLocalize(result, pos, limits)

Converts a local/global to a local position.

Parameters

pos A local or global position (pair or integer value).
limits The limits string returned by stringSetLimits.
result Reference to the resulting corresponding local position of pos.

void posLocalToX(dst, localPos, limits);

Converts a local to a local/global position.

Parameters

dst The local or global position (pair or integer value) is written here.
localPos The local position.
limits The string limits as returned by stringSetLimits.

TStringSetLimits stringSetLimits(text);

Return string delimiter positions for TextConcept types.

Parameters

text The text to query for its string set limits.

Returns

TStringSetLimits The string set limits (of type StringSetLimits).

Interface Metafunctions Detail

SAValue<TText>::Type

The default alphabet type of a suffix array, i.e. the type to store a position of a string or string set.

Template Parameters

TText The text type to query.

Returns

TReturn A type to store a position in a TText. This could be an integer for strings or a pair of integers for string sets.

Usage

This type should be removed for functions returning positions in texts such as online or index-based search. Thus, always use this metafunction for declaring position variables.

Use the functions posLocalize, posGlobalize, getSeqNo, and getSeqOffset for conversion between local and global positions in texts.

Examples

The following shows the original definition of the SAValue metafunction in SeqAn.

template <typename TString, typename TSpec>
struct SAValue<StringSet<TString, TSpec> >
{
    typedef Pair<
            typename Size<StringSet<TString, TSpec> >::Type,
            typename SAValue<TString>::Type,
            Pack
        > Type;
};

StringSetLimits<TText>::Type;

Return type of string set limits for TextConcept types.

Template Parameters

TText The type of the text.

Returns

Type The type of string set limits objects.