1 // ==========================================================================
2 //                 SeqAn - The Library for Sequence Analysis
3 // ==========================================================================
4 // Copyright (c) 2006-2015, 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: Rene Rahn <rene.rahn@fu-berlin.de>
33 // ==========================================================================
34 // The global interfaces to call to compute the banded chain alignment
35 // algorithm.
36 // ==========================================================================
37 
38 #ifndef INCLUDE_SEQAN_SEEDS_BANDED_CHAIN_ALIGNMENT_H_
39 #define INCLUDE_SEQAN_SEEDS_BANDED_CHAIN_ALIGNMENT_H_
40 
41 namespace seqan {
42 
43 // ============================================================================
44 // Forwards
45 // ============================================================================
46 
47 // ============================================================================
48 // Tags, Classes, Enums
49 // ============================================================================
50 
51 // ============================================================================
52 // Metafunctions
53 // ============================================================================
54 
55 // ============================================================================
56 // Functions
57 // ============================================================================
58 
59 /*!
60  * @fn bandedChainAlignment
61  * @headerfile <seqan/seeds.h>
62  * @brief Computes the best global pairwise alignment between two sequences given a non-empty seed chain.
63  *
64  * @signature TValue bandedChainAlignment(align,          seedChain, scoringScheme1[, scoringScheme2] [, alignConfig] [, k]);
65  * @signature TValue bandedChainAlignment(gapsH, gapsV,   seedChain, scoringScheme1[, scoringScheme2] [, alignConfig] [, k]);
66  * @signature TValue bandedChainAlignment(frags, strings, seedChain, scoringScheme1[, scoringScheme2] [, alignConfig] [, k]);
67  * @signature TValue bandedChainAlignment(alignmentGraph, seedChain, scoringScheme1[, scoringScheme2] [, alignConfig] [, k]);
68  *
69  * @param[in,out] align   An @link Align @endlink object that stores the alignment. The number of rows must be 2 and the
70  *                        sequences must have already been set.  <tt>row(align, 0)</tt> is the horizontal sequence in the
71  *                        alignment matrix, <tt>row(align, 1)</tt> is the vertical sequence.
72  * @param[in,out] gapsH   Horizontal gapped sequence in alignment matrix. Type: @link Gaps @endlink.
73  * @param[in,out] gapsV   Vertical gapped sequence in alignment matrix. Type: @link Gaps @endlink.
74  * @param[out]    frags   @link String @endlink of @link Fragment @endlink objects.  The sequence with id <tt>0</tt>
75  *                        is the horizontal one, the sequence with id <tt>1</tt> is the vertical one.
76  * @param[in]     strings A @link StringSet @endlink containing two sequences.
77  * @param[in,out] alignmentGraph
78  *                       @link AlignmentGraph @endlink object to store the alignment in.  The underlying @link
79  *                       StringSet @endlink must be an @link DependentStringSet @endlink. Types: AlignmentGraph.
80  * @param[in] seedChain  The container holding the @link Seed seeds @endlink.  Note that the @link Seed seeds @endlink
81  *                       have to be in montonic non-decreasing order and the container has to implement a forward-iterator.
82  *                       Type: @link SeedSet @endlink.
83  * @param[in] scoringScheme1
84  *                       The scoring scheme used for the alignment. If <tt>scoringScheme2</tt> is specified, then
85  *                       <tt>scoringScheme1</tt> is used for the regions around the seeds and <tt>scoringScheme2</tt>
86  *                       for the gap regions between two consecutive seeds.  Types: Score
87  * @param[in] scoringScheme2
88  *                       The optional scoring scheme for the gap regions between two anchors. Types: Score
89  * @param[in] k          Optional extension of the band around the seeds.  At the moment only band extensions greater
90  *                       or equal <tt>1</tt> are allowed. Type: nolink:<tt>int</tt>. Default: 15.
91  * @param[in] alignConfig
92  *                       The @link AlignConfig @endlink to use for the alignment.
93  *
94  * @return TValue An integer with the alignment score, as given by the @link Score#Value @endlink metafunction of the
95  *                @link Score @endlink type.  If the seed chain is empty then the @link OrderedAlphabetConcept#MinValue
96  *                smallest value of the score type @endlink is used to return the minimal value of the selected score
97  *                type and no alignment is computed.
98  *
99  * There exist multiple overloads for this function with four configuration dimensions.
100  *
101  * First, you can select whether begin and end gaps are free in either sequence using <tt>alignConfig</tt>.
102  *
103  * Second, you can select the type of the target storing the alignment. This can be either an @link Align @endlink
104  * object, two @link Gaps @endlink objects, a @link AlignmentGraph @endlink, or a string of @link Fragment @endlink
105  * objects. @link Align @endlink objects provide an interface to tabular alignments with the restriction of all rows
106  * having the same type. Using two @link Gaps @endlink objects has the advantage that you can align sequences with
107  * different types, for example @link DnaString @endlink and @link Dna5String @endlink. @link AlignmentGraph Alignment
108  * Graphs @endlink provide a graph-based representation of segment-based colinear alignments. Using @link Fragment
109  * @endlink strings is useful for collecting many pairwise alignments, for example in the construction of @link
110  * AlignmentGraph Alignment Graphs @endlink for multiple-sequence alignments (MSA).
111  *
112  * Third, you can optionally give a second scoring scheme to fill the gaps between two consecutive seeds. Note that
113  * based on the specified scores either an affine or linear gap cost function is used. This only depends on whether for
114  * one of the scoring schemes the scores for gap opening and gap extension differ or not. If only one scoring scheme is
115  * defined the complete region is computed with the same scoring scheme.
116  *
117  * Fourth, you can optinally select a proper band extension for the bands around the seeds.  At the moment only band
118  * extensions of at least <tt>1</tt> are allowed.  The default value is <tt>15</tt> and is based on the default values
119  * for the LAGAN-algorithm described by Brudno et al., 2003.
120  *
121  * The examples below show some common use cases.
122  *
123  * @section Examples
124  *
125  * Banded chain alignment of two sequences using an @link Align @endlink object and using only one scoring scheme and no
126  * free end-gaps.
127  *
128  * @code{.cpp}
129  * Dna5String seqH = "CGAATCCATCCCACACA";
130  * Dna5String seqV = "GGCGATNNNCATGGCACA";
131  *
132  * String<Seed<Simple> > seedChain;
133  * appendValue(seedChain, Seed<Simple>(2, 0, 6, 5));
134  * appendValue(seedChain, Seed<Simple>(9, 6, 12, 9));
135  * appendValue(seedChain, Seed<Simple>(14, 11, 16, 17));
136  *
137  * Align<Dna5String, ArrayGaps> alignment;
138  * resize(rows(alignment), 2);
139  * assignSource(row(alignment, 0), seqH);
140  * assignSource(row(alignment, 1), seqV);
141  *
142  * Score<int, Simple> scoringScheme(2, -1, -2);
143  *
144  * int result = bandedChainAlignment(alignment, seedChain, scoringScheme, 2);
145  * @endcode
146  *
147  * Banded chain alignment of two sequences using two @link Gaps @endlink objects, an unordered seed set to hold the
148  * seeds, two different scoring schemes for the gaps between the seeds and the seeds and free end-gaps.
149  *
150  * @code{.cpp}
151  * DnaString seqH = "CGAATCCATCCCACACA";
152  * Dna5String seqV = "GGCGATNNNCATGGCACA";
153  *
154  * SeedSet<Simple, Unordered> seedChain;
155  * addSeed(seedChain, Seed<Simple>(2, 0, 6, 5), Single());
156  * addSeed(seedChain, Seed<Simple>(9, 6, 12, 9), Single());
157  * addSeed(seedChain, Seed<Simple>(14, 11, 16, 17), Single());
158  *
159  * Gaps<DnaString, ArrayGaps> gapsH(seqH);
160  * Gaps<Dna5String, AnchorGaps<> > gapsV(seqV);
161  *
162  * Score<int, Simple> scoringSchemeSeed(2, -1, -2);
163  * Score<int, Simple> scoringSchemeGap(5, -3, -1, -5);
164  * AlignConfig<true, true, true, true> alignConfig;
165  *
166  * int result = globalAlignment(gapsH, gapsV, scoringSchemeSeed, scoringSchemeGap, alignConfig, 2);
167  * @endcode
168  *
169  * @section Tutorial
170  *
171  * Also see the <a href="http://seqan.readthedocs.org/en/develop/Tutorial/SeedAndExtend.html">Seed-and-Extend Tutorial</a>
172  *
173  * @section Reference
174  *
175  * <ul>
176  *   <li>Brudno M, Do CB, Cooper GM, et al.: LAGAN and Multi-LAGAN: Efficient Tools for Large-Scale Multiple Alignment
177  *       of Genomic DNA. Genome Research 2003, 13: 721-731.</li>
178  * </ul>
179  */
180 
181 // ----------------------------------------------------------------------------
182 // Function bandedChainAlignment()                                      [Align]
183 // ----------------------------------------------------------------------------
184 
185 template <typename TSequence, typename TAlignSpec, typename TSeeds, typename TScoreValue, typename TScoreSpecAnchor,
186           typename TScoreSpecGap, bool TFirstRow, bool TFirstColumn, bool TLastColumn, bool TLastRow, typename TACSpec>
187 inline TScoreValue
188 bandedChainAlignment(Align<TSequence, TAlignSpec> & align,
189                      TSeeds const & seedSet,
190                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchor,
191                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGap,
192                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
193                      unsigned bandExtension = 15)
194 {
195     typedef typename Position<TSequence>::Type TPosition;
196     typedef typename Size<TSequence>::Type TSize;
197     typedef StringSet<String<TraceSegment_<TPosition, TSize> > > TTraceSegmentSet;
198 
199     TTraceSegmentSet traceSet;
200     TScoreValue score =
201         _setupAndRunBandedChainAlignment(traceSet, seedSet, source(row(align, 0)), source(row(align, 1)),
202                                          scoreSchemeAnchor, scoreSchemeGap, alignConfig, bandExtension, GapsLeft());
203 
204     if (empty(traceSet))
205         return score;
206 
207     _adaptTraceSegmentsTo(row(align,0), row(align,1), value(traceSet, 0));
208     return score;
209 }
210 
211 // With only one scoring scheme.
212 template <typename TSequence, typename TAlignSpec, typename TSeeds, typename TScoreValue, typename TScoreSpec,
213           bool TFirstRow, bool TFirstColumn, bool TLastColumn, bool TLastRow, typename TACSpec>
214 inline TScoreValue
215 bandedChainAlignment(Align<TSequence, TAlignSpec> & align,
216                      TSeeds const & seedSet,
217                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
218                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
219                      unsigned bandExtension = 15)
220 {
221     return bandedChainAlignment(align, seedSet, scoreScheme, scoreScheme, alignConfig, bandExtension);
222 }
223 
224 // Without AlignConfig.
225 template <typename TSequence, typename TAlignSpec, typename TSeeds, typename TScoreValue, typename TScoreSpecAnchor,
226           typename TScoreSpecGap>
227 inline TScoreValue
228 bandedChainAlignment(Align<TSequence, TAlignSpec> & align,
229                      TSeeds const & seedSet,
230                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchor,
231                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGap,
232                      unsigned bandExtension = 15)
233 {
234     return bandedChainAlignment(align, seedSet, scoreSchemeAnchor, scoreSchemeGap, AlignConfig<>(), bandExtension);
235 }
236 
237 // Without AlignConfig and with only one scoring scheme.
238 template <typename TSequence, typename TAlignSpec, typename TSeeds, typename TScoreValue, typename TScoreSpec>
239 inline TScoreValue
240 bandedChainAlignment(Align<TSequence, TAlignSpec> & align,
241                      TSeeds const & seedSet,
242                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
243                      unsigned bandExtension = 15)
244 {
245     return bandedChainAlignment(align, seedSet, scoreScheme, scoreScheme, AlignConfig<>(), bandExtension);
246 }
247 
248 // ----------------------------------------------------------------------------
249 // Function bandedChainAlignment()                                       [Gaps]
250 // ----------------------------------------------------------------------------
251 
252 template <typename TSequenceH, typename TGapSpecH, typename TSequenceV, typename TGapSpecV, typename TSeeds,
253           typename TScoreValue, typename TScoreSpecAnchor, typename TScoreSpecGap, bool TFirstRow, bool TFirstColumn,
254           bool TLastColumn, bool TLastRow, typename TACSpec>
255 inline TScoreValue
256 bandedChainAlignment(Gaps<TSequenceH, TGapSpecH> & gapsHorizontal,
257                      Gaps<TSequenceV, TGapSpecV> & gapsVertical,
258                      TSeeds const & seedSet,
259                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchors,
260                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGaps,
261                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
262                      unsigned bandExtension = 15)
263 {
264     typedef typename Position<TSequenceH>::Type TPosition;
265     typedef typename Size<TSequenceH>::Type TSize;
266     typedef StringSet<String<TraceSegment_<TPosition, TSize> > > TTraceSegmentSet;
267 
268     TTraceSegmentSet traceSet;
269     TScoreValue score =
270         _setupAndRunBandedChainAlignment(traceSet, seedSet, source(gapsHorizontal), source(gapsVertical),
271                                          scoreSchemeAnchors, scoreSchemeGaps, alignConfig, bandExtension, GapsLeft());
272 
273     if (empty(traceSet))
274         return score;
275 
276     _adaptTraceSegmentsTo(gapsHorizontal, gapsVertical, value(traceSet, 0));
277     return score;
278 }
279 
280 // With only one scoring scheme.
281 template <typename TSequenceH, typename TGapSpecH, typename TSequenceV, typename TGapSpecV, typename TSeeds,
282           typename TScoreValue, typename TScoreSpec, bool TFirstRow, bool TFirstColumn, bool TLastColumn, bool TLastRow,
283           typename TACSpec>
284 inline TScoreValue
285 bandedChainAlignment(Gaps<TSequenceH, TGapSpecH> & gapsHorizontal,
286                      Gaps<TSequenceV, TGapSpecV> & gapsVertical,
287                      TSeeds const & seedSet,
288                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
289                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
290                      unsigned bandExtension = 15)
291 {
292     return bandedChainAlignment(gapsHorizontal, gapsVertical, seedSet, scoreScheme, scoreScheme, alignConfig,
293                                 bandExtension);
294 }
295 
296 // Without AlignConfig.
297 template <typename TSequenceH, typename TGapSpecH, typename TSequenceV, typename TGapSpecV, typename TSeeds,
298           typename TScoreValue, typename TScoreSpecAnchor, typename TScoreSpecGap>
299 inline TScoreValue
300 bandedChainAlignment(Gaps<TSequenceH, TGapSpecH> & gapsHorizontal,
301                      Gaps<TSequenceV, TGapSpecV> & gapsVertical,
302                      TSeeds const & seedSet,
303                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchor,
304                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGap,
305                      unsigned bandExtension = 15)
306 {
307     return bandedChainAlignment(gapsHorizontal, gapsVertical, seedSet, scoreSchemeAnchor, scoreSchemeGap,
308                                 AlignConfig<>(), bandExtension);
309 }
310 
311 // Without AlignConfig and with only one scoring scheme.
312 template <typename TSequenceH, typename TGapSpecH, typename TSequenceV, typename TGapSpecV, typename TSeeds,
313           typename TScoreValue, typename TScoreSpec>
314 inline TScoreValue
315 bandedChainAlignment(Gaps<TSequenceH, TGapSpecH> & gapsHorizontal,
316                      Gaps<TSequenceV, TGapSpecV> & gapsVertical,
317                      TSeeds const & seedSet,
318                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
319                      unsigned bandExtension = 15)
320 {
321     return bandedChainAlignment(gapsHorizontal, gapsVertical, seedSet, scoreScheme, scoreScheme, AlignConfig<>(),
322                                 bandExtension);
323 }
324 
325 // ----------------------------------------------------------------------------
326 // Function bandedChainAlignment()                        [Graph<Alignment<> >]
327 // ----------------------------------------------------------------------------
328 
329 template <typename TStringSet, typename TCargo, typename TGraphSpec, typename TSeeds, typename TScoreValue,
330           typename TScoreSpecAnchor, typename TScoreSpecGap, bool TFirstRow, bool TFirstColumn, bool TLastColumn,
331           bool TLastRow, typename TACSpec>
332 inline TScoreValue
333 bandedChainAlignment(Graph<Alignment<TStringSet, TCargo, TGraphSpec> > & alignmentGraph,
334                      TSeeds const & seedSet,
335                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchors,
336                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGaps,
337                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
338                      unsigned bandExtension = 15)
339 {
340     typedef typename Position<TStringSet>::Type TPosition;
341     typedef typename Size<TStringSet>::Type TSize;
342     typedef StringSet<String<TraceSegment_<TPosition, TSize> > > TTraceSegmentSet;
343 
344     TTraceSegmentSet traceSet;
345     TScoreValue score =
346         _setupAndRunBandedChainAlignment(traceSet, seedSet, value(stringSet(alignmentGraph), 0),
347                                          value(stringSet(alignmentGraph), 1), scoreSchemeAnchors, scoreSchemeGaps,
348                                          alignConfig, bandExtension, GapsLeft());
349 
350     if (empty(traceSet))
351         return score;
352 
353     _adaptTraceSegmentsTo(alignmentGraph, positionToId(stringSet(alignmentGraph), 0),
354                           positionToId(stringSet(alignmentGraph), 1), value(traceSet, 0));
355     return score;
356 }
357 
358 // With only one scoring scheme.
359 template <typename TStringSet, typename TCargo, typename TGraphSpec, typename TSeeds, typename TScoreValue,
360           typename TScoreSpec, bool TFirstRow, bool TFirstColumn, bool TLastColumn,
361           bool TLastRow, typename TACSpec>
362 inline TScoreValue
363 bandedChainAlignment(Graph<Alignment<TStringSet, TCargo, TGraphSpec> > & alignmentGraph,
364                      TSeeds const & seedSet,
365                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
366                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
367                      unsigned bandExtension = 15)
368 {
369     return bandedChainAlignment(alignmentGraph, seedSet, scoreScheme, scoreScheme, alignConfig, bandExtension);
370 }
371 
372 // Without AlignConfig.
373 template <typename TStringSet, typename TCargo, typename TGraphSpec, typename TSeeds, typename TScoreValue,
374           typename TScoreSpecAnchor, typename TScoreSpecGap>
375 inline TScoreValue
376 bandedChainAlignment(Graph<Alignment<TStringSet, TCargo, TGraphSpec> > & alignmentGraph,
377                      TSeeds const & seedSet,
378                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchor,
379                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGap,
380                      unsigned bandExtension = 15)
381 {
382     return bandedChainAlignment(alignmentGraph, seedSet, scoreSchemeAnchor, scoreSchemeGap, AlignConfig<>(),
383                                 bandExtension);
384 }
385 
386 // Without AlignConfig and with only one scoring scheme.
387 template <typename TStringSet, typename TCargo, typename TGraphSpec, typename TSeeds, typename TScoreValue,
388           typename TScoreSpec>
389 inline TScoreValue
390 bandedChainAlignment(Graph<Alignment<TStringSet, TCargo, TGraphSpec> > & alignmentGraph,
391                      TSeeds const & seedSet,
392                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
393                      unsigned bandExtension = 15)
394 {
395     return bandedChainAlignment(alignmentGraph, seedSet, scoreScheme, scoreScheme, AlignConfig<>(), bandExtension);
396 }
397 
398 // ----------------------------------------------------------------------------
399 // Function bandedChainAlignment()                          [String<Fragments>]
400 // ----------------------------------------------------------------------------
401 
402 template <typename TSize, typename TFragmentSpec, typename TStringSpec, typename TSequence, typename TStringSetSpec,
403           typename TSeeds, typename TScoreValue, typename TScoreSpecAnchor, typename TScoreSpecGap,
404           bool TFirstRow, bool TFirstColumn, bool TLastColumn, bool TLastRow, typename TACSpec>
405 inline TScoreValue
406 bandedChainAlignment(String<Fragment<TSize, TFragmentSpec>, TStringSpec> & fragmentString,
407                      StringSet<TSequence, TStringSetSpec> const & strings,
408                      TSeeds const & seedSet,
409                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchors,
410                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGaps,
411                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
412                      unsigned bandExtension = 15)
413 {
414     typedef typename Position<TSequence>::Type TPosition;
415     typedef StringSet<String<TraceSegment_<TPosition, TSize> > > TTraceSegmentSet;
416 
417     TTraceSegmentSet traceSet;
418     TScoreValue score =
419         _setupAndRunBandedChainAlignment(traceSet, seedSet, value(strings, 0), value(strings, 1), scoreSchemeAnchors,
420                                          scoreSchemeGaps, alignConfig, bandExtension, GapsLeft());
421     if (empty(traceSet))
422         return score;
423 
424     _adaptTraceSegmentsTo(fragmentString, positionToId(strings, 0), positionToId(strings, 1), value(traceSet, 0));
425     return score;
426 }
427 
428 // With only one scoring scheme.
429 template <typename TSize, typename TFragmentSpec, typename TStringSpec, typename TSequence, typename TStringSetSpec,
430           typename TSeeds, typename TScoreValue, typename TScoreSpec, bool TFirstRow, bool TFirstColumn,
431           bool TLastColumn, bool TLastRow, typename TACSpec>
432 inline TScoreValue
433 bandedChainAlignment(String<Fragment<TSize, TFragmentSpec>, TStringSpec> & fragmentString,
434                      StringSet<TSequence, TStringSetSpec> const & strings,
435                      TSeeds const & seedSet,
436                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
437                      AlignConfig<TFirstRow, TFirstColumn, TLastColumn, TLastRow, TACSpec> const & alignConfig,
438                      unsigned bandExtension = 15)
439 {
440     return bandedChainAlignment(fragmentString, strings, seedSet, scoreScheme, scoreScheme, alignConfig, bandExtension);
441 }
442 
443 // Without AlignConfig.
444 template <typename TSize, typename TFragmentSpec, typename TStringSpec, typename TSequence, typename TStringSetSpec,
445           typename TSeeds, typename TScoreValue, typename TScoreSpecAnchor, typename TScoreSpecGap>
446 inline TScoreValue
447 bandedChainAlignment(String<Fragment<TSize, TFragmentSpec>, TStringSpec> & fragmentString,
448                      StringSet<TSequence, TStringSetSpec> const & strings,
449                      TSeeds const & seedSet,
450                      Score<TScoreValue, TScoreSpecAnchor> const & scoreSchemeAnchor,
451                      Score<TScoreValue, TScoreSpecGap> const & scoreSchemeGap,
452                      unsigned bandExtension = 15)
453 {
454     return bandedChainAlignment(fragmentString, strings, seedSet, scoreSchemeAnchor, scoreSchemeGap, AlignConfig<>(),
455                                 bandExtension);
456 }
457 
458 // Without AlignConfig and with only one scoring scheme.
459 template <typename TSize, typename TFragmentSpec, typename TStringSpec, typename TSequence, typename TStringSetSpec,
460           typename TSeeds, typename TScoreValue, typename TScoreSpec>
461 inline TScoreValue
462 bandedChainAlignment(String<Fragment<TSize, TFragmentSpec>, TStringSpec> & fragmentString,
463                      StringSet<TSequence, TStringSetSpec> const & strings,
464                      TSeeds const & seedSet,
465                      Score<TScoreValue, TScoreSpec> const & scoreScheme,
466                      unsigned bandExtension = 15)
467 {
468     return bandedChainAlignment(fragmentString, strings, seedSet, scoreScheme, scoreScheme, AlignConfig<>(),
469                                 bandExtension);
470 }
471 
472 }  // namespace seqan
473 
474 #endif  // #ifndef INCLUDE_SEQAN_SEEDS_BANDED_CHAIN_ALIGNMENT_H_
475