Class
GapsStore the gapped version of a sequence.
Implements | ContainerConcept |
---|---|
All Subcl's | AnchorGaps, ArrayGaps |
All Impl'd | AssignableConcept, ContainerConcept, DestructibleConcept |
Defined in | <seqan/align.h> |
Signature |
template <typename TSequence, typename TSpec>
class Gaps;
|
Interface Function Overview
-
void assignSource(gaps, seq);
Assign the source of a gaps object, copying data. -
TPos beginPosition(gaps);
Return the clipping begin position as a source position. -
void clearClipping(gaps);
Clear clipping from Gaps objects. -
void clearGaps(gaps);
Clear gaps from Gaps objects. -
TPos clippedBeginPosition(gaps);
Return begin position of the clipping. -
TPos clippedEndPosition(gaps);
Return end position of the clipping. -
void clipSemiGlobal(global, local);
Clip the Gaps objects to reflect a semi-global alignment. -
void copyClipping(dest, source);
Copy clipping information from one Gaps object to another. -
void copyGaps(dest, source);
Copy gaps from one Gaps object to another (in the clipped view of both arguments). -
TSize countCharacters(gaps, viewPos[, dir]);
The number of characters following a position. -
TSize countGapExtensions(gaps);
The number of gap extensions. -
TSize countGapOpens(gaps);
The number of gap openings. -
TSize countGaps(gaps, viewPos[, dir]);
The number of gaps following a position. -
TSize countLeadingGaps(gaps);
The number of leading gaps. -
TSize countTrailingGaps(gaps);
The number of trailing gaps. -
TPos endPosition(gaps);
Return the clipping end position as a source position. -
void insertGap(gaps, viewPos);
Insert one gap character. -
void insertGaps(gaps, viewPos, count);
Insert gap characters. -
bool isGap(gaps, viewPos);
Query positions in a Gaps object for being a character. -
bool isGap(gaps, viewPos);
Query positions in a Gaps object for being a gap. -
TIterator iter(gaps, viewPos[, tag]);
Return an iterator to a specific position in the current clipping. -
TSize length(gaps);
Return number of gap and characters between the beginning and the end of the clipping. -
TSize removeGap(gaps, viewPos);
Remove one gap from a Gaps object. -
TSize removeGaps(gaps, viewPos, count);
Remove gaps from a Gaps object. -
void setBeginPosition(gaps, sourcePos);
Set the begin position of the clipped gapped sequence, given a source position. -
void setClippedBeginPosition(gaps, unclippedViewPos);
Set the begin position of the clipping. -
void setClippedEndPosition(gaps, unclippedViewPos);
Set the end position of the clipping. -
void setEndPosition(gaps, sourcePos);
Set the end position of the clipped gapped sequence, given a source position. -
TSource source(gaps);
Return underlying object. -
TPos toSourcePosition(gaps, viewPos);
Conversion from view position (including gaps and clipping) to source (without gaps or clipping). -
TPos toViewPosition(gaps, sourcePos);
Conversion from source (without gaps or clipping) to view position (including gaps and clipping). -
TSize unclippedLength(gaps);
Return length of the gapped sequence without clipping.
Interface Functions Inherited From AssignableConcept
Interface Functions Inherited From ContainerConcept
Interface Metafunction Overview
Interface Metafunctions Inherited From ContainerConcept
Detailed Description
Gaps wrap a Sequence and allows one 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.
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)).
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.
Examples
The following example shows the construction of the gaps object from the image above together with some calls to toViewPosition and toSourcePosition.
#include <seqan/align.h>
#include <seqan/basic.h>
#include <seqan/stream.h> // for printing Seqan strings
using namespace seqan;
int main()
{
Dna5String seq = "CGGTATC";
// Construct the gaps object.
Gaps<Dna5String> gaps(seq);
// Insert gaps (view position, unclipped as of yet). Note that inserting
// the gaps changes the coordinates.
insertGap(gaps, 3);
insertGap(gaps, 5);
insertGaps(gaps, 7, 2);
// Clip the gaps object. Note that the coordinates are in unclipped view position.
setClippedBeginPosition(gaps, 1);
setClippedEndPosition(gaps, 8);
// Print the resulting gaps object and some coordinate transformation.
std::cout << "Resulting gaps: " << gaps << "\n"
<< "toSourcePosition(gaps, 0) == " << toSourcePosition(gaps, 0) << "\n"
<< "toSourcePosition(gaps, 4) == " << toSourcePosition(gaps, 4) << "\n"
<< "toViewPosition(gaps, 0) == " << toViewPosition(gaps, 0) << "\n"
<< "toViewPosition(gaps, 5) == " << toViewPosition(gaps, 6) << "\n";
return 0;
}
The output is as follows:
Resulting gaps: GG-T-A- toSourcePosition(gaps, 0) == 1 toSourcePosition(gaps, 4) == 4 toViewPosition(gaps, 0) == -1 toViewPosition(gaps, 5) == 9
Interface Functions Detail
void assignSource(gaps, seq);
Parameters
gaps
|
The Gaps object to assign the source of. |
---|---|
seq
|
The sequence to assign to the underlying string. |
Data Races
TPos beginPosition(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TPos |
The clipping begin position in the source (Metafunction: Position). |
---|
Example
In the following gaps configuration, the result of beginPosition(gaps) is $1$. The clipping starts in a gap and the source position of the first non-gap character right of the clipping begin has source position 1.
clipping [ ) (half-open interval) gapped sequence: X--XXX-XX- source position: 0111234456 unclipped view position: 0123456789 clipped view position: 0123456
Data Races
void clearClipping(gaps);
Parameters
gaps
|
Object to clear clipping from. |
---|
Data Races
void clearGaps(gaps);
Parameters
gaps
|
Object to clear gaps from. |
---|
Data Races
TPos clippedBeginPosition(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TPos |
The begin position of the unclipped view (Metafunction: Position). |
---|
Example
In the following gaps configuration, the result of clippedBeginPosition(gaps) is 1.
clipping [ ) (half-open interval) gapped sequence: X--XXX-XX- source position: 0111234456 unclipped view position: 0123456789 clipped view position: 0123456
Data Races
TPos clippedEndPosition(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TPos |
The end position of the unclipped view (Metafunction: Position). |
---|
Example
In the following gaps configuration, the result of clippedEndPosition(gaps) is 7.
clipping [ ) (half-open interval) gapped sequence: X--XXX-XX- source position: 0111234456 unclipped view position: 0123456789 clipped view position: 0123456
Data Races
void clipSemiGlobal(global, local);
Parameters
global
|
The global Gaps object. |
---|---|
local
|
The local Gaps object. |
Leading and trailing gaps are clipped in the local Gaps object. The global Gaps object is updated accordingly.
Data Races
void copyClipping(dest, source);
Parameters
dest
|
The destination Gaps object. |
---|---|
source
|
The source Gaps object. |
Data Races
void copyGaps(dest, source);
Parameters
dest
|
The destination Gaps object (appropriate clipping, no gaps). |
---|---|
source
|
The source Gaps object. |
The user is responsible for ensuring that the gaps are over sequences of same length and appropriate clipping.
Data Races
TSize countCharacters(gaps, viewPos[, dir]);
Parameters
gaps
|
The Gaps object to query. |
---|---|
viewPos
|
View position (including clipping and gaps) to query at. |
dir
|
A tag to specify the counting direction. One of GapDirectionTags. Defaults to RightOfViewPos. |
Returns
TSize |
The number of non-gaps characters characters at viewPos (Metafunction: Size). |
---|
If the the direction tag is RightOfViewPos the current view position will be included in the count, and excluded when LeftOfViewPos is selected.
Data Races
TSize countGapExtensions(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TSize |
The total number of gap extensions (Metafunction: Size). |
---|
Data Races
TSize countGapOpens(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TSize |
The total number of gap openings (Metafunction: Size). |
---|
Data Races
TSize countGaps(gaps, viewPos[, dir]);
Parameters
gaps
|
The Gaps object to query. |
---|---|
viewPos
|
View position (including clipping and gaps) to query at. |
dir
|
A tag to specify the counting direction. One of GapDirectionTags. Defaults to RightOfViewPos. |
Returns
TSize |
The number of gap characters at viewPos (Metafunction: Size). |
---|
If the the direction tag is RightOfViewPos the current view position will be included in the count, and excluded when LeftOfViewPos is selected.
Data Races
TSize countLeadingGaps(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TSize |
The number of leading gap characters (Metafunction: Size). |
---|
Data Races
TSize countTrailingGaps(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TSize |
The number of trailing gap characters (Metafunction: Size). |
---|
Data Races
TPos endPosition(gaps);
Parameters
gaps
|
The Gaps object to query for the end position as a source position. |
---|
Returns
TPos |
The end position as a source position (Metafunction: Position). |
---|
Example
In the following gaps configuration, the result of endPositioN(gaps) is 4.
clipping [ ) (half-open interval) gapped sequence: X--XXX-XX- source position: 0111234456 unclipped view position: 0123456789 clipped view position: 0123456
Data Races
void insertGap(gaps, viewPos);
Parameters
gaps
|
The Gaps object to insert gap into. |
---|---|
viewPos
|
The view position (including clipping and gaps) to insert the gap at. |
Data Races
void insertGaps(gaps, viewPos, count);
Parameters
gaps
|
The Gaps object to insert gaps into. |
---|---|
viewPos
|
The view position (including clipping and gaps) to insert gaps at. |
count
|
The number of gaps to insert. |
Data Races
bool isGap(gaps, viewPos);
Parameters
gaps
|
The Gaps object to query. |
---|---|
viewPos
|
The view position (including clipping and gaps). |
Returns
bool |
The query result. |
---|
Data Races
bool isGap(gaps, viewPos);
Parameters
gaps
|
The Gaps object to query. |
---|---|
viewPos
|
The view position (including clipping and gaps). |
Returns
bool |
The query result. |
---|
Data Races
TIterator iter(gaps, viewPos[, tag]);
Parameters
gaps
|
The Gaps object to get an iterator into. |
---|---|
viewPos
|
View position to get an iterator to (Metafunction: Position). |
tag
|
An optional tag for selecting the iterator type. |
Returns
TIterator |
The resulting iterator. The type is Iterator<TGaps, TTag>::Type where TTag is the type of tag. |
---|
Data Races
TSize length(gaps);
Parameters
gaps
|
The Gaps object to query for its length. |
---|
Returns
TSize |
The number of gaps and characters between the beginning and the end of the clipping (Metafunction: Size). |
---|
Data Races
TSize removeGap(gaps, viewPos);
Parameters
gaps
|
The gaps object to remove one gap character from. |
---|---|
viewPos
|
The view positions to remove one gap character from. |
Returns
TSize |
The number of gap characters removed (Metafunction: Size). |
---|
Data Races
TSize removeGaps(gaps, viewPos, count);
Parameters
gaps
|
The gaps object to remove gap characters from. |
---|---|
viewPos
|
The view positions to remove gap characters from. |
count
|
The number of gap characters to remove. |
Returns
TSize |
The number of gap characters removed (Metafunction: Size). |
---|
Data Races
void setBeginPosition(gaps, sourcePos);
Parameters
gaps
|
The Gaps object to set the begin position in. |
---|---|
sourcePos
|
Position in the underlying sequence to set clipping to. |
Data Races
void setClippedBeginPosition(gaps, unclippedViewPos);
Parameters
gaps
|
The Gaps object to set the clipping begin position of. |
---|---|
unclippedViewPos
|
View position (including gaps but excluding clipping) to set the clipping begin to. |
Data Races
void setClippedEndPosition(gaps, unclippedViewPos);
Parameters
gaps
|
The Gaps object to set the clipping end position of. |
---|---|
unclippedViewPos
|
View position (including gaps but excluding clipping) to set the clipping end to. |
Data Races
void setEndPosition(gaps, sourcePos);
Parameters
gaps
|
The Gaps object to set the end position in. |
---|---|
sourcePos
|
Position in the underlying sequence to set clipping to. |
Data Races
TSource source(gaps);
Parameters
gaps
|
The Gaps object to return the underling sequence for. |
---|
Returns
TSource |
Reference to the source of the Gaps. |
---|
Data Races
TPos toSourcePosition(gaps, viewPos);
Parameters
gaps
|
The gaps object to use for translation. |
---|---|
sourcePos
|
The view position (including gaps and clipping) to translate. |
Returns
TPos |
The resulting position in the underlying sequence (Metafunction: Position). |
---|
Data Races
TPos toViewPosition(gaps, sourcePos);
Parameters
gaps
|
The gaps object to use for translation. |
---|---|
sourcePos
|
The source position (in the underlying sequence) to translate. |
Returns
TPos |
The resulting position in the view (Metafunction: Position). |
---|
Data Races
TSize unclippedLength(gaps);
Parameters
gaps
|
The Gaps object to query. |
---|
Returns
TSize |
The result (Metafunction: Size). |
---|