NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ed_banded_inl.h
Go to the documentation of this file.
1 /*
2  * nvbio
3  * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the NVIDIA CORPORATION nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #pragma once
29 
30 #include <nvbio/basic/types.h>
31 #include <nvbio/basic/numbers.h>
34 
35 namespace nvbio {
36 namespace aln {
37 
38 namespace priv {
39 
42 
55 template <
56  uint32 BAND_LEN,
58  typename pattern_type,
59  typename qual_type,
60  typename text_type,
61  typename sink_type>
64  const EditDistanceAligner<TYPE>& aligner,
65  pattern_type pattern,
66  qual_type quals,
67  text_type text,
68  const int32 min_score,
69  sink_type& sink)
70 {
71  return banded_alignment_score<BAND_LEN>(
72  make_smith_waterman_aligner<TYPE>( EditDistanceSWScheme() ),
73  pattern,
74  quals,
75  text,
76  min_score,
77  sink );
78 }
79 
93 template <
94  uint32 BAND_LEN,
96  typename pattern_type,
97  typename qual_type,
98  typename text_type,
99  typename sink_type,
100  typename checkpoint_type>
103  const EditDistanceAligner<TYPE>& aligner,
104  pattern_type pattern,
105  qual_type quals,
106  text_type text,
107  const int32 min_score,
108  const uint32 window_begin,
109  const uint32 window_end,
110  sink_type& sink,
111  checkpoint_type checkpoint)
112 {
113  return banded_alignment_score<BAND_LEN>(
114  make_smith_waterman_aligner<TYPE>( EditDistanceSWScheme() ),
115  pattern,
116  quals,
117  text,
118  min_score,
119  window_begin,
120  window_end,
121  sink,
122  checkpoint );
123 }
124 
147 template <
148  uint32 BAND_LEN,
149  uint32 CHECKPOINTS,
151  typename pattern_type,
152  typename qual_type,
153  typename text_type,
154  typename sink_type,
155  typename checkpoint_type>
158  const EditDistanceAligner<TYPE>& aligner,
159  pattern_type pattern,
160  qual_type quals,
161  text_type text,
162  const int32 min_score,
163  sink_type& sink,
164  checkpoint_type checkpoints)
165 {
166  return banded_alignment_checkpoints<BAND_LEN,CHECKPOINTS>(
167  make_smith_waterman_aligner<TYPE>( EditDistanceSWScheme() ),
168  pattern,
169  quals,
170  text,
171  min_score,
172  sink,
173  checkpoints );
174 }
175 
208 template <
209  uint32 BAND_LEN,
210  uint32 CHECKPOINTS,
212  typename pattern_string,
213  typename qual_string,
214  typename text_string,
215  typename checkpoint_type,
216  typename submatrix_type>
219  const EditDistanceAligner<TYPE>& aligner,
220  pattern_string pattern,
221  qual_string quals,
222  text_string text,
223  const int32 min_score,
224  checkpoint_type checkpoints,
225  const uint32 checkpoint_id,
226  submatrix_type submatrix)
227 {
228  return banded_alignment_submatrix<BAND_LEN,CHECKPOINTS>(
229  make_smith_waterman_aligner<TYPE>( EditDistanceSWScheme() ),
230  pattern,
231  quals,
232  text,
233  min_score,
234  checkpoints,
235  checkpoint_id,
236  submatrix );
237 }
238 
273 template <
274  uint32 BAND_LEN,
275  uint32 CHECKPOINTS,
277  typename checkpoint_type,
278  typename submatrix_type,
279  typename backtracer_type>
282  const EditDistanceAligner<TYPE>& aligner,
283  checkpoint_type checkpoints,
284  const uint32 checkpoint_id,
285  submatrix_type submatrix,
286  const uint32 submatrix_height,
287  uint8& state,
288  uint2& sink,
289  backtracer_type& backtracer)
290 {
291  return banded_alignment_traceback<BAND_LEN,CHECKPOINTS>(
292  make_smith_waterman_aligner<TYPE>( EditDistanceSWScheme() ),
293  checkpoints,
294  checkpoint_id,
295  submatrix,
296  submatrix_height,
297  state,
298  sink,
299  backtracer );
300 }
301 
303 
304 } // namespace priv
305 
306 } // namespace aln
307 } // namespace nvbio
308