Efficient storage of gaps for a sequence.
In the figure above, the source sequence has seven characters, the gapped sequence has four gaps and thus consists of eleven characters. The gapped sequence is clipped to start at position 0 in the gapped sequence and to end at position 8 in the gapped sequence (the positions given as half-open intervals [begin, end)).
Gaps wrap a SequenceConcept and allows to (1) insert gaps into the sequence and (2) select an infix of the gapped sequence (clipping). The gaps are not inserted into the underlying sequence (source) but stored separately. Using the clipping is optional and meant for selecting parts of the alignment as a part of the result of a local alignment algorithm.
Illustration of Gaps object and positions with clipping.
The figure shows the three coordinate systems that are used with Gaps objects. The source position is the position in the underlying sequence. The unclipped view position is the position in the gapped sequence without gaps. The view position is the position in the gapped sequence but including the clipping: All (clipped) view positions have the clipping begin position subtracted from them.
Gaps<TSequence, TSpec>
Include Headers
The type of the underlying sequence.
Specialization tag.
AnchorGapsStores gaps anchors of the first characters behind gaps.
ArrayGapsStores length of gap- and non-gapped runs in an array.
GetValueType for reading values.
IsSequenceDetermines whether a container stores its elements in sequential order.
IteratorType of iterator objects that are used to traverse the container.
PositionType of an object that represents a position in a container.
ReferenceReference type.
SizeType of an object that is suitable to hold size information.
SourceReturn underlying sequence of Gaps/Alignments.
ValueType of the items in the container or behind an iterator.
Member Functions
assignSourceAssign the source of a Gaps object, copying data.
assignValueAssigns value to item. (ContainerConcept)
backThe last item in container. (ContainerConcept)
bandedChainAlignmentComputes the best global pairwise alignment between two sequences given a non-empty seed chain.
beginThe begin of a container. (ContainerConcept)
beginPositionBegin position of object in host. (ContainerConcept)
clearClippingClear clipping from Gaps object.
clearGapsClear gaps and clipping from Gaps object.
clippedBeginPositionReturn the begin position of the clipping in the unclipped gapped sequence.
clippedEndPositionReturn the end position of the clipping in the unclipped gapped sequence.
endThe end of a container. (ContainerConcept)
endPositionEnd position of object in host. (ContainerConcept)
frontThe first item in container. (ContainerConcept)
getValueAccess to the value. (ContainerConcept)
globalAlignmentComputes the best global pairwise alignment.
insertGapInsert one gap into a gapped sequence.
insertGapsInsert multiple gaps into a gapped sequence.
isGapQuery whether a given clipped view position is a gap.
lengthThe number of items/characters. (ContainerConcept)
localAlignmentComputes the best pairwise local alignment using the Smith-Waterman algorithm.
moveValueAssigns value to item. (ContainerConcept)
nextLocalAlignmentCompute next suboptimal local alignment.
positionPosition of an iterator. (ContainerConcept)
removeGapRemove one gap from a gapped sequence.
removeGapsRemove multiple gaps from a gapped sequence.
setBeginPositionSet the begin position of the clipped gapped sequence, given a source position.
setClippedBeginPositionSets the begin position of the clipping.
setClippedEndPositionSets the end position of the clipping.
setEndPositionSet the end position of the clipped gapped sequence, given a source position.
setSourceSet the source of a Gaps object, do not copy if possible.
sourceReturn underlying object.
splitAlignmentCompute split alignments.
toSourcePositionTransforms view to source position, if the view position is a gap, the original position of the next non-gap entry is returned.
toViewPositionTransforms source to view position.
unclippedLengthReturn length of the gapped sequence without clipping.
The following example shows the construction of the gaps object from the image above together with some calls to toViewPosition and toSourcePosition. These functions allow the transformation between the source position and the clipped view position.
1#include <seqan/align.h>
2#include <seqan/basic.h>
3#include <seqan/file.h>  // for printing Seqan strings
5using namespace seqan;
7int main()
9    Dna5String seq = "CGGTATC";
11    // Construct the gaps object.
12    Gaps<Dna5String> gaps(seq);
14    // Insert gaps (view position, unclipped as of yet).  Note that inserting
15    // the gaps changes the coordinates.
16    insertGap(gaps, 3);
17    insertGap(gaps, 5);
18    insertGaps(gaps, 7, 2);
20    // Clip the gaps object.  Note that the coordinates are in unclipped view position.
21    setClippedBeginPosition(gaps, 1);
22    setClippedEndPosition(gaps, 8);
24    // Print the resulting gaps object and some coordinate transformation.
25    std::cout << "Resulting gaps: " << gaps << "\n"
26              << "toSourcePosition(gaps, 0) == " << toSourcePosition(gaps, 0) << "\n"
27              << "toSourcePosition(gaps, 4) == " << toSourcePosition(gaps, 4) << "\n"
28              << "toViewPosition(gaps, 0) == " << toViewPosition(gaps, 0) << "\n"
29              << "toViewPosition(gaps, 5) == " << toViewPosition(gaps, 6) << "\n";
31    return 0;
This yields the following output:
Resulting gaps: GG-T-A-
toSourcePosition(gaps, 0) == 1
toSourcePosition(gaps, 4) == 4
toViewPosition(gaps, 0) == -1
toViewPosition(gaps, 5) == 9
SeqAn - Sequence Analysis Library -

Page built @2013/07/11 09:12:34