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 navigator for the full score dp-matrix. We need two iterators over the
35 // current column and the previous column. We also store the three neighboring
36 // cells needed for the recursion formula.
37 // ==========================================================================
38 
39 #ifndef SEQAN_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_H_
40 #define SEQAN_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_H_
41 
42 namespace seqan {
43 
44 // ============================================================================
45 // Forwards
46 // ============================================================================
47 
48 // ============================================================================
49 // Tags, Classes, Enums
50 // ============================================================================
51 
52 // ----------------------------------------------------------------------------
53 // Class DPMatrixNavigator                          [FullDPMatrix, ScoreMatrix]
54 // ----------------------------------------------------------------------------
55 
56 // The navigator for the score matrix.
57 //
58 // This navigator runs on a FullDPMatrix while it navigates column wise.
59 template <typename TValue>
60 class DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise>
61 {
62 public:
63     typedef  DPMatrix_<TValue, FullDPMatrix> TDPMatrix_;
64     typedef typename Pointer_<TDPMatrix_>::Type TDPMatrixPointer_;
65     typedef typename Iterator<TDPMatrix_, Standard>::Type TDPMatrixIterator;
66 
67     TDPMatrixPointer_ _ptrDataContainer;        // Pointer to the matrix this navigator is working on.
68     int _laneLeap;                              // Stores the jump to the next column
69     TDPMatrixIterator _activeColIterator;       // The active column iterator.
70     TDPMatrixIterator _prevColIterator;         // The previous column iterator.
71     TValue _prevCellDiagonal;                   // The previous diagonal cell
72     TValue _prevCellHorizontal;                 // The previous Horizontal cell
73     TValue _prevCellVertical;                   // The previous Vertical cell
74 
75 
76 
DPMatrixNavigator_()77     DPMatrixNavigator_() :
78         _ptrDataContainer(TDPMatrixPointer_(0)),
79         _laneLeap(0),
80         _activeColIterator(),
81         _prevColIterator(),
82         _prevCellDiagonal(),
83         _prevCellHorizontal(),
84         _prevCellVertical()
85     {}
86 };
87 
88 // ============================================================================
89 // Metafunctions
90 // ============================================================================
91 
92 // ============================================================================
93 // Functions
94 // ============================================================================
95 
96 // ----------------------------------------------------------------------------
97 // Function _init()
98 // ----------------------------------------------------------------------------
99 
100 // Initializes the navigator for an unbanded alignment.
101 template <typename TValue>
102 inline void
_init(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & navigator,DPMatrix_<TValue,FullDPMatrix> & dpMatrix,DPBandConfig<BandOff> const &)103 _init(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & navigator,
104       DPMatrix_<TValue, FullDPMatrix> & dpMatrix,
105       DPBandConfig<BandOff> const &)
106 {
107     navigator._ptrDataContainer = &dpMatrix;
108     navigator._activeColIterator = begin(dpMatrix, Standard());
109     navigator._prevColIterator = navigator._activeColIterator - _dataFactors(dpMatrix)[DPMatrixDimension_::HORIZONTAL];
110     navigator._laneLeap = 1;
111     assignValue(navigator._activeColIterator, TValue());
112 }
113 
114 // Initializes the navigator for a banded alignment.
115 template <typename TValue>
116 inline void
_init(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & navigator,DPMatrix_<TValue,FullDPMatrix> & dpMatrix,DPBandConfig<BandOn> const & band)117 _init(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & navigator,
118       DPMatrix_<TValue, FullDPMatrix> & dpMatrix,
119       DPBandConfig<BandOn> const & band)
120 {
121     typedef typename Size<DPMatrix_<TValue, FullDPMatrix> >::Type TMatrixSize;
122     typedef typename MakeSigned<TMatrixSize>::Type TSignedSize;
123     navigator._ptrDataContainer = &dpMatrix;
124 
125 
126     // Band begins within the first row.
127     if (lowerDiagonal(band) >= 0)
128     {
129         navigator._laneLeap = _min(length(dpMatrix, DPMatrixDimension_::VERTICAL), bandSize(band));
130         navigator._activeColIterator = begin(dpMatrix, Standard()) + _dataLengths(dpMatrix)[DPMatrixDimension_::VERTICAL] - 1;
131     }
132     else if (upperDiagonal(band) <= 0)  // Band begins within the first column.
133     {
134         navigator._laneLeap = 1;
135         navigator._activeColIterator = begin(dpMatrix, Standard());
136     }
137     else  // Band intersects with the point of origin.
138     {
139         TMatrixSize lengthVertical = length(dpMatrix, DPMatrixDimension_::VERTICAL);
140         int lastPos = _max(-static_cast<TSignedSize>(lengthVertical - 1), lowerDiagonal(band));
141         navigator._laneLeap = lengthVertical + lastPos;
142         navigator._activeColIterator = begin(dpMatrix, Standard()) + navigator._laneLeap - 1;
143     }
144     // Set previous iterator to same position, one column left.
145     navigator._prevColIterator = navigator._activeColIterator - _dataFactors(dpMatrix)[DPMatrixDimension_::HORIZONTAL];
146     assignValue(navigator._activeColIterator, TValue());
147 }
148 
149 // ----------------------------------------------------------------------------
150 // Function _goNextCell()                          [DPInitialColumn, FirstCell]
151 // ----------------------------------------------------------------------------
152 
153 // In the initial column we don't need to do anything because, the navigagtor is already initialized.
154 template <typename TValue>
155 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> &,MetaColumnDescriptor<DPInitialColumn,PartialColumnTop> const &,FirstCell const &)156 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/,
157             MetaColumnDescriptor<DPInitialColumn, PartialColumnTop> const &,
158             FirstCell const &)
159 {
160     // no-op
161 }
162 
163 template <typename TValue>
164 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> &,MetaColumnDescriptor<DPInitialColumn,FullColumn> const &,FirstCell const &)165 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/,
166             MetaColumnDescriptor<DPInitialColumn, FullColumn> const &,
167             FirstCell const &)
168 {
169     // no-op
170 }
171 
172 template <typename TValue, typename TColumnLocation>
173 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> &,MetaColumnDescriptor<DPInitialColumn,TColumnLocation> const &,FirstCell const &)174 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/,
175             MetaColumnDescriptor<DPInitialColumn, TColumnLocation> const &,
176             FirstCell const &)
177 {
178     // no-op
179 }
180 
181 // ----------------------------------------------------------------------------
182 // Function _goNextCell()                         [PartialColumnTop, FirstCell]
183 // ----------------------------------------------------------------------------
184 
185 // We are in the banded case, where the band crosses the first row.
186 // The left cell of the active cell is not valid, beacause we only can come from horizontal direction.
187 // The lower left cell of the active cell is the horizontal direction.
188 template <typename TValue, typename TColumnType>
189 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,PartialColumnTop> const &,FirstCell const &)190 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
191             MetaColumnDescriptor<TColumnType, PartialColumnTop> const &,
192             FirstCell const &)
193 {
194     --dpNavigator._laneLeap;
195     dpNavigator._activeColIterator += dpNavigator._laneLeap;
196     dpNavigator._prevColIterator += dpNavigator._laneLeap;
197     dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator);
198 }
199 
200 // ----------------------------------------------------------------------------
201 // Function _goNextCell()                               [FullColumn, FirstCell]
202 // ----------------------------------------------------------------------------
203 
204 // We are in the unbanded case or in the middle phase of the wide band.
205 // The left cell of the active cell represents horizontal direction.
206 template <typename TValue, typename TColumnType>
207 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,FullColumn> const &,FirstCell const &)208 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
209             MetaColumnDescriptor<TColumnType, FullColumn> const &,
210             FirstCell const &)
211 {
212     dpNavigator._activeColIterator += dpNavigator._laneLeap;
213     dpNavigator._prevColIterator += dpNavigator._laneLeap;
214     dpNavigator._prevCellHorizontal = value(dpNavigator._prevColIterator);
215 }
216 
217 // ----------------------------------------------------------------------------
218 // Function _goNextCell() [PartialColumnMiddle, PartialColumnBottom, FirstCell]
219 // ----------------------------------------------------------------------------
220 
221 // We are in the banded case.
222 // The left cell of the active cell represents diagonal direction. The lower left diagonal represents the horizontal direction.
223 
224 template <typename TValue, typename TColumnType, typename TColumnLocation>
225 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,TColumnLocation> const &,FirstCell const &)226 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
227             MetaColumnDescriptor<TColumnType, TColumnLocation> const &,
228             FirstCell const &)
229 {
230     dpNavigator._activeColIterator += dpNavigator._laneLeap;
231     dpNavigator._prevColIterator += dpNavigator._laneLeap;
232     dpNavigator._prevCellDiagonal = value(dpNavigator._prevColIterator);
233     dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator);
234 }
235 
236 // ----------------------------------------------------------------------------
237 // Function _goNextCell                            [DPInitialColumn, InnerCell]
238 // ----------------------------------------------------------------------------
239 
240 // If we are in the initial column, we only need to represent the vertical direction.
241 // But we still have to update the previous column iterator.
242 template <typename TValue, typename TColumnLocation>
243 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<DPInitialColumn,TColumnLocation> const &,InnerCell const &)244 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
245             MetaColumnDescriptor<DPInitialColumn, TColumnLocation> const &,
246             InnerCell const &)
247 {
248     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
249     ++dpNavigator._activeColIterator;
250     ++dpNavigator._prevColIterator;  // Do we have to increase the prevColIterator....
251 }
252 
253 // ----------------------------------------------------------------------------
254 // Function _goNextCell                                  [AnyColumn, InnerCell]
255 // ----------------------------------------------------------------------------
256 
257 // For any other column type and location we can use the same navigation procedure.
258 template <typename TValue, typename TColumnType, typename TColumnLocation>
259 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,TColumnLocation> const &,InnerCell const &)260 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
261             MetaColumnDescriptor<TColumnType, TColumnLocation> const &,
262             InnerCell const &)
263 {
264     dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal;
265     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
266     dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator);
267     ++dpNavigator._activeColIterator;
268 }
269 
270 // ----------------------------------------------------------------------------
271 // Function _goNextCell                             [DPInitialColumn, LastCell]
272 // ----------------------------------------------------------------------------
273 
274 // If we are in the initial column we only need to represent the vertical direction.
275 // But we still have to update the previous column iterator.
276 template <typename TValue, typename TColumnLocation>
277 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<DPInitialColumn,TColumnLocation> const &,LastCell const &)278 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
279             MetaColumnDescriptor<DPInitialColumn, TColumnLocation> const &,
280             LastCell const &)
281 {
282     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
283     ++dpNavigator._activeColIterator;
284     ++dpNavigator._prevColIterator;
285 }
286 
287 // We need this function to avoid ambiguous function calls.
288 template <typename TValue>
289 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<DPInitialColumn,PartialColumnBottom> const &,LastCell const &)290 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
291             MetaColumnDescriptor<DPInitialColumn, PartialColumnBottom> const &,
292             LastCell const &)
293 {
294     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
295     ++dpNavigator._activeColIterator;
296     ++dpNavigator._prevColIterator;
297 }
298 
299 // We need this function to avoid ambiguous function calls.
300 template <typename TValue>
301 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<DPInitialColumn,FullColumn> const &,LastCell const &)302 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
303             MetaColumnDescriptor<DPInitialColumn, FullColumn> const &,
304             LastCell const &)
305 {
306     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
307     ++dpNavigator._activeColIterator;
308     ++dpNavigator._prevColIterator;
309 }
310 
311 // ----------------------------------------------------------------------------
312 // Function _goNextCell                                  [FullColumn, LastCell]
313 // ----------------------------------------------------------------------------
314 
315 // If we are in a full column the values correspond to standard dp directions.
316 template <typename TValue, typename TColumnType>
317 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,FullColumn> const &,LastCell const &)318 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
319             MetaColumnDescriptor<TColumnType, FullColumn> const &,
320             LastCell const &)
321 {
322     dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal;
323     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
324     dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator);
325     ++dpNavigator._activeColIterator;
326 }
327 
328 // ----------------------------------------------------------------------------
329 // Function _goNextCell                         [PartialColumnBottom, LastCell]
330 // ----------------------------------------------------------------------------
331 
332 // If we are in banded case and are the band crosses the last row, we have to update
333 // the additional leap for the current track.
334 template <typename TValue, typename TColumnType>
335 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,PartialColumnBottom> const &,LastCell const &)336 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
337             MetaColumnDescriptor<TColumnType, PartialColumnBottom> const &,
338             LastCell const &)
339 {
340     dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal;
341     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
342     dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator);
343     ++dpNavigator._activeColIterator;
344     ++dpNavigator._laneLeap;
345 }
346 
347 // ----------------------------------------------------------------------------
348 // Function _goNextCell      [PartialColumnTop & PartialColumnBottom, LastCell]
349 // ----------------------------------------------------------------------------
350 
351 // If we are in the banded case the left cell of the active represents the diagonal direction.
352 template <typename TValue, typename TColumnType, typename TColumnLocation>
353 inline void
_goNextCell(DPMatrixNavigator_<DPMatrix_<TValue,FullDPMatrix>,DPScoreMatrix,NavigateColumnWise> & dpNavigator,MetaColumnDescriptor<TColumnType,TColumnLocation> const &,LastCell const &)354 _goNextCell(DPMatrixNavigator_<DPMatrix_<TValue, FullDPMatrix>, DPScoreMatrix, NavigateColumnWise> & dpNavigator,
355             MetaColumnDescriptor<TColumnType, TColumnLocation> const &,
356             LastCell const &)
357 {
358     dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal;
359     dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator);
360     ++dpNavigator._activeColIterator;
361 }
362 
363 // ----------------------------------------------------------------------------
364 // Function previousCellDiagonal()
365 // ----------------------------------------------------------------------------
366 
367 template <typename TDPMatrix, typename TNavigationSpec>
368 inline typename Reference<DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> >::Type
previousCellDiagonal(DPMatrixNavigator_<TDPMatrix,DPScoreMatrix,TNavigationSpec> & dpNavigator)369 previousCellDiagonal(DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> & dpNavigator)
370 {
371     return dpNavigator._prevCellDiagonal;
372 }
373 
374 template <typename TDPMatrix, typename TNavigationSpec>
375 inline typename Reference<DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> const>::Type
previousCellDiagonal(DPMatrixNavigator_<TDPMatrix,DPScoreMatrix,TNavigationSpec> const & dpNavigator)376 previousCellDiagonal(DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> const & dpNavigator)
377 {
378     return dpNavigator._prevCellDiagonal;
379 }
380 
381 // ----------------------------------------------------------------------------
382 // Function previousCellHorizontal()
383 // ----------------------------------------------------------------------------
384 
385 template <typename TDPMatrix, typename TNavigationSpec>
386 inline typename Reference<DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> >::Type
previousCellHorizontal(DPMatrixNavigator_<TDPMatrix,DPScoreMatrix,TNavigationSpec> & dpNavigator)387 previousCellHorizontal(DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> & dpNavigator)
388 {
389     return dpNavigator._prevCellHorizontal;
390 }
391 
392 template <typename TDPMatrix, typename TNavigationSpec>
393 inline typename Reference<DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> const>::Type
previousCellHorizontal(DPMatrixNavigator_<TDPMatrix,DPScoreMatrix,TNavigationSpec> const & dpNavigator)394 previousCellHorizontal(DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> const & dpNavigator)
395 {
396     return dpNavigator._prevCellHorizontal;
397 }
398 
399 // ----------------------------------------------------------------------------
400 // Function previousCellVertical()
401 // ----------------------------------------------------------------------------
402 
403 template <typename TDPMatrix, typename TNavigationSpec>
404 inline typename Reference<DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> >::Type
previousCellVertical(DPMatrixNavigator_<TDPMatrix,DPScoreMatrix,TNavigationSpec> & dpNavigator)405 previousCellVertical(DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> & dpNavigator)
406 {
407     return dpNavigator._prevCellVertical;
408 }
409 
410 template <typename TDPMatrix, typename TNavigationSpec>
411 inline typename Reference<DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> const>::Type
previousCellVertical(DPMatrixNavigator_<TDPMatrix,DPScoreMatrix,TNavigationSpec> const & dpNavigator)412 previousCellVertical(DPMatrixNavigator_<TDPMatrix, DPScoreMatrix, TNavigationSpec> const & dpNavigator)
413 {
414     return dpNavigator._prevCellVertical;
415 }
416 
417 }  // namespace seqan
418 
419 #endif  // #ifndef SEQAN_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_H_
420