| Class Gaps 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.
SequenceConcept
Gaps
AnchorGaps | ArrayGaps
Gaps<TSequence, TSpec> Include Headers seqan/align.h Parameters
TSequence | The type of the underlying sequence. Types: SequenceConcept
TSpec | Specialization tag.
Implements SequenceConcept Specializations
AnchorGaps | Stores gaps anchors of the first characters behind gaps.
ArrayGaps | Stores length of gap- and non-gapped runs in an array.
Metafunctions
GetValue | Type for reading values.
IsSequence | Determines whether a container stores its elements in sequential order.
Iterator | Type of iterator objects that are used to traverse the container.
Position | Type of an object that represents a position in a container.
Reference | Reference type.
Size | Type of an object that is suitable to hold size information.
Source | Return underlying sequence of Gaps/Alignments.
Value | Type of the items in the container or behind an iterator.
Member Functions
Gaps | Constructor
Functions
assignSource | Assign the source of a Gaps object, copying data.
assignValue | Assigns value to item. (ContainerConcept)
back | The last item in container. (ContainerConcept)
bandedChainAlignment | Computes the best global pairwise alignment between two sequences given a non-empty seed chain.
begin | The begin of a container. (ContainerConcept)
beginPosition | Begin position of object in host. (ContainerConcept)
clearClipping | Clear clipping from Gaps object.
clearGaps | Clear gaps and clipping from Gaps object.
clippedBeginPosition | Return the begin position of the clipping in the unclipped gapped sequence.
clippedEndPosition | Return the end position of the clipping in the unclipped gapped sequence.
end | The end of a container. (ContainerConcept)
endPosition | End position of object in host. (ContainerConcept)
front | The first item in container. (ContainerConcept)
getValue | Access to the value. (ContainerConcept)
globalAlignment | Computes the best global pairwise alignment.
insertGap | Insert one gap into a gapped sequence.
insertGaps | Insert multiple gaps into a gapped sequence.
isGap | Query whether a given clipped view position is a gap.
length | The number of items/characters. (ContainerConcept)
localAlignment | Computes the best pairwise local alignment using the Smith-Waterman algorithm.
moveValue | Assigns value to item. (ContainerConcept)
nextLocalAlignment | Compute next suboptimal local alignment.
position | Position of an iterator. (ContainerConcept)
removeGap | Remove one gap from a gapped sequence.
removeGaps | Remove multiple gaps from a gapped sequence.
setBeginPosition | Set the begin position of the clipped gapped sequence, given a source position.
setClippedBeginPosition | Sets the begin position of the clipping.
setClippedEndPosition | Sets the end position of the clipping.
setEndPosition | Set the end position of the clipped gapped sequence, given a source position.
setSource | Set the source of a Gaps object, do not copy if possible.
source | Return underlying object.
splitAlignment | Compute split alignments.
toSourcePosition | Transforms view to source position, if the view position is a gap, the original position of the next non-gap entry is returned.
toViewPosition | Transforms source to view position.
unclippedLength | Return length of the gapped sequence without clipping.
Examples 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. File "gaps_example.cpp"
1 | #include <seqan/align.h>
2 | #include <seqan/basic.h>
3 | #include <seqan/file.h> // for printing Seqan strings
4 |
5 | using namespace seqan;
6 |
7 | int main()
8 | {
9 | Dna5String seq = "CGGTATC";
10 |
11 | // Construct the gaps object.
12 | Gaps<Dna5String> gaps(seq);
13 |
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);
19 |
20 | // Clip the gaps object. Note that the coordinates are in unclipped view position.
21 | setClippedBeginPosition(gaps, 1);
22 | setClippedEndPosition(gaps, 8);
23 |
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";
30 |
31 | return 0;
32 | }
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 - www.seqan.de

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