1 // ==========================================================================
2 //                 SeqAn - The Library for Sequence Analysis
3 // ==========================================================================
4 // Copyright (c) 2006-2010, Knut Reinert, FU Berlin
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 //     * Redistributions of source code must retain the above copyright
11 //       notice, this list of conditions and the following disclaimer.
12 //     * Redistributions in binary form must reproduce the above copyright
13 //       notice, this list of conditions and the following disclaimer in the
14 //       documentation and/or other materials provided with the distribution.
15 //     * Neither the name of Knut Reinert or the FU Berlin nor the names of
16 //       its contributors may be used to endorse or promote products derived
17 //       from this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
23 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 // DAMAGE.
30 //
31 // ==========================================================================
32 //  Author: Andreas Gogol-Doering <andreas.doering@mdc-berlin.de>
33 // ==========================================================================
34 
35 #ifndef SEQAN_HEADER_GAPS_BASE_H
36 #define SEQAN_HEADER_GAPS_BASE_H
37 
38 namespace SEQAN_NAMESPACE_MAIN
39 {
40 
41 //////////////////////////////////////////////////////////////////////////////
42 
43 /**.Metafunction.GappedValueType:
44 ..summary:Returns a value type that contains a blank value '-'.
45 ..signature:GappedValueType<T>::Type
46 ..param.T:The value type that should be expanded (if needed) by '-'.
47 ..returns.param.Type:A value type that can be used to store store values in $T$ and the value '-'.
48 */
49 
50 template <typename T>
51 struct GappedValueType
52 {
53 	typedef T Type;
54 };
55 
56 template <typename TValue, typename TSpec>
57 struct GappedValueType< SimpleType<TValue, TSpec> >
58 {
59 	typedef SimpleType<TValue, TSpec> THost_;
60 	typedef ModifiedAlphabet<THost_, ModExpand<'-'> > Type;
61 };
62 
63 //////////////////////////////////////////////////////////////////////////////
64 
65 
66 template <typename THost, typename TSpec>
67 inline ModifiedAlphabet<THost, ModExpand<'-', TSpec> >
68 gapValueImpl(ModifiedAlphabet<THost, ModExpand<'-', TSpec> > *)
69 {
70 SEQAN_CHECKPOINT
71 	static ModifiedAlphabet<THost, ModExpand<'-', TSpec> > const _gap = '-';
72 	return _gap;
73 }
74 
75 
76 //////////////////////////////////////////////////////////////////////////////
77 //////////////////////////////////////////////////////////////////////////////
78 // Tags
79 
80 struct ArrayGaps;
81 
82 
83 template <typename TSpec>
84 struct GapsIterator;
85 
86 
87 //////////////////////////////////////////////////////////////////////////////
88 //////////////////////////////////////////////////////////////////////////////
89 // Gaps
90 //////////////////////////////////////////////////////////////////////////////
91 // an instance of the Gaps class is a strictly increasing function
92 // between N_0 and N_0
93 
94 /**
95 .Class.Gaps:
96 ..cat:Alignments
97 ..cat:Sequences
98 ..summary:Stores the gaps in a gapped sequences.
99 ..signature:Gaps<TSource, TSpec>
100 ..param.TSource:Type of the ungapped sequence.
101 ...metafunction:Metafunction.Source
102 ..param.TSpec:The specializing type.
103 ...metafunction:Metafunction.Spec
104 ..remarks:The gaps are stored separately from the sequence.
105 The ungapped sequence is called the @Function.source@ of the gaps object.
106 $Gaps$ either stores the source (then it is the owner of the source), or refers to an external source (then it is @Function.dependent@).
107 ..include:seqan/align.h
108 */
109 
110 template <typename TSource, typename TSpec/* = ArrayGaps*/>
111 class Gaps;
112 
113 
114 //////////////////////////////////////////////////////////////////////////////
115 //////////////////////////////////////////////////////////////////////////////
116 // Size
117 //////////////////////////////////////////////////////////////////////////////
118 
119 template <typename TSource, typename TSpec>
120 struct Size<Gaps<TSource, TSpec> >
121 {
122 	typedef typename Size<TSource>::Type Type;
123 };
124 template <typename TSource, typename TSpec>
125 struct Size<Gaps<TSource, TSpec> const>
126 {
127 	typedef typename Size<TSource const>::Type Type;
128 };
129 
130 //////////////////////////////////////////////////////////////////////////////
131 // Position
132 //////////////////////////////////////////////////////////////////////////////
133 
134 ///.Metafunction.Position.param.T.type:Class.Gaps
135 
136 template <typename TSource, typename TSpec>
137 struct Position<Gaps<TSource, TSpec> >:
138 	Position<TSource>
139 {
140 };
141 template <typename TSource, typename TSpec>
142 struct Position<Gaps<TSource, TSpec> const>:
143 	Position<TSource>
144 {
145 };
146 
147 //////////////////////////////////////////////////////////////////////////////
148 // Source
149 //////////////////////////////////////////////////////////////////////////////
150 
151 /**
152 .Metafunction.Source:
153 ..summary:The underlying sequence for alignments or gaps data structures.
154 ..signature:Source<T>::Type
155 ..param.T:Type for which the source type is determined.
156 ...type:Class.Gaps
157 ..returns.param.Type:Source type of $T$.
158 ..include:seqan/align.h
159 */
160 
161 template <typename TSource, typename TSpec>
162 struct Source<Gaps<TSource, TSpec> >
163 {
164 	typedef TSource Type;
165 };
166 
167 
168 //////////////////////////////////////////////////////////////////////////////
169 
170 /**
171 .Metafunction.GetSource:
172 ..summary:The type returned by the @Function.source@ function.
173 ..signature:GetSource<T>::Type
174 ..param.T:Type for which the source is retrieved by @Function.source@.
175 ...type:Class.Gaps
176 ..returns.param.Type:The type returned by the @Function.source@ function.
177 ...remarks:This type is a reference to @Metafunction.Source@.
178 ..include:seqan/align.h
179 */
180 template <typename T>
181 struct GetSource
182 {
183 	typedef typename Source<T>::Type & Type;
184 };
185 
186 //////////////////////////////////////////////////////////////////////////////
187 // Iterator
188 //////////////////////////////////////////////////////////////////////////////
189 
190 ///.Metafunction.Iterator.param.T.type:Class.Gaps
191 
192 template <typename TSource, typename TSpec, typename TIteratorSpec>
193 struct Iterator<Gaps<TSource, TSpec>, TIteratorSpec>
194 {
195 	typedef Iter<Gaps<TSource, TSpec>, GapsIterator<TSpec> > Type;
196 };
197 template <typename TSource, typename TSpec, typename TIteratorSpec>
198 struct Iterator<Gaps<TSource, TSpec> const, TIteratorSpec>
199 {
200 	typedef Iter<Gaps<TSource, TSpec> const, GapsIterator<TSpec> > Type;
201 };
202 
203 //////////////////////////////////////////////////////////////////////////////
204 
205 ///.Metafunction.Spec.param.T.type:Class.Gaps
206 
207 template <typename TSource, typename TSpec>
208 struct Spec<Gaps<TSource, TSpec> >
209 {
210 	typedef TSpec Type;
211 };
212 template <typename TSource, typename TSpec>
213 struct Spec<Gaps<TSource, TSpec> const>
214 {
215 	typedef TSpec Type;
216 };
217 
218 //////////////////////////////////////////////////////////////////////////////
219 // Value
220 //////////////////////////////////////////////////////////////////////////////
221 
222 ///.Metafunction.Value.param.T.type:Class.Gaps
223 
224 template <typename TSource, typename TSpec>
225 struct Value<Gaps<TSource, TSpec> >:
226 	Value<TSource>
227 {
228 };
229 template <typename TSource, typename TSpec>
230 struct Value<Gaps<TSource, TSpec> const>:
231 	Value<TSource const>
232 {
233 };
234 
235 //////////////////////////////////////////////////////////////////////////////
236 // GetValue
237 //////////////////////////////////////////////////////////////////////////////
238 
239 ///.Metafunction.GetValue.param.T.type:Class.Gaps
240 
241 template <typename TSource, typename TSpec>
242 struct GetValue<Gaps<TSource, TSpec> >:
243 	Value<TSource> //no reference
244 {
245 };
246 template <typename TSource, typename TSpec>
247 struct GetValue<Gaps<TSource, TSpec> const>:
248 	Value<TSource const> //no reference
249 {
250 };
251 
252 
253 //////////////////////////////////////////////////////////////////////////////
254 // Reference
255 //////////////////////////////////////////////////////////////////////////////
256 
257 ///.Metafunction.Reference.param.T.type:Class.Gaps
258 
259 template <typename TSource, typename TSpec>
260 struct Reference<Gaps<TSource, TSpec> >
261 {
262 	typedef typename Iterator<Gaps<TSource, TSpec>, Standard>::Type TIterator_;
263 	typedef Proxy<IteratorProxy<TIterator_> > Type;
264 };
265 
266 template <typename TSource, typename TSpec>
267 struct Reference<Gaps<TSource, TSpec> const>
268 {
269 	typedef typename Iterator<Gaps<TSource, TSpec> const, Standard>::Type TIterator_;
270 	typedef Proxy<IteratorProxy<TIterator_> > Type;
271 };
272 
273 //////////////////////////////////////////////////////////////////////////////
274 //////////////////////////////////////////////////////////////////////////////
275 // Functions
276 //////////////////////////////////////////////////////////////////////////////
277 
278 ///.Function.id.param.object.type:Class.Gaps
279 
280 template <typename TSource, typename TSpec>
281 inline void const *
282 id(Gaps<TSource, TSpec> & me)
283 {
284 SEQAN_CHECKPOINT
285 	return id(source(me));
286 }
287 template <typename TSource, typename TSpec>
288 inline void const *
289 id(Gaps<TSource, TSpec> const & me)
290 {
291 SEQAN_CHECKPOINT
292 	return id(source(me));
293 }
294 
295 //////////////////////////////////////////////////////////////////////////////
296 
297 ///.Function.begin.param.object.type:Class.Gaps
298 
299 // returns iterator to left border
300 template <typename TSource, typename TSpec, typename TTag>
301 inline typename Iterator<Gaps<TSource, TSpec>, Tag<TTag> const>::Type
302 begin(Gaps<TSource, TSpec> & me,
303 	  Tag<TTag> const tag_)
304 {
305 SEQAN_CHECKPOINT
306 	return iter(me, beginPosition(me), tag_);
307 }
308 template <typename TSource, typename TSpec, typename TTag>
309 inline typename Iterator<Gaps<TSource, TSpec> const, Tag<TTag> const>::Type
310 begin(Gaps<TSource, TSpec> const & me,
311 	  Tag<TTag> const tag_)
312 {
313 SEQAN_CHECKPOINT
314 	return iter(me, beginPosition(me), tag_);
315 }
316 //////////////////////////////////////////////////////////////////////////////
317 
318 ///.Function.end.param.object.type:Class.Gaps
319 
320 // returns iterator to right border
321 template <typename TSource, typename TSpec, typename TTag>
322 inline typename Iterator<Gaps<TSource, TSpec>, Tag<TTag> const>::Type
323 end(Gaps<TSource, TSpec> & me,
324 	Tag<TTag> const tag_)
325 {
326 SEQAN_CHECKPOINT
327 	return iter(me, endPosition(me), tag_);
328 }
329 template <typename TSource, typename TSpec, typename TTag>
330 inline typename Iterator<Gaps<TSource, TSpec> const, Tag<TTag> const>::Type
331 end(Gaps<TSource, TSpec> const & me,
332 	Tag<TTag> const tag_)
333 {
334 SEQAN_CHECKPOINT
335 	return iter(me, endPosition(me), tag_);
336 }
337 
338 //////////////////////////////////////////////////////////////////////////////
339 
340 ///.Function.length.param.object.type:Class.Gaps
341 
342 template <typename TSource, typename TSpec>
343 inline typename Size<Gaps<TSource, TSpec> >::Type
344 length(Gaps<TSource, TSpec> const & me)
345 {
346 SEQAN_CHECKPOINT
347 	return endPosition(me) - beginPosition(me);
348 }
349 
350 //////////////////////////////////////////////////////////////////////////////
351 //////////////////////////////////////////////////////////////////////////////
352 
353 /**
354 .Function.sourceBegin:
355 ..summary:Begin of the source segment.
356 ..cat:Alignments
357 ..signature:sourceBegin(object)
358 ..param.object:An object that has a source
359 ...type:Class.Gaps
360 ..returns:An iterator that points to the first item in @Function.source.source(object)@ that is used in object.
361 ..see:Function.begin
362 ..see:Function.source
363 ..include:seqan/align.h
364 */
365 
366 template <typename TSource, typename TSpec, typename TTag>
367 inline typename Iterator<TSource, Tag<TTag> const>::Type
368 sourceBegin(Gaps<TSource, TSpec> const & me,
369 			Tag<TTag> const tag_)
370 {
371 SEQAN_CHECKPOINT
372 	return iter(source(me), clippedBeginPosition(me), tag_);
373 }
374 template <typename TSource, typename TSpec>
375 inline typename Iterator<TSource, typename DefaultGetIteratorSpec<TSource>::Type>::Type
376 sourceBegin(Gaps<TSource, TSpec> const & me)
377 {
378 SEQAN_CHECKPOINT
379 	typedef typename DefaultGetIteratorSpec<TSource>::Type TDefaultGetIteratorSpec;
380 	return iter(source(me), clippedBeginPosition(me), TDefaultGetIteratorSpec());
381 }
382 
383 
384 //////////////////////////////////////////////////////////////////////////////
385 
386 
387 /**
388 .Function.sourceEnd:
389 ..summary:End of the source segment.
390 ..cat:Alignments
391 ..signature:sourceEnd(object)
392 ..param.object:An object that has a source
393 ...type:Class.Gaps
394 ..returns:An iterator that points behind the last item in @Function.source.source(object)@ that is used in object.
395 ..see:Function.end
396 ..see:Function.source
397 ..see:Function.sourceBegin
398 ..include:seqan/align.h
399 */
400 
401 template <typename TSource, typename TSpec, typename TTag>
402 inline typename Iterator<TSource, Tag<TTag> const>::Type
403 sourceEnd(Gaps<TSource, TSpec> const & me,
404 		  Tag<TTag> const tag_)
405 {
406 SEQAN_CHECKPOINT
407 	return iter(source(me), clippedEndPosition(me), tag_);
408 }
409 template <typename TSource, typename TSpec>
410 inline typename Iterator<TSource, typename DefaultGetIteratorSpec<TSource>::Type>::Type
411 sourceEnd(Gaps<TSource, TSpec> const & me)
412 {
413 SEQAN_CHECKPOINT
414 	typedef typename DefaultGetIteratorSpec<TSource>::Type TDefaultGetIteratorSpec;
415 	return iter(source(me), clippedEndPosition(me), TDefaultGetIteratorSpec());
416 }
417 
418 
419 //////////////////////////////////////////////////////////////////////////////
420 //////////////////////////////////////////////////////////////////////////////
421 
422 /**
423 .Function.insertGap:
424 ..cat:Alignments
425 ..summary:Insert one blank into a gapped sequence.
426 ..signature:insertGap(gapped_sequence, view_position)
427 ..param.gapped_sequence:A gapped sequence.
428 ...type:Class.Gaps
429 ..param.view_position:The view position at which the blank is inserted.
430 ..include:seqan/align.h
431 */
432 template <typename TSource, typename TSpec, typename TPosition>
433 inline void
434 insertGap(Gaps<TSource, TSpec> & me,
435 		  TPosition _view_pos)
436 {
437 SEQAN_CHECKPOINT
438 	insertGap(iter(me, _view_pos));
439 }
440 
441 //////////////////////////////////////////////////////////////////////////////
442 
443 /**
444 .Function.insertGaps:
445 ..cat:Alignments
446 ..summary:Insert blanks into a gapped sequence.
447 ..signature:insertGaps(gapped_sequence, view_position, count)
448 ..param.gapped_sequence:A gapped sequence.
449 ...type:Class.Gaps
450 ..param.view_position:The view position at which $count$ blanks are inserted.
451 ..param.count:Number of blanks to insert.
452 ..see:Function.insertGap
453 ..include:seqan/align.h
454 */
455 template <typename TSource, typename TSpec, typename TPosition, typename TSize>
456 inline void
457 insertGaps(Gaps<TSource, TSpec> & me,
458 		   TPosition _view_pos,
459 		   TSize _size)
460 {
461 SEQAN_CHECKPOINT
462 	insertGaps(iter(me, _view_pos), _size);
463 }
464 
465 //////////////////////////////////////////////////////////////////////////////
466 
467 /**
468 .Function.removeGap:
469 ..cat:Alignments
470 ..summary:Removes one blank from a gapped sequence.
471 ..signature:removeGap(gapped_sequence, view_position)
472 ..param.gapped_sequence:A gapped sequence.
473 ...type:Class.Gaps
474 ..param.view_position:The view position at which the blank is removed.
475 ..remarks:If there is no gap at position $view_position$ in $gapped_sequence$, then nothing happens.
476 ..see:Function.insertGap
477 ..include:seqan/align.h
478 */
479 template <typename TSource, typename TSpec, typename TPosition>
480 inline void
481 removeGap(Gaps<TSource, TSpec> & me,
482 		  TPosition _view_pos)
483 {
484 SEQAN_CHECKPOINT
485 	removeGap(iter(me, _view_pos));
486 }
487 
488 //////////////////////////////////////////////////////////////////////////////
489 
490 /**
491 .Function.removeGaps:
492 ..cat:Alignments
493 ..summary:Removes blanks from a gapped sequence.
494 ..signature:removeGaps(gapped_sequence, view_position, count)
495 ..param.gapped_sequence:A gapped sequence.
496 ...type:Class.Gaps
497 ..param.view_position:The view position at which up to $count$ blanks are removed.
498 ..param.count:Number of blanks
499 ..remarks:This funcion removes up to $count$ blanks.
500 If there is no gap at position $view_position$ in $gapped_sequence$, nothing happens.
501 If there are only $x < count$ consecutive blanks starting at position $view_position$ in $gappend_sequence$, then only $x$ blanks are removed.
502 ..see:Function.insertGaps
503 ..see:Function.removeGap
504 ..include:seqan/align.h
505 */
506 
507 template <typename TSource, typename TSpec, typename TPosition, typename TSize>
508 inline void
509 removeGaps(Gaps<TSource, TSpec> & me,
510 		   TPosition _view_pos,
511 		   TSize _size)
512 {
513 SEQAN_CHECKPOINT
514 	removeGaps(iter(me, _view_pos), _size);
515 }
516 
517 //////////////////////////////////////////////////////////////////////////////
518 
519 /**
520 .Function.isGap:
521 ..cat:Alignments
522 ..summary:Test a gapped sequence for gaps at a specific position.
523 ..signature:bool isGap(gapped_sequence, view_position)
524 ..param.gapped_sequence:A gapped sequence.
525 ...type:Class.Gaps
526 ..param.view_position:The view position at which $gapped_sequence$ is tested.
527 ..returns:$true$, if there is a gap at position $view_position$ in $gapped_sequence$, $false$ otherwise.
528 ..include:seqan/align.h
529 */
530 
531 template <typename TSource, typename TSpec, typename TPosition>
532 inline bool
533 isGap(Gaps<TSource, TSpec> & me,
534 	  TPosition view_pos)
535 {
536 SEQAN_CHECKPOINT
537 	return isGap(iter(me, view_pos));
538 }
539 template <typename TSource, typename TSpec, typename TPosition>
540 inline bool
541 isGap(Gaps<TSource, TSpec> const & me,
542 	  TPosition view_pos)
543 {
544 SEQAN_CHECKPOINT
545 	return isGap(iter(me, view_pos));
546 }
547 
548 //////////////////////////////////////////////////////////////////////////////
549 
550 /**
551 .Function.countGaps:
552 ..cat:Alignments
553 ..summary:Count blanks at a specific position in a gapped sequence.
554 ..signature:Size countGaps(gapped_sequence, view_position)
555 ..param.gapped_sequence:A gapped sequence.
556 ...type:Class.Gaps
557 ..param.view_position:The view position at which $gapped_sequence$ is tested.
558 ..returns:Number of consecutive gaps in $gapped_sequence$ starting at position $view_position$.
559 ...metafunction:Metafunction.Size
560 ..remarks:If there is no gap at position $view_position$, the function returns $0$.
561 ...text:If $view_position \geq $@Function.endPosition@$(gapped_sequence)$, the function returns $0$.
562 ..include:seqan/align.h
563 */
564 
565 // count gaps beginning at given view position
566 // counting trailing gaps returns either the intended trailing gaps or 0
567 
568 template <typename TSource, typename TSpec, typename TPosition>
569 inline typename Size<Gaps<TSource, TSpec> >::Type
570 countGaps(Gaps<TSource, TSpec> & me,
571 		  TPosition view_pos)
572 {
573 SEQAN_CHECKPOINT
574 	return countGaps(iter(me, view_pos));
575 }
576 template <typename TSource, typename TSpec, typename TPosition>
577 inline typename Size<Gaps<TSource, TSpec> >::Type
578 countGaps(Gaps<TSource, TSpec> const & me,
579 		  TPosition view_pos)
580 {
581 SEQAN_CHECKPOINT
582 	return countGaps(iter(me, view_pos));
583 }
584 
585 /**
586 .Function.countCharacters:
587 ..cat:Alignments
588 ..summary:Count characters at a specific position in a gapped sequence.
589 ..signature:Size countCharacters(gapped_sequence, view_position)
590 ..param.gapped_sequence:A gapped sequence.
591 ...type:Class.Gaps
592 ..param.view_position:The view position at which $gapped_sequence$ is tested.
593 ..returns:Number of consecutive characters in $gapped_sequence$ starting at position $view_position$.
594 ...metafunction:Metafunction.Size
595 ..remarks:If there is no character at position $view_position$, the function returns $0$.
596 ...text:If $view_position \geq $@Function.endPosition@$(gapped_sequence)$, the function returns $0$.
597 ..include:seqan/align.h
598 */
599 
600 // count characters beginning at given view position
601 
602 template <typename TSource, typename TSpec, typename TPosition>
603 inline typename Size<Gaps<TSource, TSpec> >::Type
604 countCharacters(Gaps<TSource, TSpec> const & me,
605 				TPosition view_pos)
606 {
607 SEQAN_CHECKPOINT
608 	return countCharacters(iter(me, view_pos));
609 }
610 
611 template <typename TSource, typename TSpec, typename TPoistion>
612 inline typename Size<Gaps<TSource, TSpec> >::Type
613 countCharacters(Gaps<TSource, TSpec> & me,
614 				TPoistion view_pos)
615 {
616 SEQAN_CHECKPOINT
617 	return countCharacters(iter(me, view_pos));
618 }
619 
620 //////////////////////////////////////////////////////////////////////////////
621 
622 /**
623 .Function.clearGaps:
624 ..cat:Alignments
625 ..summary:Remove blanks from a gapped sequence.
626 ..signature:clearGaps(gapped_sequence [, view_begin_pos, view_end_pos])
627 ..param.gapped_sequence:A gapped sequence.
628 ...type:Class.Gaps
629 ..param.view_begin_pos:First view position that is scanned for blanks. (optional)
630 ..param.view_end_pos:View Position behind the last item that is scanned for blanks. (optional)
631 ..remarks:All blanks after $view_begin_pos$ and before $view_end_pos$ are removed.
632 ...text:If no $view_begin_pos$ and $view_end_pos$ are specified, all gaps are removed from $gapped_sequence$.
633 ..include:seqan/align.h
634 */
635 
636 template <typename TSource, typename TSpec, typename TPosition1, typename TPosition2>
637 inline void
638 clearGaps(Gaps<TSource, TSpec> & me,
639 		  TPosition1 view_pos_begin,
640 		  TPosition2 view_pos_end)
641 {
642 SEQAN_CHECKPOINT
643 
644 	TPosition1 pos_left = view_pos_end - view_pos_begin;
645 	while (pos_left > 0)
646 	{
647 		if (isGap(me, view_pos_begin))
648 		{
649 			TPosition1 gap_count = countGaps(me, view_pos_begin);
650 			if (!gap_count)
651 			{//trailing gaps reached: stop function
652 				break;
653 			}
654 			if (gap_count > pos_left)
655 			{
656 				gap_count = pos_left;
657 			}
658 			removeGaps(me, view_pos_begin, gap_count);
659 			pos_left -= gap_count;
660 		}
661 		else
662 		{
663 			++view_pos_begin;
664 			--pos_left;
665 		}
666 	}
667 }
668 
669 //____________________________________________________________________________
670 
671 template <typename TSource, typename TSpec>
672 inline void
673 clearGaps(Gaps<TSource, TSpec> & me)
674 {
675 SEQAN_CHECKPOINT
676 	clearGaps(me, 0, endPosition(me));
677 }
678 
679 //////////////////////////////////////////////////////////////////////////////
680 
681 // copy gaps-information from one Gaps-object range into another object
682 //??? TODO: not tested, not documented
683 
684 template <typename TSource, typename TSpec, typename TPosition1, typename TSourceGaps, typename TPosition2, typename TPosition3>
685 inline void
686 copyGaps(Gaps<TSource, TSpec> & target_gaps,
687 		 TPosition1 target_view_pos_begin,
688 		 TSourceGaps const & source_gaps,
689 		 TPosition2 source_view_pos_begin,
690 		 TPosition3 source_view_pos_end)
691 {
692 SEQAN_CHECKPOINT
693 	TPosition1 target_view_pos_end = target_view_pos_begin + source_view_pos_end - source_view_pos_begin;
694 	clearGaps(target_gaps, target_view_pos_begin, target_view_pos_end);
695 
696 	for (TPosition3 i = source_view_pos_end - source_view_pos_begin; i > 0; --i)
697 	{
698 		if (isGap(source_gaps, source_view_pos_begin))
699 		{
700 			insertGap(target_gaps, target_view_pos_begin);
701 		}
702 
703 		++target_view_pos_begin;
704 		++source_view_pos_begin;
705 	}
706 }
707 
708 
709 //////////////////////////////////////////////////////////////////////////////
710 
711 ///.Function.getValue.param.container.type:Class.Gaps
712 
713 template <typename TSource, typename TSpec, typename TPosition>
714 inline typename GetValue<Gaps<TSource, TSpec> >::Type
715 getValue(Gaps<TSource, TSpec> & me,
716 		 TPosition view_pos)
717 {
718 SEQAN_CHECKPOINT
719 	typedef typename Value<TSource>::Type TValue;
720 	if (isGap(me, view_pos)) return gapValue<TValue>();
721 	else return value(source(me), toSourcePosition(me, view_pos));
722 }
723 template <typename TSource, typename TSpec, typename TPosition>
724 inline typename GetValue<Gaps<TSource, TSpec> >::Type
725 getValue(Gaps<TSource, TSpec> const & me,
726 		 TPosition view_pos)
727 {
728 SEQAN_CHECKPOINT
729 	typedef typename Value<TSource>::Type TValue;
730 	if (isGap(me, view_pos)) return gapValue<TValue>();
731 	else return value(source(me), toSourcePosition(me, view_pos));
732 }
733 
734 //////////////////////////////////////////////////////////////////////////////
735 
736 ///.Function.value.param.container.type:Class.Gaps
737 
738 template <typename TSource, typename TSpec, typename TPosition>
739 inline typename Reference<Gaps<TSource, TSpec> >::Type
740 value(Gaps<TSource, TSpec> & me,
741 	  TPosition view_pos)
742 {
743 SEQAN_CHECKPOINT
744 	typedef typename Reference<Gaps<TSource, TSpec> >::Type TReference;
745 	return TReference(iter(me, view_pos));
746 }
747 template <typename TSource, typename TSpec, typename TPosition>
748 inline typename Reference<Gaps<TSource, TSpec> const>::Type
749 value(Gaps<TSource, TSpec> const & me,
750 	  TPosition view_pos)
751 {
752 SEQAN_CHECKPOINT
753 	typedef typename Reference<Gaps<TSource, TSpec> const>::Type TReference;
754 	return TReference(iter(me, view_pos));
755 }
756 
757 //////////////////////////////////////////////////////////////////////////////
758 //////////////////////////////////////////////////////////////////////////////
759 
760 /**
761 .Function.emptySource:
762 ..summary:Test if there is a source.
763 ..cat:Alignments
764 ..signature:bool emptySource(object)
765 ..param.object:An object that could habe a source.
766 ...type:Class.Gaps
767 ..returns:$true$ if $object$ has a @Function.source@, $false$ otherwise.
768 ..see:Function.source
769 ..see:Metafunction.Source
770 ..include:seqan/align.h
771 */
772 
773 template <typename TSource, typename TSpec>
774 inline bool
775 emptySource(Gaps<TSource, TSpec> & me)
776 {
777 SEQAN_CHECKPOINT
778 	bool ret = empty(_dataSource(me));
779 	return ret;
780 }
781 template <typename TSource, typename TSpec>
782 inline bool
783 emptySource(Gaps<TSource, TSpec> const & me)
784 {
785 SEQAN_CHECKPOINT
786 	bool ret = empty(_dataSource(me));
787 	return ret;
788 }
789 //////////////////////////////////////////////////////////////////////////////
790 
791 /**
792 .Function.dependentSource:
793 ..summary:Test if object depends from it's source.
794 ..cat:Alignments
795 ..signature:bool dependentSource(object)
796 ..param.object:An object that has a source.
797 ...type:Class.Gaps
798 ..returns:$true$ if the source of $object$ is a stand alone object that is
799 not managed by $object$. $false$ otherwise.
800 ..remarks:This function returns $false$, if the @Function.source@ is @Function.emptySource.empty@.
801 ..remarks.text:If both @Function.emptySource@ and @Function.dependentSource@ are false, $object$ is the owner of the source.
802 ..see:Function.source
803 ..see:Metafunction.Source
804 ..see:Function.emptySource
805 ..include:seqan/align.h
806 */
807 template <typename TSource, typename TSpec>
808 inline bool
809 dependentSource(Gaps<TSource, TSpec> & me)
810 {
811 SEQAN_CHECKPOINT
812 	return dependent(_dataSource(me));
813 }
814 template <typename TSource, typename TSpec>
815 inline bool
816 dependentSource(Gaps<TSource, TSpec> const & me)
817 {
818 SEQAN_CHECKPOINT
819 	return dependent(_dataSource(me));
820 }
821 
822 //////////////////////////////////////////////////////////////////////////////
823 
824 /**
825 .Function.setSource:
826 ..summary:Let an external object be the source.
827 ..cat:Alignments
828 ..signature:setSource(object, source)
829 ..signature:setSource(object, source [, begin_pos, end_pos])
830 ..param.object:An object that will get a new source.
831 ...type:Class.Gaps
832 ..param.source:The new source.
833 ...remarks:The source type can be determined by @Metafunction.Source@.
834 ..param.begin_pos:Position of the first item in $source$ that is used in $object$. (optional)
835 ..param.end_pos:Position behind the last item in $source$ that is used in $object$. (optional)
836 ..remarks:After this function, $object$ @Function.dependentSource.depends@ from $source$,
837 and $source$ is the new source of $object$.
838 ...text:If no $begin_pos$ and $end_pos$ are specified, the whole $source$ will be used.
839 ..see:Function.source
840 ..see:Function.dependentSource
841 ..see:Metafunction.Source
842 ..include:seqan/align.h
843 */
844 template <typename TSource, typename TSpec, typename TPosition1, typename TPosition2>
845 inline void
846 setSource(Gaps<TSource, TSpec> & me,
847 		  TSource & source_,
848 		  TPosition1 clipped_begin_pos,
849 		  TPosition2 clipped_end_pos)
850 {
851 SEQAN_CHECKPOINT
852 	setValue(_dataSource(me), source_);
853 	_setClippedBeginPosition(me, clipped_begin_pos);
854 	_setClippedEndPosition(me, clipped_end_pos);
855 	clearGaps(me);
856 }
857 
858 //____________________________________________________________________________
859 
860 template <typename TSource, typename TSpec>
861 inline void
862 setSource(Gaps<TSource, TSpec> & me,
863 		  TSource & source_)
864 {
865 SEQAN_CHECKPOINT
866 	setSource(me, source_, 0, length(source_));
867 }
868 
869 //??? Variante mit zusaetzlich source_begin und source_end
870 
871 //////////////////////////////////////////////////////////////////////////////
872 
873 /**
874 .Function.createSource:
875 ..summary:Creates a new source.
876 ..cat:Alignments
877 ..signature:createSource(object)
878 ..param.object:An object that will get a new source.
879 ...type:Class.Gaps
880 ..remarks:
881 If $object$ has no @Function.source@, a new one is created.
882 If $object$ is already the owner of the source, nothing happens.
883 If $object$ has an external source, this source is copied.
884 $object$ is thereupon the owner of the source.
885 ..see:Function.source
886 ..see:Function.dependentSource
887 ..see:Metafunction.Source
888 ..include:seqan/align.h
889 */
890 template <typename TSource, typename TSpec>
891 inline void
892 createSource(Gaps<TSource, TSpec> & me)
893 {
894 SEQAN_CHECKPOINT
895 	create(_dataSource(me));
896 }
897 
898 //////////////////////////////////////////////////////////////////////////////
899 
900 /**
901 .Function.detach:
902 ..cat:Alignments
903 ..param.object.type:Class.Gaps
904 ..include:seqan/align.h
905 */
906 template <typename TSource, typename TSpec>
907 inline void
908 detach(Gaps<TSource, TSpec> & me)
909 {
910 SEQAN_CHECKPOINT
911 	createSource(me);
912 }
913 
914 //////////////////////////////////////////////////////////////////////////////
915 
916 /**
917 .Function.source:
918 ..summary:The source of an object.
919 ..cat:Alignments
920 ..signature:source(object)
921 ..param.object:An object.
922 ...type:Class.Gaps
923 ..returns:The source of $object$.
924 ...type:Metafunction.Source
925 ..remarks:The source of a @Class.Gaps@ instance is the underlying sequence without gaps.
926 ..see:Metafunction.Source
927 ..include:seqan/align.h
928 */
929 template <typename TSource, typename TSpec>
930 inline TSource &
931 source(Gaps<TSource, TSpec> & me)
932 {
933 SEQAN_CHECKPOINT
934 	return value(_dataSource(me));
935 }
936 template <typename TSource, typename TSpec>
937 inline TSource &
938 source(Gaps<TSource, TSpec> const & me)
939 {
940 SEQAN_CHECKPOINT
941 	return value(_dataSource(me));
942 }
943 
944 //////////////////////////////////////////////////////////////////////////////
945 
946 /**
947 .Function.sourceSegment:
948 ..summary:The used part of the source.
949 ..cat:Alignments
950 ..signature:sourceSegment(object)
951 ..param.object:An object.
952 ...type:Class.Gaps
953 ..returns:The part of the @Function.source@ that is actually used by $object$.
954 ...type:Class.Segment
955 ..remarks:The source of a @Class.Gaps@ instance is the underlying sequence without gaps.
956 $sourceSegment$ is useful since @Class.Gaps@ can be limited to work on a subsequence of the source.
957 ..see:Metafunction.Source
958 ..see:Function.source
959 ..include:seqan/align.h
960 */
961 template <typename TSource, typename TSpec>
962 inline typename Infix<TSource>::Type
963 sourceSegment(Gaps<TSource, TSpec> & me)
964 {
965 SEQAN_CHECKPOINT
966 	return infix(source(me), clippedBeginPosition(me), clippedEndPosition(me));
967 }
968 
969 template <typename TSource, typename TSpec>
970 inline typename Infix<TSource>::Type
971 sourceSegment(Gaps<TSource, TSpec> const & me)
972 {
973 SEQAN_CHECKPOINT
974 	return infix(source(me), clippedBeginPosition(me), clippedEndPosition(me));
975 }
976 
977 //////////////////////////////////////////////////////////////////////////////
978 
979 /**
980 .Function.sourceLength:
981 ..summary:Length of the source.
982 ..cat:Alignments
983 ..signature:Size sourceLength(gaps)
984 ..param.gaps:A gaps object.
985 ...type:Class.Gaps
986 ..returns:Length of the used part of the source.
987 ...metafunction:Metafunction.Size
988 ..remarks:This function is equivalent to $clippedEndPosition(gaps) - clippedBeginPosition(gaps)$.
989 ..include:seqan/align.h
990 */
991 //..see:Function.clippedEndPosition
992 //..see:Function.clippedBeginPosition
993 template <typename TSource, typename TSpec>
994 inline typename Size<TSource>::Type
995 sourceLength(Gaps<TSource, TSpec> & me)
996 {
997 SEQAN_CHECKPOINT
998 	return clippedEndPosition(me) - clippedBeginPosition(me);
999 }
1000 template <typename TSource, typename TSpec>
1001 inline typename Size<TSource>::Type
1002 sourceLength(Gaps<TSource, TSpec> const & me)
1003 {
1004 SEQAN_CHECKPOINT
1005 	return clippedEndPosition(me) - clippedBeginPosition(me);
1006 }
1007 
1008 //////////////////////////////////////////////////////////////////////////////
1009 
1010 /**
1011 .Function.assignSource:
1012 ..summary:Assigns the source to a new value.
1013 ..cat:Alignments
1014 ..signature:assignSource(object, source_in)
1015 ..param.object:An object.
1016 ...type:Class.Gaps
1017 ..param.source_in:An object that is assigned to the source of $object$.
1018 ..remarks:
1019 ...note:$source_in$ is not the new @Function.source@ of $object$, but $source_in$ is assigned (copied) to @Function.source.source(object)@.
1020 That means that the current source of $object$ is modified by this function.
1021 If you want $object$ to drop its current source and take another object as source, use @Function.setSource@ instead.
1022 ...text:If no $begin_pos$ and $end_pos$ are specified, the whole source will be used.
1023 ...text:This function does not change whether $object$ is @Function.dependentSource.dependent@ or not.
1024 ...text:The source of $object$ must not be @Function.emptySource.empty@ for executing this function.
1025 ..see:Metafunction.Source
1026 ..see:Function.source
1027 ..see:Function.setSource
1028 ..see:Function.emptySource
1029 ..see:Function.dependentSource
1030 ..see:Function.assign
1031 ..include:seqan/align.h
1032 */
1033 
1034 //____________________________________________________________________________
1035 
1036 template <typename TSource, typename TSpec, typename TSource2>
1037 inline void
1038 assignSource(Gaps<TSource, TSpec> & me,
1039 			 TSource2 const & source_)
1040 {
1041 SEQAN_CHECKPOINT
1042 	assignValue(me.data_source, source_);
1043 	_setClippedBeginPosition(me, 0);
1044 	_setClippedEndPosition(me, length(source_));
1045 	clearGaps(me);
1046 }
1047 
1048 
1049 //////////////////////////////////////////////////////////////////////////////
1050 
1051 /**
1052 .Function.moveSource:
1053 ..summary:Moves the source to a new value.
1054 ..cat:Alignments
1055 ..signature:moveSource(object, source_in [, begin_pos, end_pos])
1056 ..param.object:An object.
1057 ...type:Class.Gaps
1058 ..param.source_in:An object that is moved to the source of $object$.
1059 ..param.begin_pos:Position of the first item in the source that is used in $object$. (optional)
1060 ..param.end_pos:Position behind the last item in the source that is used in $object$. (optional)
1061 ..remarks:
1062 ...note:$source_in$ is not the new @Function.source@ of $object$, but $source_in$ is moved into @Function.source.source(object)@.
1063 "Moved" means that $source_in$ is assigned to $source(object)$ with the possibility that $source_in$ looses its content.
1064 That means that the current source of $object$ is modified by this function.
1065 If you want $object$ to drop its current source and take another object as source, use @Function.setSource@ instead.
1066 If you want $source_in$ not to become empty, use @Function.assignSource@ instead.
1067 ...text:If no $begin_pos$ and $end_pos$ are specified, the whole source will be used.
1068 ...text:This function does not change whether $object$ is @Function.dependentSource.dependent@ or not.
1069 ...text:The source of $object$ must not be @Function.emptySource.empty@ for executing this function.
1070 ..see:Metafunction.Source
1071 ..see:Function.source
1072 ..see:Function.setSource
1073 ..see:Function.emptySource
1074 ..see:Function.dependentSource
1075 ..see:Function.move
1076 ..see:Function.assignSource
1077 ..include:seqan/align.h
1078 */
1079 template <typename TSource, typename TSpec, typename TSource2, typename TPosition1, typename TPosition2>
1080 inline void
1081 moveSource(Gaps<TSource, TSpec> & me,
1082 		   TSource2 const & source_,
1083 		   TPosition1 clipped_begin_pos,
1084 		   TPosition2 clipped_end_pos)
1085 {
1086 SEQAN_CHECKPOINT
1087 	moveValue(_dataSource(me), source_);
1088 	_setClippedBeginPosition(me, clipped_begin_pos);
1089 	_setClippedEndPosition(me, clipped_end_pos);
1090 	clearGaps(me);
1091 }
1092 
1093 //____________________________________________________________________________
1094 
1095 template <typename TSource, typename TSpec, typename TSource2>
1096 inline void
1097 moveSource(Gaps<TSource, TSpec> & me,
1098 		   TSource2 const & source_)
1099 {
1100 SEQAN_CHECKPOINT
1101 	moveSource(me, source_, 0, length(source_));
1102 }
1103 
1104 
1105 
1106 //////////////////////////////////////////////////////////////////////////////
1107 
1108 template <typename TFile, typename TSource, typename TIDString, typename TSpec>
1109 inline void
1110 write(TFile & target,
1111 	  Gaps<TSource, TSpec> const & source,
1112 	  TIDString const &,
1113 	  Raw)
1114 {
1115 SEQAN_CHECKPOINT
1116 //	_streamWriteRange(target, begin(source), end(source));
1117 
1118 	// Print gaps row
1119 	typedef typename Iterator<Gaps<TSource, TSpec> const>::Type TIter;
1120 	TIter begin_ = begin(source);
1121 	TIter end_ = end(source);
1122 	for (; begin_ != end_; ++begin_) {
1123 		if (isGap(begin_))
1124 			_streamPut(target, gapValue<char>());
1125 		else
1126 			_streamPut(target, *begin_);
1127 	}
1128 }
1129 
1130 //////////////////////////////////////////////////////////////////////////////
1131 // stream operators
1132 //////////////////////////////////////////////////////////////////////////////
1133 
1134 template <typename TStream, typename TSource, typename TSpec>
1135 inline TStream &
1136 operator << (TStream & target,
1137 			 Gaps<TSource, TSpec> const & source)
1138 {
1139 SEQAN_CHECKPOINT
1140 	write(target, source);
1141 	return target;
1142 }
1143 
1144 //////////////////////////////////////////////////////////////////////////////
1145 /*
1146 template <typename TStream, typename TSource, typename TSpec>
1147 inline TStream &
1148 operator >> (TStream & source,
1149 			 Gaps<TSource, TSpec> & target)
1150 {
1151 SEQAN_CHECKPOINT
1152 	read(source, target);
1153 	return source;
1154 }
1155 */
1156 //////////////////////////////////////////////////////////////////////////////
1157 // Comparison Operators
1158 //////////////////////////////////////////////////////////////////////////////
1159 
1160 template <typename TLeftSource, typename TLeftSpec, typename TRightSource, typename TRightSpec >
1161 inline bool
1162 operator == (Gaps<TLeftSource, TLeftSpec> const & left,
1163 			 Gaps<TRightSource, TRightSpec> const & right)
1164 {
1165 SEQAN_CHECKPOINT
1166 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1167     return isEqual(_lex);
1168 }
1169 template <typename TLeftSource, typename TLeftSpec, typename TRight >
1170 inline bool
1171 operator == (Gaps<TLeftSource, TLeftSpec> const & left,
1172 			 TRight const & right)
1173 {
1174 SEQAN_CHECKPOINT
1175 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1176     return isEqual(_lex);
1177 }
1178 template <typename TLeft, typename TRightSource, typename TRightSpec >
1179 inline bool
1180 operator == (TLeft const & left,
1181 			 Gaps<TRightSource, TRightSpec> const & right)
1182 {
1183 SEQAN_CHECKPOINT
1184 	typename Comparator<Gaps<TRightSource, TRightSpec> >::Type _lex(left, right);
1185     return isEqual(_lex);
1186 }
1187 
1188 //////////////////////////////////////////////////////////////////////////////
1189 
1190 template <typename TLeftSource, typename TLeftSpec, typename TRightSource, typename TRightSpec >
1191 inline bool
1192 operator != (Gaps<TLeftSource, TLeftSpec> const & left,
1193 			 Gaps<TRightSource, TRightSpec> const & right)
1194 {
1195 SEQAN_CHECKPOINT
1196 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1197     return isNotEqual(_lex);
1198 }
1199 template <typename TLeftSource, typename TLeftSpec, typename TRight >
1200 inline bool
1201 operator !=(Gaps<TLeftSource, TLeftSpec> const & left,
1202 			TRight const & right)
1203 {
1204 SEQAN_CHECKPOINT
1205 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1206     return isNotEqual(_lex);
1207 }
1208 template <typename TLeft, typename TRightSource, typename TRightSpec >
1209 inline bool
1210 operator != (TLeft const & left,
1211 			 Gaps<TRightSource, TRightSpec> const & right)
1212 {
1213 SEQAN_CHECKPOINT
1214 	typename Comparator<Gaps<TRightSource, TRightSpec> >::Type _lex(left, right);
1215     return isNotEqual(_lex);
1216 }
1217 //////////////////////////////////////////////////////////////////////////////
1218 
1219 template <typename TLeftSource, typename TLeftSpec, typename TRightSource, typename TRightSpec >
1220 inline bool
1221 operator < (Gaps<TLeftSource, TLeftSpec> const & left,
1222 			 Gaps<TRightSource, TRightSpec> const & right)
1223 {
1224 SEQAN_CHECKPOINT
1225 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1226     return isLess(_lex);
1227 }
1228 template <typename TLeftSource, typename TLeftSpec, typename TRight>
1229 inline bool
1230 operator < (Gaps<TLeftSource, TLeftSpec> const & left,
1231 			TRight const & right)
1232 {
1233 SEQAN_CHECKPOINT
1234 	return isLess(left, right, typename DefaultPrefixOrder<Gaps<TLeftSource, TLeftSpec> >::Type());
1235 }
1236 template <typename TLeft, typename TRightSource, typename TRightSpec >
1237 inline bool
1238 operator < (TLeft const & left,
1239 			 Gaps<TRightSource, TRightSpec> const & right)
1240 {
1241 SEQAN_CHECKPOINT
1242 	typename Comparator<Gaps<TRightSource, TRightSpec> >::Type _lex(left, right);
1243     return isLess(_lex);
1244 }
1245 
1246 //////////////////////////////////////////////////////////////////////////////
1247 
1248 template <typename TLeftSource, typename TLeftSpec, typename TRightSource, typename TRightSpec >
1249 inline bool
1250 operator <= (Gaps<TLeftSource, TLeftSpec> const & left,
1251 			 Gaps<TRightSource, TRightSpec> const & right)
1252 {
1253 SEQAN_CHECKPOINT
1254 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1255     return isLessOrEqual(_lex);
1256 }
1257 template <typename TLeftSource, typename TLeftSpec, typename TRight>
1258 inline bool
1259 operator <= (Gaps<TLeftSource, TLeftSpec> const & left,
1260 			 TRight const & right)
1261 {
1262 SEQAN_CHECKPOINT
1263 	return isLessOrEqual(left, right, typename DefaultPrefixOrder<Gaps<TLeftSource, TLeftSpec> >::Type());
1264 }
1265 template <typename TLeft, typename TRightSource, typename TRightSpec >
1266 inline bool
1267 operator <= (TLeft const & left,
1268 			 Gaps<TRightSource, TRightSpec> const & right)
1269 {
1270 SEQAN_CHECKPOINT
1271 	typename Comparator<Gaps<TRightSource, TRightSpec> >::Type _lex(left, right);
1272     return isLessOrEqual(_lex);
1273 }
1274 //////////////////////////////////////////////////////////////////////////////
1275 
1276 template <typename TLeftSource, typename TLeftSpec, typename TRightSource, typename TRightSpec >
1277 inline bool
1278 operator > (Gaps<TLeftSource, TLeftSpec> const & left,
1279 			 Gaps<TRightSource, TRightSpec> const & right)
1280 {
1281 SEQAN_CHECKPOINT
1282 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1283     return isGreater(_lex);
1284 }
1285 template <typename TLeftSource, typename TLeftSpec, typename TRight>
1286 inline bool
1287 operator > (Gaps<TLeftSource, TLeftSpec> const & left,
1288 		TRight const & right)
1289 {
1290 SEQAN_CHECKPOINT
1291 	return isGreater(left, right, typename DefaultPrefixOrder<Gaps<TLeftSource, TLeftSpec> >::Type());
1292 }
1293 template <typename TLeft, typename TRightSource, typename TRightSpec >
1294 inline bool
1295 operator > (TLeft const & left,
1296 			 Gaps<TRightSource, TRightSpec> const & right)
1297 {
1298 SEQAN_CHECKPOINT
1299 	typename Comparator<Gaps<TRightSource, TRightSpec> >::Type _lex(left, right);
1300     return isGreater(_lex);
1301 }
1302 //////////////////////////////////////////////////////////////////////////////
1303 
1304 template <typename TLeftSource, typename TLeftSpec, typename TRightSource, typename TRightSpec >
1305 inline bool
1306 operator >= (Gaps<TLeftSource, TLeftSpec> const & left,
1307 			 Gaps<TRightSource, TRightSpec> const & right)
1308 {
1309 SEQAN_CHECKPOINT
1310 	typename Comparator<Gaps<TLeftSource, TLeftSpec> >::Type _lex(left, right);
1311     return isGreaterOrEqual(_lex);
1312 }
1313 template <typename TLeftSource, typename TLeftSpec, typename TRight>
1314 inline bool
1315 operator >= (Gaps<TLeftSource, TLeftSpec> const & left,
1316 		TRight const & right)
1317 {
1318 SEQAN_CHECKPOINT
1319 	return isGreaterOrEqual(left, right, typename DefaultPrefixOrder<Gaps<TLeftSource, TLeftSpec> >::Type());
1320 }
1321 template <typename TLeft, typename TRightSource, typename TRightSpec >
1322 inline bool
1323 operator >= (TLeft const & left,
1324 			 Gaps<TRightSource, TRightSpec> const & right)
1325 {
1326 SEQAN_CHECKPOINT
1327 	typename Comparator<Gaps<TRightSource, TRightSpec> >::Type _lex(left, right);
1328     return isGreaterOrEqual(_lex);
1329 }
1330 
1331 //////////////////////////////////////////////////////////////////////////////
1332 
1333 }// namespace SEQAN_NAMESPACE_MAIN
1334 
1335 #endif //#ifndef SEQAN_HEADER_...
1336