nvBowtie.dox 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. /// \page nvbowtie_page nvBowtie
  28. ///
  29. ///\htmlonly
  30. /// <img src="nvidia_cubes.png" style="position:relative; bottom:-10px; border:0px;"/>
  31. ///\endhtmlonly
  32. ///
  33. ///\par
  34. ///\n
  35. /// nvBowtie is a GPU-accelerated re-engineering of Bowtie2, a very widely used short-read aligner.
  36. /// While being completely rewritten from scratch, nvBowtie reproduces many (though not all) of the
  37. /// features of Bowtie2.
  38. ///
  39. /// \section PerformanceSection Performance
  40. ///\par
  41. /// nvBowtie is designed to exploit all the massive parallelism of modern GPUs, thus enabling
  42. /// a much higher alignment throughput at equal accuracy, or higher accuracy in the same time.
  43. /// Here's a graph showing nvBowtie's performance compared to bowtie2 on an Illumina HiSeq 2000
  44. /// dataset (the first 10M reads of ERR161544) and an IonProton run, using both end-to-end and
  45. /// local alignment.
  46. /// The alignment results show 99.98% agreement at high MAPQ.
  47. /// All bowtie2 tests were run using 20 CPU threads, and default aligment options:
  48. ///
  49. /// <img src="benchmark-nvbowtie-speedup.png" style="position:relative; bottom:-10px; border:0px;" width="80%" height="80%"/>
  50. ///
  51. /// \section SpecificitySection Specificity and Sensitivity
  52. ///\par
  53. /// While targeting maximum performance, nvBowtie is designed to match Bowtie2 as closely as possible, with the explicit goal of mantaining
  54. /// the same specificity and sensitivity characteristics.
  55. /// The following ROC curves have been generated using the excellent online testing platform <a href="http://www.bioplanet.com/gcat">GCAT</a>.
  56. /// As can be seen, nvBowtie matches Bowtie2's results to within extreme accuracy for a wide range of read types and error distributions.
  57. /// The only noticeable (and still very tiny) differences are concentrated around very low mapping quality alignments.
  58. ///
  59. /// <img src="nvBowtie-ROC-se-100.png" style="position:relative; bottom:-10px; border:0px;" width="95%" height="95%"/>
  60. /// <img src="nvBowtie-ROC-pe-100.png" style="position:relative; bottom:-10px; border:0px;" width="95%" height="95%"/>
  61. /// <img src="nvBowtie-ROC-pe-250.png" style="position:relative; bottom:-10px; border:0px;" width="95%" height="95%"/>
  62. ///
  63. /// \section nvBowtieArch Architecture
  64. ///
  65. ///\par
  66. /// In order to take advantage of the massive parallelism available in modern processor
  67. /// architectures, nvBowtie re-implements the same underlying algorithms as Bowtie2 taking a fundamentally different
  68. /// approach.
  69. /// In fact, while Bowtie2 is essentially designed to operate on a single read at a time (possibly having multiple
  70. /// CPU threads working on a different read), carrying the entire alignment process in what is
  71. /// basically a very complex chain of nested function calls, nvBowtie works at all times with large batches
  72. /// of reads, and treats their alignment as a complex pipeline composed by many relatively simple but deeply
  73. /// parallel stages.
  74. /// In many of these stages parallelism is spread at a much finer granularity than at the reads-level, for example
  75. /// by processing many candidate hits from each read at the same time.
  76. ///
  77. ///\par
  78. /// There are effectively a few different pipelines, one for each kind of alignment:
  79. /// - best mapping of single-end reads
  80. /// - best mapping of paired-end reads
  81. /// - all mapping of single-end reads
  82. /// - all mapping of paired-end reads (not implemented yet)
  83. ///
  84. /// \subsection BestMapping-SingleEnd best-mapping, single-end reads
  85. ///
  86. ///\par
  87. /// This pipeline can be described by the following pseudo-code:
  88. ///
  89. /// \code
  90. ///
  91. /// best-alignments = {}
  92. ///
  93. /// seed-mapping-queue[in] := all reads
  94. /// while (seed-mapping-queue[in] not empty)
  95. /// {
  96. /// (seed-mapping-queue[out], seed-deques) := map( seed-mapping-queue[in] );
  97. ///
  98. /// score( seed-mapping-queue[in], seed-deques, best-alignments ); // find the best alignments for each read
  99. ///
  100. /// seed-mapping-queue[in] = seed-mapping-queue[out];
  101. /// }
  102. /// traceback_best( best-alignments ); // traceback the best alignments
  103. /// \endcode
  104. ///
  105. ///\par
  106. /// where score() is a sub-pipeline:
  107. ///
  108. /// \code
  109. /// score([in] input-reads, [in] seed-deques, [in/out] best-alignments)
  110. /// {
  111. /// active-reads := input-reads
  112. /// while (active-reads not empty)
  113. /// {
  114. /// (hits-queue, active-reads) := select( active-reads, seed-deques ); // select the next round of hits to process
  115. /// locate( hits-queue ); // SA coordinates -> linear genome coordinates conversion
  116. /// score_best( hits-queue ); // assign a score to the selected hits using DP alignment
  117. /// score_reduce( hits-queue, best-alignments ); // keep track of the best alignments found so far for each read
  118. /// }
  119. /// }
  120. /// \endcode
  121. ///
  122. ///\par
  123. /// The various functions involved correspond to different pipeline stages:
  124. ///
  125. /// - \ref Mapping
  126. /// - \ref Locate
  127. /// - \ref Select
  128. /// - \ref Scoring
  129. /// - \ref Reduce
  130. /// - \ref Traceback
  131. ///
  132. ///\par
  133. /// The data flowing through the pipeline goes mostly through a single-data structure of type ScoringQueues (\ref ScoringQueuesModule),
  134. /// which itself contains the active-reads (ScoringQueues::active_reads), the hits-queue (ScoringQueues::hits)
  135. /// and an index allowing to walk all the hits belonging to each read (ScoringQueues::hits_index).
  136. ///
  137. /// \subsection BestMapping-PairedEnd best-mapping, paired-end reads
  138. ///
  139. ///\par
  140. /// This pipeline can be described by the following pseudo-code:
  141. ///
  142. /// \code
  143. ///
  144. /// best-anchor-alignments = {}
  145. /// best-opposite-alignments = {}
  146. ///
  147. /// for (anchor in {mate1,mate2})
  148. /// {
  149. /// seed-mapping-queue[in] := all reads
  150. /// while (seed-mapping-queue[in] not empty)
  151. /// {
  152. /// (seed-mapping-queue[out], seed-deques) := map( seed-mapping-queue[in] );
  153. ///
  154. /// score( seed-mapping-queue[in], seed-deques, best-anchor-alignments, best-opposite-alignments );
  155. ///
  156. /// seed-mapping-queue[in] = seed-mapping-queue[out];
  157. /// }
  158. /// }
  159. /// traceback_best( best-anchor-alignments );
  160. /// opposite_traceback_best( best-opposite-alignments );
  161. /// \endcode
  162. ///
  163. ///\par
  164. /// where again score() is a sub-pipeline:
  165. ///
  166. /// \code
  167. /// score([in] input-reads, [in] seed-deques, [in/out] best-anchor-alignments, [in/out] best-opposite-alignments)
  168. /// {
  169. /// active-reads := input-reads
  170. /// while (active-reads not empty)
  171. /// {
  172. /// (hits-queue, active-reads) := select( active-reads, seed-deques ); // select the next round of hits to process
  173. /// locate( hits-queue ); // SA coordinates -> linear genome coordinates conversion
  174. /// anchor_score_best( hits-queue ); // assign a score to the selected hits using DP alignment
  175. /// opposite_score_best( hits-queue ); // assign a score to opposite mate of the selected hits using DP alignment
  176. /// score_reduce_paired( hits-queue, best-anchor-alignments, best-opposite-alignments ); // keep track of the best alignments found so far for each read
  177. /// }
  178. /// }
  179. /// \endcode
  180. ///
  181. /// \section nvBowtieUsage Usage
  182. ///
  183. ///\par
  184. /// At the moment, the command line options of nvBowtie differ from those of bowtie2.
  185. /// A comprehensive list can be obtained running:
  186. ///
  187. ///\verbatim
  188. /// ./nvBowtie --help
  189. ///
  190. /// nvBowtie [options]
  191. /// options:
  192. /// General:
  193. /// -U file-name unpaired reads
  194. /// -1 file-name first mate reads
  195. /// -2 file-name second mate reads
  196. /// -S file-name output file (.sam|.bam)
  197. /// -x file-name reference index
  198. /// --verbosity verbosity level
  199. /// --upto | -u int [-1] maximum number of reads to process
  200. /// --trim3 | -3 int [0] trim the first N bases of 3'
  201. /// --trim5 | -5 int [0] trim the first N bases of 5'
  202. /// --nofw do not align the forward strand
  203. /// --norc do not align the reverse-complemented strand
  204. /// --device int [0] select the given cuda device(s) (e.g. --device 0 --device 1 ...)
  205. /// --file-ref load reference from file
  206. /// --server-ref load reference from server
  207. /// --phred33 qualities are ASCII characters equal to Phred quality + 33
  208. /// --phred64 qualities are ASCII characters equal to Phred quality + 64
  209. /// --solexa-quals qualities are in the Solexa format
  210. /// Paired-end:
  211. /// --ff paired mates are forward-forward
  212. /// --fr paired mates are forward-reverse
  213. /// --rf paired mates are reverse-forward
  214. /// --rr paired mates are reverse-reverse
  215. /// --minins | -I int [0] minimum insert length
  216. /// --minins | -X int [500] maximum insert length
  217. /// --overlap allow overlapping mates
  218. /// --no-overlap disable overlapping mates
  219. /// --dovetail allow dovetailing mates
  220. /// --no-discordant disable discordant alignments
  221. /// --no-mixed only report paired alignments
  222. /// --ungapped-mates | -ug perform ungapped mate alignment
  223. /// Seeding:
  224. /// --seed-len | -L int [22] seed lengths
  225. /// --seed-freq | -i func [S,1,local ? 0.75 : 1.15] seed interval function
  226. /// --max-hits int [100] maximum amount of seed hits
  227. /// --max-reseed | -R int [2] number of reseeding rounds
  228. /// Extension:
  229. /// --all | -a perform all-mapping (i.e. find and report all alignments)
  230. /// --local perform local alignment
  231. /// --rand randomized seed selection
  232. /// --no-rand disable randomized seed selection
  233. /// --max-dist int [15] maximum edit distance
  234. /// --max-effort-init int [15] initial maximum number of consecutive extension failures
  235. /// --max-effort | -D int [15] maximum number of consecutive extension failures
  236. /// --min-ext int [30] minimum number of extensions per read
  237. /// --max-ext int [400] maximum number of extensions per read
  238. /// --fast apply the fast presets
  239. /// --very-fast apply the very-fast presets
  240. /// --sensitive apply the sensitive presets
  241. /// --very-sensitive apply the very-sensitive presets
  242. /// --fast-local apply the fast presets
  243. /// --very-fast-local apply the very-fast presets
  244. /// --sensitive-local apply the sensitive presets
  245. /// --very-sensitive-local apply the very-sensitive presets
  246. /// Scoring:
  247. /// --scoring-scheme filename use a given scoring scheme
  248. /// --ma int match bonus
  249. /// --mp int,int max,min mismatch penalties
  250. /// --np int N penalty
  251. /// --rdg int,int read gap open / extension penalties
  252. /// --rfg int,int reference gap open / extension penalties
  253. /// --score-min func minimum score function
  254. /// Reporting:
  255. /// --mapQ-filter | -Q int [0] minimum mapQ threshold
  256. /// Debug
  257. /// --report filename generate an HTML report
  258. ///\endverbatim
  259. ///
  260. ///\par
  261. /// While most parameters should be easy to understand, a major difference is that nvBowtie
  262. /// relies on an external program to build the reference indices:
  263. ///\par
  264. /// - \subpage nvbwt_page : builds the BWT indices of the reference FASTA files
  265. ///
  266. ///\par
  267. /// e.g. suppose you have the human genome in a single FASTA file, <i>hg19.fa</i>; the
  268. /// following commands will create all indices needed by nvBowtie:
  269. ///
  270. ///\verbatim
  271. /// ./nvBWT hg19.fa hg19-index
  272. ///\endverbatim
  273. ///
  274. ///\par
  275. /// At this point, one can run nvBowtie:
  276. ///
  277. ///\verbatim
  278. /// ./nvBowtie -x hg19 -U my_reads.fastq -S my_reads.bam
  279. ///\endverbatim
  280. ///
  281. ///\par
  282. /// Notice that nvBowtie supports direct output of BAM files, which has been carefully optimized and parallelized
  283. /// in order to cope with the superior alignment throughput.
  284. ///
  285. ///\par
  286. /// Another noteworthy option is to let nvBowtie fetch the reference index from a <i>shared memory</i> server
  287. /// which can be run in the background: the \subpage nvfm_server_page.
  288. /// It be launched with:
  289. ///
  290. ///\verbatim
  291. /// ./nvFM-server hg19-index hg19 &
  292. ///\endverbatim
  293. ///
  294. ///\par
  295. /// nvBowtie can then pickup the reference from the server:
  296. ///
  297. ///\verbatim
  298. /// ./nvBowtie -x hg19 -U my_reads.fastq -S my_reads.bam
  299. ///\endverbatim
  300. ///
  301. /// \subsection ScoringSchemeSection scoring schemes
  302. ///
  303. ///\par
  304. /// The <i>--scoring-scheme filename</i> option allows to provide a custom Smith-Waterman scoring scheme
  305. /// through a text file, where each line must contain a token value pair.
  306. /// The tokens and default values are reported below:
  307. ///
  308. ///\verbatim
  309. /// match 0 // local alignment: 2
  310. /// mm-penalty-min 2
  311. /// mm-penalty-max 6
  312. /// N-penalty-min 1
  313. /// N-penalty-max 1
  314. /// score-min-const -0.6 // local alignment: 0
  315. /// score-min-coeff -0.6 // local alignment: 10
  316. /// score-min-type linear // local alignment: log
  317. /// N-ceil-const 0
  318. /// N-ceil-coeff 0.15
  319. /// read-gap-const 5
  320. /// read-gap-coeff 3
  321. /// ref-gap-const 5
  322. /// ref-gap-coeff 3
  323. /// gap-free 5
  324. ///\endverbatim
  325. ///