NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
traceback_impl.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 
36 #include <nvbio/basic/exceptions.h>
37 #include <nvbio/io/alignments.h>
38 #include <nvbio/io/utils.h>
39 #include <nvbio/basic/dna.h> // for dna_to_char
40 
41 namespace nvbio {
42 namespace bowtie2 {
43 namespace cuda {
44 
47 
50 
51 template <typename vector_type>
54  const vector_type cigar,
55  const uint32 cigar_len)
56 {
57  uint32 r = 0;
58  for (uint32 i = 0; i < cigar_len; ++i)
59  {
60  const uint32 l = cigar[ cigar_len - i - 1u ].m_len;
61  const uint32 op = cigar[ cigar_len - i - 1u ].m_type;
62  if (op != io::Cigar::DELETION) r += l;
63  }
64  return r;
65 }
66 
68 {
71 };
72 
74 const char* mate_string(const MateType mate) { return mate == OppositeMate ? "opposite" : "anchor"; }
75 
79 template <uint32 ALN_IDX, typename pipeline_type>
81  const uint32 count,
82  const uint32* idx,
83  io::Alignment* best_data,
84  const uint32 best_stride,
85  const uint32 band_len,
86  const pipeline_type& pipeline,
87  const ParamsPOD params);
88 
92 template <uint32 ALN_IDX, typename pipeline_type>
94  const uint32 count,
95  const uint32* idx,
96  io::Alignment* best_data,
97  const uint32 best_stride,
98  const pipeline_type& pipeline,
99  const ParamsPOD params);
100 
104 template <typename pipeline_type>
106  const uint32 count,
107  const uint32* idx,
108  const uint32 buffer_offset,
109  const uint32 buffer_size,
110  io::Alignment* alignments,
111  const uint32 band_len,
112  const pipeline_type& pipeline,
113  const ParamsPOD params);
114 
118 template <uint32 ALN_IDX, typename scoring_scheme_type, typename pipeline_type>
120  const uint32 count,
121  const uint32* idx,
122  io::Alignment* best_data,
123  const uint32 best_stride,
124  const uint32 band_len,
125  const pipeline_type& pipeline,
126  const scoring_scheme_type scoring_scheme,
127  const ParamsPOD params);
128 
132 template <uint32 ALN_IDX, typename scoring_scheme_type, typename pipeline_type>
134  const uint32 count,
135  const uint32* idx,
136  io::Alignment* best_data,
137  const uint32 best_stride,
138  const uint32 band_len,
139  const pipeline_type& pipeline,
140  const scoring_scheme_type scoring_scheme,
141  const ParamsPOD params);
142 
146 template <typename scoring_scheme_type, typename pipeline_type>
148  const uint32 count,
149  const uint32* idx,
150  const uint32 buffer_offset,
151  const uint32 buffer_size,
152  io::Alignment* alignments,
153  const uint32 band_len,
154  const pipeline_type& pipeline,
155  const scoring_scheme_type scoring_scheme,
156  const ParamsPOD params);
157 
160 
161 } // namespace cuda
162 } // namespace bowtie2
163 } // namespace nvbio
164