bio-samtools-wrapper 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.travis.yml +27 -0
  4. data/Gemfile +20 -0
  5. data/LICENSE.txt +702 -0
  6. data/README.md +501 -0
  7. data/Rakefile +73 -0
  8. data/VERSION +1 -0
  9. data/bin/bam_consensus.rb +85 -0
  10. data/bio-samtools-wrapper.gemspec +181 -0
  11. data/doc/Bio/DB/Alignment.html +552 -0
  12. data/doc/Bio/DB/Pileup.html +711 -0
  13. data/doc/Bio/DB/SAM/Library.html +167 -0
  14. data/doc/Bio/DB/SAM/Tools.html +109 -0
  15. data/doc/Bio/DB/SAM.html +1853 -0
  16. data/doc/Bio/DB/Tag.html +208 -0
  17. data/doc/Bio/DB/Vcf.html +431 -0
  18. data/doc/Bio/DB.html +105 -0
  19. data/doc/Bio.html +175 -0
  20. data/doc/LICENSE_txt.html +846 -0
  21. data/doc/created.rid +9 -0
  22. data/doc/fonts/Lato-Light.ttf +0 -0
  23. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  24. data/doc/fonts/Lato-Regular.ttf +0 -0
  25. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  26. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  27. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  28. data/doc/fonts.css +167 -0
  29. data/doc/images/add.png +0 -0
  30. data/doc/images/arrow_up.png +0 -0
  31. data/doc/images/brick.png +0 -0
  32. data/doc/images/brick_link.png +0 -0
  33. data/doc/images/bug.png +0 -0
  34. data/doc/images/bullet_black.png +0 -0
  35. data/doc/images/bullet_toggle_minus.png +0 -0
  36. data/doc/images/bullet_toggle_plus.png +0 -0
  37. data/doc/images/date.png +0 -0
  38. data/doc/images/delete.png +0 -0
  39. data/doc/images/find.png +0 -0
  40. data/doc/images/loadingAnimation.gif +0 -0
  41. data/doc/images/macFFBgHack.png +0 -0
  42. data/doc/images/package.png +0 -0
  43. data/doc/images/page_green.png +0 -0
  44. data/doc/images/page_white_text.png +0 -0
  45. data/doc/images/page_white_width.png +0 -0
  46. data/doc/images/plugin.png +0 -0
  47. data/doc/images/ruby.png +0 -0
  48. data/doc/images/tag_blue.png +0 -0
  49. data/doc/images/tag_green.png +0 -0
  50. data/doc/images/transparent.png +0 -0
  51. data/doc/images/wrench.png +0 -0
  52. data/doc/images/wrench_orange.png +0 -0
  53. data/doc/images/zoom.png +0 -0
  54. data/doc/index.html +106 -0
  55. data/doc/js/darkfish.js +140 -0
  56. data/doc/js/jquery.js +18 -0
  57. data/doc/js/navigation.js +142 -0
  58. data/doc/js/search.js +109 -0
  59. data/doc/js/search_index.js +1 -0
  60. data/doc/js/searcher.js +228 -0
  61. data/doc/rdoc.css +580 -0
  62. data/doc/table_of_contents.html +305 -0
  63. data/ext/Makefile-bioruby.patch +12 -0
  64. data/ext/Makefile-suse.patch +11 -0
  65. data/ext/mkrf_conf.rb +118 -0
  66. data/lib/bio/BIOExtensions.rb +89 -0
  67. data/lib/bio/db/alignment.rb +64 -0
  68. data/lib/bio/db/fastadb.rb +320 -0
  69. data/lib/bio/db/pileup.rb +273 -0
  70. data/lib/bio/db/sam/external/COPYING +21 -0
  71. data/lib/bio/db/sam/external/VERSION +1 -0
  72. data/lib/bio/db/sam/library.rb +32 -0
  73. data/lib/bio/db/sam.rb +778 -0
  74. data/lib/bio/db/vcf.rb +105 -0
  75. data/lib/bio-samtools-wrapper.rb +9 -0
  76. data/test/.gitignore +1 -0
  77. data/test/helper.rb +18 -0
  78. data/test/sample.vcf +24 -0
  79. data/test/samples/.gitignore +1 -0
  80. data/test/samples/LCI/NC_001988.ffn +2 -0
  81. data/test/samples/LCI/test.bam +0 -0
  82. data/test/samples/LCI/test.bam.bai +0 -0
  83. data/test/samples/small/dupes.bam +0 -0
  84. data/test/samples/small/dupes.sam +274 -0
  85. data/test/samples/small/ids2.txt +1 -0
  86. data/test/samples/small/map_for_reheader.sam +8 -0
  87. data/test/samples/small/map_to_merge1.bam +0 -0
  88. data/test/samples/small/map_to_merge1.bam.bai +0 -0
  89. data/test/samples/small/map_to_merge1.sam +8 -0
  90. data/test/samples/small/map_to_merge2.bam +0 -0
  91. data/test/samples/small/map_to_merge2.bam.bai +0 -0
  92. data/test/samples/small/map_to_merge2.sam +8 -0
  93. data/test/samples/small/no_md.sam +8 -0
  94. data/test/samples/small/sorted.bam +0 -0
  95. data/test/samples/small/sorted.bam.bai +0 -0
  96. data/test/samples/small/test.sai +0 -0
  97. data/test/samples/small/test.tam +10 -0
  98. data/test/samples/small/test_chr.fasta +1000 -0
  99. data/test/samples/small/test_chr.fasta.1.bt2 +0 -0
  100. data/test/samples/small/test_chr.fasta.2.bt2 +0 -0
  101. data/test/samples/small/test_chr.fasta.3.bt2 +0 -0
  102. data/test/samples/small/test_chr.fasta.4.bt2 +0 -0
  103. data/test/samples/small/test_chr.fasta.amb +2 -0
  104. data/test/samples/small/test_chr.fasta.ann +3 -0
  105. data/test/samples/small/test_chr.fasta.bwt +0 -0
  106. data/test/samples/small/test_chr.fasta.pac +0 -0
  107. data/test/samples/small/test_chr.fasta.rbwt +0 -0
  108. data/test/samples/small/test_chr.fasta.rev.1.bt2 +0 -0
  109. data/test/samples/small/test_chr.fasta.rev.2.bt2 +0 -0
  110. data/test/samples/small/test_chr.fasta.rpac +0 -0
  111. data/test/samples/small/test_chr.fasta.rsa +0 -0
  112. data/test/samples/small/test_chr.fasta.sa +0 -0
  113. data/test/samples/small/test_cov.svg +273 -0
  114. data/test/samples/small/test_fastadb.fasta +34 -0
  115. data/test/samples/small/testu.bam +0 -0
  116. data/test/samples/small/testu.bed +2 -0
  117. data/test/test_bio-samtools-wrapper.rb +1 -0
  118. data/test/test_fastadb.rb +89 -0
  119. data/test/test_pileup.rb +90 -0
  120. data/test/test_sam.rb +421 -0
  121. data/test/test_vcf.rb +79 -0
  122. data/tutorial/tutorial.html +474 -0
  123. data/tutorial/tutorial.md +424 -0
  124. data/tutorial/tutorial.pdf +0 -0
  125. metadata +254 -0
@@ -0,0 +1,1853 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Bio::DB::Sam - Pileup</title>
8
+
9
+ <link href="../../fonts.css" rel="stylesheet">
10
+ <link href="../../rdoc.css" rel="stylesheet">
11
+
12
+ <script type="text/javascript">
13
+ var rdoc_rel_prefix = "../../";
14
+ </script>
15
+
16
+ <script src="../../js/jquery.js"></script>
17
+ <script src="../../js/navigation.js"></script>
18
+ <script src="../../js/search_index.js"></script>
19
+ <script src="../../js/search.js"></script>
20
+ <script src="../../js/searcher.js"></script>
21
+ <script src="../../js/darkfish.js"></script>
22
+
23
+
24
+ <body id="top" role="document" class="class">
25
+ <nav role="navigation">
26
+ <div id="project-navigation">
27
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
+ <h2>
29
+ <a href="../../index.html" rel="home">Home</a>
30
+ </h2>
31
+
32
+ <div id="table-of-contents-navigation">
33
+ <a href="../../table_of_contents.html#pages">Pages</a>
34
+ <a href="../../table_of_contents.html#classes">Classes</a>
35
+ <a href="../../table_of_contents.html#methods">Methods</a>
36
+ </div>
37
+ </div>
38
+
39
+ <div id="search-section" role="search" class="project-section initially-hidden">
40
+ <form action="#" method="get" accept-charset="utf-8">
41
+ <div id="search-field-wrapper">
42
+ <input id="search-field" role="combobox" aria-label="Search"
43
+ aria-autocomplete="list" aria-controls="search-results"
44
+ type="text" name="search" placeholder="Search" spellcheck="false"
45
+ title="Type to search, Up and Down to navigate, Enter to load">
46
+ </div>
47
+
48
+ <ul id="search-results" aria-label="Search Results"
49
+ aria-busy="false" aria-expanded="false"
50
+ aria-atomic="false" class="initially-hidden"></ul>
51
+ </form>
52
+ </div>
53
+
54
+ </div>
55
+
56
+
57
+
58
+ <div id="class-metadata">
59
+
60
+ <div id="parent-class-section" class="nav-section">
61
+ <h3>Parent</h3>
62
+
63
+
64
+ <p class="link">Object
65
+
66
+ </div>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <div id="method-list-section" class="nav-section">
72
+ <h3>Methods</h3>
73
+
74
+ <ul class="link-list" role="directory">
75
+
76
+ <li ><a href="#method-c-docs">::docs</a>
77
+
78
+ <li ><a href="#method-c-new">::new</a>
79
+
80
+ <li ><a href="#method-i-average_coverage">#average_coverage</a>
81
+
82
+ <li ><a href="#method-i-calmd">#calmd</a>
83
+
84
+ <li ><a href="#method-i-cat">#cat</a>
85
+
86
+ <li ><a href="#method-i-chromosome_coverage">#chromosome_coverage</a>
87
+
88
+ <li ><a href="#method-i-depth">#depth</a>
89
+
90
+ <li ><a href="#method-i-faidx">#faidx</a>
91
+
92
+ <li ><a href="#method-i-fetch">#fetch</a>
93
+
94
+ <li ><a href="#method-i-fetch_reference">#fetch_reference</a>
95
+
96
+ <li ><a href="#method-i-fetch_with_function">#fetch_with_function</a>
97
+
98
+ <li ><a href="#method-i-fix_mates">#fix_mates</a>
99
+
100
+ <li ><a href="#method-i-fixmate">#fixmate</a>
101
+
102
+ <li ><a href="#method-i-flag_stats">#flag_stats</a>
103
+
104
+ <li ><a href="#method-i-flagstat">#flagstat</a>
105
+
106
+ <li ><a href="#method-i-idxstats">#idxstats</a>
107
+
108
+ <li ><a href="#method-i-index">#index</a>
109
+
110
+ <li ><a href="#method-i-index_stats">#index_stats</a>
111
+
112
+ <li ><a href="#method-i-merge">#merge</a>
113
+
114
+ <li ><a href="#method-i-mpileup">#mpileup</a>
115
+
116
+ <li ><a href="#method-i-open">#open</a>
117
+
118
+ <li ><a href="#method-i-phase">#phase</a>
119
+
120
+ <li ><a href="#method-i-plot_chromosome_coverage">#plot_chromosome_coverage</a>
121
+
122
+ <li ><a href="#method-i-reheader">#reheader</a>
123
+
124
+ <li ><a href="#method-i-remove_duplicates">#remove_duplicates</a>
125
+
126
+ <li ><a href="#method-i-rmdup">#rmdup</a>
127
+
128
+ <li ><a href="#method-i-sort">#sort</a>
129
+
130
+ <li ><a href="#method-i-targetcut">#targetcut</a>
131
+
132
+ <li ><a href="#method-i-tview">#tview</a>
133
+
134
+ <li ><a href="#method-i-view">#view</a>
135
+
136
+ </ul>
137
+ </div>
138
+
139
+ </div>
140
+ </nav>
141
+
142
+ <main role="main" aria-labelledby="class-Bio::DB::Sam">
143
+ <h1 id="class-Bio::DB::Sam" class="class">
144
+ class Bio::DB::Sam
145
+ </h1>
146
+
147
+ <section class="description">
148
+
149
+ </section>
150
+
151
+
152
+
153
+
154
+ <section id="5Buntitled-5D" class="documentation-section">
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+ <section class="attribute-method-details" class="method-section">
163
+ <header>
164
+ <h3>Attributes</h3>
165
+ </header>
166
+
167
+
168
+ <div id="attribute-i-bam" class="method-detail">
169
+ <div class="method-heading attribute-method-heading">
170
+ <span class="method-name">bam</span><span
171
+ class="attribute-access-type">[RW]</span>
172
+ </div>
173
+
174
+ <div class="method-description">
175
+
176
+
177
+
178
+ </div>
179
+ </div>
180
+
181
+ <div id="attribute-i-bcftools" class="method-detail">
182
+ <div class="method-heading attribute-method-heading">
183
+ <span class="method-name">bcftools</span><span
184
+ class="attribute-access-type">[RW]</span>
185
+ </div>
186
+
187
+ <div class="method-description">
188
+
189
+
190
+
191
+ </div>
192
+ </div>
193
+
194
+ <div id="attribute-i-fasta" class="method-detail">
195
+ <div class="method-heading attribute-method-heading">
196
+ <span class="method-name">fasta</span><span
197
+ class="attribute-access-type">[RW]</span>
198
+ </div>
199
+
200
+ <div class="method-description">
201
+
202
+
203
+
204
+ </div>
205
+ </div>
206
+
207
+ <div id="attribute-i-last_command" class="method-detail">
208
+ <div class="method-heading attribute-method-heading">
209
+ <span class="method-name">last_command</span><span
210
+ class="attribute-access-type">[RW]</span>
211
+ </div>
212
+
213
+ <div class="method-description">
214
+
215
+
216
+
217
+ </div>
218
+ </div>
219
+
220
+ <div id="attribute-i-samtools" class="method-detail">
221
+ <div class="method-heading attribute-method-heading">
222
+ <span class="method-name">samtools</span><span
223
+ class="attribute-access-type">[RW]</span>
224
+ </div>
225
+
226
+ <div class="method-description">
227
+
228
+
229
+
230
+ </div>
231
+ </div>
232
+
233
+ </section>
234
+
235
+
236
+
237
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
238
+ <header>
239
+ <h3>Public Class Methods</h3>
240
+ </header>
241
+
242
+
243
+ <div id="method-c-docs" class="method-detail ">
244
+
245
+ <div class="method-heading">
246
+ <span class="method-name">docs</span><span
247
+ class="method-args">(program, command)</span>
248
+
249
+ <span class="method-click-advice">click to toggle source</span>
250
+
251
+ </div>
252
+
253
+
254
+ <div class="method-description">
255
+
256
+ <ul><li>
257
+ <p>program - one of &#39;samtools&#39; &#39;bcftools&#39;</p>
258
+ </li><li>
259
+ <p>command - one of the commands relevant to the program</p>
260
+ </li></ul>
261
+
262
+
263
+
264
+
265
+ <div class="method-source-code" id="docs-source">
266
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 401</span>
267
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">docs</span>(<span class="ruby-identifier">program</span>, <span class="ruby-identifier">command</span>)
268
+ <span class="ruby-keyword">return</span> <span class="ruby-string">&quot;program must be &#39;samtools&#39; or &#39;bcftools&#39;&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> [<span class="ruby-string">&#39;samtools&#39;</span>, <span class="ruby-string">&#39;bcftools&#39;</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">program</span>
269
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{program} #{command}&quot;</span>
270
+ <span class="ruby-node">%x#{command}`</span>
271
+ <span class="ruby-keyword">end</span></pre>
272
+ </div>
273
+
274
+ </div>
275
+
276
+
277
+
278
+
279
+ </div>
280
+
281
+
282
+ <div id="method-c-new" class="method-detail ">
283
+
284
+ <div class="method-heading">
285
+ <span class="method-name">new</span><span
286
+ class="method-args">(args)</span>
287
+
288
+ <span class="method-click-advice">click to toggle source</span>
289
+
290
+ </div>
291
+
292
+
293
+ <div class="method-description">
294
+
295
+ <p>Creates a new <a href="Sam.html">Bio::DB::Sam</a> object</p>
296
+ <ul><li>
297
+ <p>fasta [String] - the path to the Fasta reference sequence</p>
298
+ </li><li>
299
+ <p>bam [String] - path to bam files</p>
300
+ </li><li>
301
+ <p>samtools [String] - path to alternative installation of samtools</p>
302
+ </li><li>
303
+ <p>bcftools [String] - path to alternative installation of bcftools</p>
304
+ </li><li>
305
+ <p>returns [Bio::DB::Sam] a new `Bio::DB::Sam` object</p>
306
+ </li></ul>
307
+
308
+
309
+
310
+
311
+ <div class="method-source-code" id="new-source">
312
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 13</span>
313
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)
314
+ <span class="ruby-ivar">@fasta</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:fasta</span>]
315
+ <span class="ruby-ivar">@bam</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:bam</span>]
316
+ <span class="ruby-ivar">@samtools</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:samtools</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>)),<span class="ruby-string">&#39;sam&#39;</span>,<span class="ruby-string">&#39;external&#39;</span>,<span class="ruby-string">&#39;samtools&#39;</span>)
317
+ <span class="ruby-ivar">@bcftools</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">:bcftools</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>)),<span class="ruby-string">&#39;sam&#39;</span>,<span class="ruby-string">&#39;external&#39;</span>,<span class="ruby-string">&#39;bcftools&#39;</span>)
318
+
319
+ <span class="ruby-ivar">@files</span> = [<span class="ruby-ivar">@files</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">String</span>)
320
+
321
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-keyword">nil</span>
322
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;Need Fasta and at least one BAM or SAM&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@fasta</span> <span class="ruby-keyword">or</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@bam</span>
323
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-string">&quot;File not found&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">files_ok?</span>
324
+ <span class="ruby-ivar">@bams</span> = [<span class="ruby-ivar">@bams</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@bams</span>.<span class="ruby-identifier">instance_of?</span> <span class="ruby-constant">String</span>
325
+
326
+ <span class="ruby-keyword">end</span></pre>
327
+ </div>
328
+
329
+ </div>
330
+
331
+
332
+
333
+
334
+ </div>
335
+
336
+
337
+ </section>
338
+
339
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
340
+ <header>
341
+ <h3>Public Instance Methods</h3>
342
+ </header>
343
+
344
+
345
+ <div id="method-i-average_coverage" class="method-detail ">
346
+
347
+ <div class="method-heading">
348
+ <span class="method-name">average_coverage</span><span
349
+ class="method-args">(chr,start,length)</span>
350
+
351
+ <span class="method-click-advice">click to toggle source</span>
352
+
353
+ </div>
354
+
355
+
356
+ <div class="method-description">
357
+
358
+ <p>returns the average coverage over the region queried</p>
359
+ <ul><li>
360
+ <p>chr - the reference name</p>
361
+ </li><li>
362
+ <p>start - the start position</p>
363
+ </li><li>
364
+ <p>length - the length of the region queried</p>
365
+ </li></ul>
366
+
367
+
368
+
369
+
370
+ <div class="method-source-code" id="average_coverage-source">
371
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 167</span>
372
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">average_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>)
373
+ <span class="ruby-identifier">arr</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">chromosome_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>)
374
+ <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">inject</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">el</span> }.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">size</span>
375
+ <span class="ruby-keyword">end</span></pre>
376
+ </div>
377
+
378
+ </div>
379
+
380
+
381
+
382
+
383
+ </div>
384
+
385
+
386
+ <div id="method-i-calmd" class="method-detail ">
387
+
388
+ <div class="method-heading">
389
+ <span class="method-name">calmd</span><span
390
+ class="method-args">(opts={}, &block)</span>
391
+
392
+ <span class="method-click-advice">click to toggle source</span>
393
+
394
+ </div>
395
+
396
+
397
+ <div class="method-description">
398
+
399
+ <p>Generate the MD tag. If the MD tag is already present, this command will
400
+ give a warning if the MD tag generated is different from the existing tag.
401
+ Output SAM by default.</p>
402
+ <ul><li>
403
+ <p>A - When used jointly with -r this option overwrites the original base
404
+ quality.</p>
405
+ </li><li>
406
+ <p>e - Convert a the read base to = if it is identical to the aligned
407
+ reference base. Indel caller does not support the = bases at the moment.</p>
408
+ </li><li>
409
+ <p>u - Output uncompressed BAM</p>
410
+ </li><li>
411
+ <p>b - Output compressed BAM</p>
412
+ </li><li>
413
+ <p>S - The input is SAM with header lines</p>
414
+ </li><li>
415
+ <p>C - [INT] Coefficient to cap mapping quality of poorly mapped reads. See
416
+ the pileup command for details. [0]</p>
417
+ </li><li>
418
+ <p>r - Compute the BQ tag (without -A) or cap base quality by BAQ (with -A).</p>
419
+ </li><li>
420
+ <p>E - Extended BAQ calculation. This option trades specificity for
421
+ sensitivity, though the effect is minor.</p>
422
+ </li></ul>
423
+
424
+
425
+
426
+
427
+ <div class="method-source-code" id="calmd-source">
428
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 492</span>
429
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">calmd</span>(<span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
430
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">&quot;calmd&quot;</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:E</span>, <span class="ruby-value">:e</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:b</span>, <span class="ruby-value">:S</span>, <span class="ruby-value">:r</span>] )<span class="ruby-operator">+</span> <span class="ruby-string">&quot; &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@fasta</span>
431
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
432
+ <span class="ruby-identifier">type</span> = <span class="ruby-value">:text</span>
433
+ <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">Alignment</span>
434
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">type</span>, <span class="ruby-keyword">true</span>, <span class="ruby-string">&quot;@&quot;</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
435
+ <span class="ruby-keyword">end</span></pre>
436
+ </div>
437
+
438
+ </div>
439
+
440
+
441
+
442
+
443
+ </div>
444
+
445
+
446
+ <div id="method-i-cat" class="method-detail ">
447
+
448
+ <div class="method-heading">
449
+ <span class="method-name">cat</span><span
450
+ class="method-args">(opts={})</span>
451
+
452
+ <span class="method-click-advice">click to toggle source</span>
453
+
454
+ </div>
455
+
456
+
457
+ <div class="method-description">
458
+
459
+ <p>Concatenate BAMs. The sequence dictionary of each input BAM must be
460
+ identical.</p>
461
+ <ul><li>
462
+ <p>h - header.sam</p>
463
+ </li><li>
464
+ <p>out -[FILE] out file name</p>
465
+ </li><li>
466
+ <p>bams -[FILES] or <a href="Sam.html">Bio::DB::Sam</a> list of input bams, or
467
+ <a href="Sam.html">Bio::DB::Sam</a> objects</p>
468
+ </li></ul>
469
+
470
+
471
+
472
+
473
+ <div class="method-source-code" id="cat-source">
474
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 383</span>
475
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">cat</span>(<span class="ruby-identifier">opts</span>={})
476
+ <span class="ruby-identifier">out</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
477
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:out</span>)
478
+
479
+ <span class="ruby-identifier">bam_list</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bams</span>].<span class="ruby-identifier">collect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
480
+ <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bam</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">b</span>
481
+ <span class="ruby-keyword">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
482
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:bams</span>)
483
+ <span class="ruby-identifier">options</span> = <span class="ruby-identifier">commandify</span>(<span class="ruby-identifier">opts</span>, [<span class="ruby-value">:h</span>] )
484
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} cat #{options} -o #{out} #{bam_list}&quot;</span>
485
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">command</span>
486
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
487
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
488
+
489
+ <span class="ruby-keyword">end</span></pre>
490
+ </div>
491
+
492
+ </div>
493
+
494
+
495
+
496
+
497
+ </div>
498
+
499
+
500
+ <div id="method-i-chromosome_coverage" class="method-detail ">
501
+
502
+ <div class="method-heading">
503
+ <span class="method-name">chromosome_coverage</span><span
504
+ class="method-args">(chr,start,length)</span>
505
+
506
+ <span class="method-click-advice">click to toggle source</span>
507
+
508
+ </div>
509
+
510
+
511
+ <div class="method-description">
512
+
513
+ <p>returns an array of coverage for each location for which there are mapped
514
+ reads</p>
515
+ <ul><li>
516
+ <p>chr - the reference name</p>
517
+ </li><li>
518
+ <p>start - the start position</p>
519
+ </li><li>
520
+ <p>length - the length of the region queried</p>
521
+ </li></ul>
522
+
523
+
524
+
525
+
526
+ <div class="method-source-code" id="chromosome_coverage-source">
527
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 102</span>
528
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">chromosome_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>)
529
+ <span class="ruby-identifier">result</span> = []
530
+ <span class="ruby-identifier">region</span> = <span class="ruby-node">&quot;#{chr}:#{start}-#{start + length}&quot;</span>
531
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">mpileup</span>(<span class="ruby-value">:r</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">region</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
532
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">coverage</span>
533
+ <span class="ruby-keyword">end</span>
534
+ <span class="ruby-identifier">result</span>
535
+ <span class="ruby-keyword">end</span></pre>
536
+ </div>
537
+
538
+ </div>
539
+
540
+
541
+
542
+
543
+ </div>
544
+
545
+
546
+ <div id="method-i-depth" class="method-detail ">
547
+
548
+ <div class="method-heading">
549
+ <span class="method-name">depth</span><span
550
+ class="method-args">(opts={}) { |split(/\t/)| ... }</span>
551
+
552
+ <span class="method-click-advice">click to toggle source</span>
553
+
554
+ </div>
555
+
556
+
557
+ <div class="method-description">
558
+
559
+ <p>returns an array for each position with [sequence_name, position, depth]</p>
560
+ <ul><li>
561
+ <p>b - list of positions or regions in BED format</p>
562
+ </li><li>
563
+ <p>l - [INT] minQLen</p>
564
+ </li><li>
565
+ <p>q - [INT] base quality threshold</p>
566
+ </li><li>
567
+ <p>Q - [INT] mapping quality threshold</p>
568
+ </li><li>
569
+ <p>r - [chr:from-to] region</p>
570
+ </li></ul>
571
+
572
+
573
+
574
+
575
+ <div class="method-source-code" id="depth-source">
576
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 538</span>
577
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">depth</span>(<span class="ruby-identifier">opts</span>={})
578
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">&quot;depth&quot;</span>, <span class="ruby-identifier">opts</span>)
579
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
580
+ <span class="ruby-comment">#puts command</span>
581
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">String</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
582
+ <span class="ruby-keyword">yield</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\t/</span>)
583
+ <span class="ruby-keyword">end</span>
584
+
585
+ <span class="ruby-keyword">end</span></pre>
586
+ </div>
587
+
588
+ </div>
589
+
590
+
591
+
592
+
593
+ </div>
594
+
595
+
596
+ <div id="method-i-faidx" class="method-detail ">
597
+
598
+ <div class="method-heading">
599
+ <span class="method-name">faidx</span><span
600
+ class="method-args">(opts={})</span>
601
+
602
+ <span class="method-click-advice">click to toggle source</span>
603
+
604
+ </div>
605
+
606
+
607
+ <div class="method-description">
608
+
609
+ <p>Index reference sequence in the FASTA format or extract subsequence from
610
+ indexed reference sequence. If no region is specified, faidx will index the
611
+ file and create &lt;ref.fasta&gt;.fai on the disk. If regions are
612
+ speficified, the subsequences will be retrieved and printed to stdout in
613
+ the FASTA format. Options - if a subsequence is required</p>
614
+ <ul><li>
615
+ <p>chr - [STRING] the reference name of the subsequence</p>
616
+ </li><li>
617
+ <p>start - [INT] the start position for the subsequence</p>
618
+ </li><li>
619
+ <p>stop - [INT] the stop position for the subsequence</p>
620
+ </li></ul>
621
+
622
+
623
+
624
+
625
+ <div class="method-source-code" id="faidx-source">
626
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 275</span>
627
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">faidx</span>(<span class="ruby-identifier">opts</span>={})
628
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:chr</span>) <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:start</span>) <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:stop</span>)
629
+ <span class="ruby-identifier">opts</span>={<span class="ruby-value">:as_bio</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>}
630
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">fetch_reference</span>(<span class="ruby-value">:chr</span>,<span class="ruby-value">:start</span>,<span class="ruby-value">:stop</span>,<span class="ruby-identifier">opts</span>)
631
+ <span class="ruby-keyword">else</span>
632
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} faidx #{@fasta}&quot;</span>
633
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
634
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
635
+ <span class="ruby-keyword">end</span>
636
+ <span class="ruby-keyword">end</span></pre>
637
+ </div>
638
+
639
+ </div>
640
+
641
+
642
+
643
+
644
+ </div>
645
+
646
+
647
+ <div id="method-i-fetch" class="method-detail ">
648
+
649
+ <div class="method-heading">
650
+ <span class="method-name">fetch</span><span
651
+ class="method-args">(chr, start,stop, &block)</span>
652
+
653
+ <span class="method-click-advice">click to toggle source</span>
654
+
655
+ </div>
656
+
657
+
658
+ <div class="method-description">
659
+
660
+ <p>fetches a subsequence and calls code block</p>
661
+ <ul><li>
662
+ <p>chr - the reference name for the subsequence</p>
663
+ </li><li>
664
+ <p>start - the start position for the subsequence</p>
665
+ </li><li>
666
+ <p>stop - the stop position for the subsequence</p>
667
+ </li><li>
668
+ <p>&amp;block - the the block of code to execute</p>
669
+ </li></ul>
670
+
671
+
672
+
673
+
674
+ <div class="method-source-code" id="fetch-source">
675
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 87</span>
676
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">chr</span>, <span class="ruby-identifier">start</span>,<span class="ruby-identifier">stop</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
677
+ <span class="ruby-identifier">view</span>(
678
+ <span class="ruby-value">:chr</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">chr</span>,
679
+ <span class="ruby-value">:start</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">start</span>,
680
+ <span class="ruby-value">:stop</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">stop</span>,
681
+ <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
682
+ )
683
+ <span class="ruby-keyword">end</span></pre>
684
+ </div>
685
+
686
+ </div>
687
+
688
+
689
+ <div class="aliases">
690
+ Also aliased as: <a href="Sam.html#method-i-fetch_with_function">fetch_with_function</a>
691
+ </div>
692
+
693
+
694
+
695
+ </div>
696
+
697
+
698
+ <div id="method-i-fetch_reference" class="method-detail ">
699
+
700
+ <div class="method-heading">
701
+ <span class="method-name">fetch_reference</span><span
702
+ class="method-args">(chr,start,stop, opts={:as_bio => false})</span>
703
+
704
+ <span class="method-click-advice">click to toggle source</span>
705
+
706
+ </div>
707
+
708
+
709
+ <div class="method-description">
710
+
711
+ <p>fetches a subsequence from a reference genome and option returns it as a
712
+ Bio::Sequence::NA object</p>
713
+ <ul><li>
714
+ <p>chr - [STRING] the reference name for the subsequence</p>
715
+ </li><li>
716
+ <p>start - [INT] the start position for the subsequence</p>
717
+ </li><li>
718
+ <p>stop - [INT] the stop position for the subsequence</p>
719
+ </li><li>
720
+ <p>as_bio - boolean stating if the returned object should be a
721
+ Bio::Sequence::NA object</p>
722
+ </li></ul>
723
+
724
+
725
+
726
+
727
+ <div class="method-source-code" id="fetch_reference-source">
728
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 258</span>
729
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch_reference</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">stop</span>, <span class="ruby-identifier">opts</span>={<span class="ruby-value">:as_bio</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>})
730
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} faidx #{@fasta} #{chr}:#{start}-#{stop}&quot;</span>
731
+ <span class="ruby-comment">#puts command</span>
732
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
733
+ <span class="ruby-identifier">seq</span> = <span class="ruby-string">&quot;&quot;</span>
734
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">String</span>, <span class="ruby-value">:text</span> ) {<span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">seq</span> = <span class="ruby-identifier">seq</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^&gt;/</span>}
735
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:as_bio</span>]
736
+ <span class="ruby-identifier">seq</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Sequence</span><span class="ruby-operator">::</span><span class="ruby-constant">NA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">seq</span>).<span class="ruby-identifier">to_fasta</span>(<span class="ruby-node">&quot;#{chr}:#{start}-#{stop}&quot;</span>)
737
+ <span class="ruby-keyword">end</span>
738
+ <span class="ruby-identifier">seq</span>
739
+ <span class="ruby-keyword">end</span></pre>
740
+ </div>
741
+
742
+ </div>
743
+
744
+
745
+
746
+
747
+ </div>
748
+
749
+
750
+ <div id="method-i-fetch_with_function" class="method-detail method-alias">
751
+
752
+ <div class="method-heading">
753
+ <span class="method-name">fetch_with_function</span><span
754
+ class="method-args">(chr, start,stop, &block)</span>
755
+
756
+ </div>
757
+
758
+
759
+ <div class="method-description">
760
+
761
+
762
+
763
+
764
+
765
+
766
+ </div>
767
+
768
+
769
+
770
+
771
+ <div class="aliases">
772
+ Alias for: <a href="Sam.html#method-i-fetch">fetch</a>
773
+ </div>
774
+
775
+ </div>
776
+
777
+
778
+ <div id="method-i-fix_mates" class="method-detail ">
779
+
780
+ <div class="method-heading">
781
+ <span class="method-name">fix_mates</span><span
782
+ class="method-args">(opts={})</span>
783
+
784
+ <span class="method-click-advice">click to toggle source</span>
785
+
786
+ </div>
787
+
788
+
789
+ <div class="method-description">
790
+
791
+ <p>Fill in mate coordinates, ISIZE and mate related flags from a name-sorted
792
+ alignment</p>
793
+ <ul><li>
794
+ <p>out_bam name of outfile</p>
795
+ </li><li>
796
+ <p>r - remove unmapped reads and secondary alignments</p>
797
+ </li></ul>
798
+
799
+
800
+
801
+
802
+ <div class="method-source-code" id="fix_mates-source">
803
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 298</span>
804
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">fix_mates</span>(<span class="ruby-identifier">opts</span>={})
805
+ <span class="ruby-comment">#opts.merge!({:out_index=&gt;nil})</span>
806
+ <span class="ruby-identifier">remove_reads</span> = <span class="ruby-string">&quot;&quot;</span>
807
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:r</span>]
808
+ <span class="ruby-identifier">remove_reads</span> = <span class="ruby-string">&quot;-r&quot;</span>
809
+ <span class="ruby-keyword">end</span>
810
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} fixmate #{remove_reads} #{@bam} #{opts[:out_bam]}&quot;</span>
811
+ <span class="ruby-comment">#puts command</span>
812
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
813
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
814
+ <span class="ruby-keyword">end</span></pre>
815
+ </div>
816
+
817
+ </div>
818
+
819
+
820
+ <div class="aliases">
821
+ Also aliased as: <a href="Sam.html#method-i-fixmate">fixmate</a>
822
+ </div>
823
+
824
+
825
+
826
+ </div>
827
+
828
+
829
+ <div id="method-i-fixmate" class="method-detail method-alias">
830
+
831
+ <div class="method-heading">
832
+ <span class="method-name">fixmate</span><span
833
+ class="method-args">(opts={})</span>
834
+
835
+ </div>
836
+
837
+
838
+ <div class="method-description">
839
+
840
+
841
+
842
+
843
+
844
+
845
+ </div>
846
+
847
+
848
+
849
+
850
+ <div class="aliases">
851
+ Alias for: <a href="Sam.html#method-i-fix_mates">fix_mates</a>
852
+ </div>
853
+
854
+ </div>
855
+
856
+
857
+ <div id="method-i-flag_stats" class="method-detail ">
858
+
859
+ <div class="method-heading">
860
+ <span class="method-name">flag_stats</span><span
861
+ class="method-args">(opts={})</span>
862
+
863
+ <span class="method-click-advice">click to toggle source</span>
864
+
865
+ </div>
866
+
867
+
868
+ <div class="method-description">
869
+
870
+ <p>generate simple stats with regard to the number and pairing of reads mapped
871
+ to a reference</p>
872
+
873
+
874
+
875
+
876
+ <div class="method-source-code" id="flag_stats-source">
877
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 313</span>
878
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">flag_stats</span>(<span class="ruby-identifier">opts</span>={})
879
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">&quot;flagstat&quot;</span>, <span class="ruby-identifier">opts</span>, [])
880
+ <span class="ruby-comment">#puts command</span>
881
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
882
+ <span class="ruby-identifier">strings</span> = []
883
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>,<span class="ruby-constant">String</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">strings</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>}
884
+ <span class="ruby-identifier">strings</span>
885
+ <span class="ruby-keyword">end</span></pre>
886
+ </div>
887
+
888
+ </div>
889
+
890
+
891
+ <div class="aliases">
892
+ Also aliased as: <a href="Sam.html#method-i-flagstat">flagstat</a>
893
+ </div>
894
+
895
+
896
+
897
+ </div>
898
+
899
+
900
+ <div id="method-i-flagstat" class="method-detail method-alias">
901
+
902
+ <div class="method-heading">
903
+ <span class="method-name">flagstat</span><span
904
+ class="method-args">(opts={})</span>
905
+
906
+ </div>
907
+
908
+
909
+ <div class="method-description">
910
+
911
+
912
+
913
+
914
+
915
+
916
+ </div>
917
+
918
+
919
+
920
+
921
+ <div class="aliases">
922
+ Alias for: <a href="Sam.html#method-i-flag_stats">flag_stats</a>
923
+ </div>
924
+
925
+ </div>
926
+
927
+
928
+ <div id="method-i-idxstats" class="method-detail method-alias">
929
+
930
+ <div class="method-heading">
931
+ <span class="method-name">idxstats</span><span
932
+ class="method-args">()</span>
933
+
934
+ </div>
935
+
936
+
937
+ <div class="method-description">
938
+
939
+
940
+
941
+
942
+
943
+
944
+ </div>
945
+
946
+
947
+
948
+
949
+ <div class="aliases">
950
+ Alias for: <a href="Sam.html#method-i-index_stats">index_stats</a>
951
+ </div>
952
+
953
+ </div>
954
+
955
+
956
+ <div id="method-i-index" class="method-detail ">
957
+
958
+ <div class="method-heading">
959
+ <span class="method-name">index</span><span
960
+ class="method-args">(opts={})</span>
961
+
962
+ <span class="method-click-advice">click to toggle source</span>
963
+
964
+ </div>
965
+
966
+
967
+ <div class="method-description">
968
+
969
+ <p>Index sorted alignment for fast random access. Index file
970
+ &lt;aln.bam&gt;.bai will be created of no out_index is provided.</p>
971
+ <ul><li>
972
+ <p>out_index - [STRING] name of index</p>
973
+ </li></ul>
974
+
975
+
976
+
977
+
978
+ <div class="method-source-code" id="index-source">
979
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 288</span>
980
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">opts</span>={})
981
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} index #{@bam} #{opts[:out_index]}&quot;</span>
982
+ <span class="ruby-comment">#puts command</span>
983
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
984
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
985
+ <span class="ruby-keyword">end</span></pre>
986
+ </div>
987
+
988
+ </div>
989
+
990
+
991
+
992
+
993
+ </div>
994
+
995
+
996
+ <div id="method-i-index_stats" class="method-detail ">
997
+
998
+ <div class="method-heading">
999
+ <span class="method-name">index_stats</span><span
1000
+ class="method-args">()</span>
1001
+
1002
+ <span class="method-click-advice">click to toggle source</span>
1003
+
1004
+ </div>
1005
+
1006
+
1007
+ <div class="method-description">
1008
+
1009
+ <p>Retrieve and print stats in the index file. The output is TAB delimited
1010
+ with each line consisting of reference sequence name, sequence length,
1011
+ number of mapped reads and number unmapped reads.</p>
1012
+
1013
+
1014
+
1015
+
1016
+ <div class="method-source-code" id="index_stats-source">
1017
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 325</span>
1018
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">index_stats</span>
1019
+ <span class="ruby-identifier">stats</span> = {}
1020
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-node">&quot;idxstats #{@bam}&quot;</span>, {}, [])
1021
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1022
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">String</span>, <span class="ruby-value">:text</span>, <span class="ruby-keyword">true</span>, <span class="ruby-node">&quot;#&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
1023
+ <span class="ruby-identifier">info</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\t/</span>)
1024
+ <span class="ruby-identifier">stats</span>[ <span class="ruby-identifier">info</span>[<span class="ruby-value">0</span>] ] = {<span class="ruby-value">:length</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">:mapped_reads</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">:unmapped_reads</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">info</span>[<span class="ruby-value">3</span>].<span class="ruby-identifier">to_i</span> }
1025
+ <span class="ruby-keyword">end</span>
1026
+ <span class="ruby-identifier">stats</span>
1027
+ <span class="ruby-keyword">end</span></pre>
1028
+ </div>
1029
+
1030
+ </div>
1031
+
1032
+
1033
+ <div class="aliases">
1034
+ Also aliased as: <a href="Sam.html#method-i-idxstats">idxstats</a>
1035
+ </div>
1036
+
1037
+
1038
+
1039
+ </div>
1040
+
1041
+
1042
+ <div id="method-i-merge" class="method-detail ">
1043
+
1044
+ <div class="method-heading">
1045
+ <span class="method-name">merge</span><span
1046
+ class="method-args">(opts={})</span>
1047
+
1048
+ <span class="method-click-advice">click to toggle source</span>
1049
+
1050
+ </div>
1051
+
1052
+
1053
+ <div class="method-description">
1054
+
1055
+ <p>Merge multiple sorted alignments</p>
1056
+ <ul><li>
1057
+ <p>n - sort by read names</p>
1058
+ </li><li>
1059
+ <p>r - attach RG tag (inferred from file names)</p>
1060
+ </li><li>
1061
+ <p>u - uncompressed BAM output</p>
1062
+ </li><li>
1063
+ <p>f - overwrite the output BAM if exist</p>
1064
+ </li><li>
1065
+ <p>one - compress level 1</p>
1066
+ </li><li>
1067
+ <p>l - [INT] compression level, from 0 to 9 [-1]</p>
1068
+ </li><li>
1069
+ <p>at - [INT] number of BAM compression threads [0]</p>
1070
+ </li><li>
1071
+ <p>R - [STRING] merge file in the specified region STR [all]</p>
1072
+ </li><li>
1073
+ <p>h - [FILE] copy the header in FILE to &lt;out.bam&gt; [in1.bam]</p>
1074
+ </li><li>
1075
+ <p>out - [FILE] out file name</p>
1076
+ </li><li>
1077
+ <p>bams - [FILES] or <a href="Sam.html">Bio::DB::Sam</a> list of input bams,
1078
+ or <a href="Sam.html">Bio::DB::Sam</a> objects</p>
1079
+ </li></ul>
1080
+
1081
+
1082
+
1083
+
1084
+ <div class="method-source-code" id="merge-source">
1085
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 350</span>
1086
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>={})
1087
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:one</span>]
1088
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;1&#39;</span>] = <span class="ruby-keyword">nil</span>
1089
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:one</span>)
1090
+ <span class="ruby-keyword">end</span>
1091
+
1092
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
1093
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;@&#39;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
1094
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:at</span>)
1095
+ <span class="ruby-keyword">end</span>
1096
+
1097
+ <span class="ruby-identifier">out</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
1098
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:out</span>)
1099
+
1100
+ <span class="ruby-identifier">bam_list</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bams</span>].<span class="ruby-identifier">collect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
1101
+ <span class="ruby-identifier">b</span>.<span class="ruby-identifier">bam</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">b</span>
1102
+ <span class="ruby-keyword">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
1103
+
1104
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:bams</span>)
1105
+ <span class="ruby-identifier">options</span> = <span class="ruby-identifier">commandify</span>(<span class="ruby-identifier">opts</span>, [<span class="ruby-value">:n</span>, <span class="ruby-value">:r</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:f</span>, <span class="ruby-string">&#39;1&#39;</span>] )
1106
+ <span class="ruby-comment">#command = &quot;#{form_opt_string(@samtools, &quot;merge&quot;, opts, [:n, :r, :u, :f, &#39;1&#39;] )} #{out} #{bam_list}&quot;</span>
1107
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} merge #{options} #{out} #{bam_list}&quot;</span>
1108
+
1109
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1110
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">command</span>
1111
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1112
+
1113
+ <span class="ruby-keyword">end</span></pre>
1114
+ </div>
1115
+
1116
+ </div>
1117
+
1118
+
1119
+
1120
+
1121
+ </div>
1122
+
1123
+
1124
+ <div id="method-i-mpileup" class="method-detail ">
1125
+
1126
+ <div class="method-heading">
1127
+ <span class="method-name">mpileup</span><span
1128
+ class="method-args">(opts={}, &block)</span>
1129
+
1130
+ <span class="method-click-advice">click to toggle source</span>
1131
+
1132
+ </div>
1133
+
1134
+
1135
+ <div class="method-description">
1136
+
1137
+ <p>returns a <a href="Pileup.html">Bio::DB::Pileup</a> or Bio::DB::VCF object</p>
1138
+ <ul><li>
1139
+ <p>region - Only generate pileup in region [chrom:start-stop]</p>
1140
+ </li><li>
1141
+ <p>illumina_quals - Assume the quality is in the Illumina 1.3+ encoding</p>
1142
+ </li><li>
1143
+ <p>count_anomalous - Do not skip anomalous read pairs in variant calling</p>
1144
+ </li><li>
1145
+ <p>no_baq - Disable probabilistic realignment for the computation of base
1146
+ alignment quality (BAQ). BAQ is the Phred-scaled probability of a read base
1147
+ being misaligned. Applying this option greatly helps to reduce false SNPs
1148
+ caused by misalignments.</p>
1149
+ </li><li>
1150
+ <p>adjust_mapq - [INT] Coefficient for downgrading mapping quality for reads
1151
+ containing excessive mismatches. Given a read with a phred-scaled
1152
+ probability q of being generated from the mapped position, the new mapping
1153
+ quality is about sqrt((INT-q)/INT)*INT. A zero value disables this
1154
+ functionality; if enabled, the recommended value for BWA is 50. [0]</p>
1155
+ </li><li>
1156
+ <p>max_per_bam_depth - [INT] At a position, read maximally INT reads per input
1157
+ BAM. [250]</p>
1158
+ </li><li>
1159
+ <p>extended_baq - Extended BAQ computation. This option helps sensitivity
1160
+ especially for MNPs, but may hurt specificity a little bit.</p>
1161
+ </li><li>
1162
+ <p>exclude_reads_file - [FILE] exclude read groups listed in FILE [null]</p>
1163
+ </li><li>
1164
+ <p>list_of_positions - [FILE] BED or position list file containing a list of
1165
+ regions or sites where pileup or BCF should be generated [null]</p>
1166
+ </li><li>
1167
+ <p>mapping_quality_cap - [INT] cap mapping quality at INT [60]</p>
1168
+ </li><li>
1169
+ <p>ignore_rg - ignore read group tags</p>
1170
+ </li><li>
1171
+ <p>min_mapping_quality - [INT] skip alignments with mapQ smaller than INT [0]</p>
1172
+ </li><li>
1173
+ <p>min_base_quality - [INT] skip bases with baseQ/BAQ smaller than INT [13]</p>
1174
+ </li><li>
1175
+ <p>##following options are for the -g -u option</p>
1176
+ </li><li>
1177
+ <p>genotype_calling - generate BCF output (genotype likelihoods)</p>
1178
+ </li><li>
1179
+ <p>uncompressed_bcf - generate uncompress BCF output</p>
1180
+ </li><li>
1181
+ <p>extension_sequencing_probability - [INT] Phred-scaled gap extension seq
1182
+ error probability [20]</p>
1183
+ </li><li>
1184
+ <p>homopolymer_error_coefficient - [INT] coefficient for homopolymer errors
1185
+ [100]</p>
1186
+ </li><li>
1187
+ <p>no_indels - do not perform indel calling</p>
1188
+ </li><li>
1189
+ <p>skip_indel_over_average_depth - [INT] max per-sample depth for INDEL
1190
+ calling [250]</p>
1191
+ </li><li>
1192
+ <p>gap_open_sequencing_error_probability - [INT] Phred-scaled gap open
1193
+ sequencing error probability [40]</p>
1194
+ </li><li>
1195
+ <p>platforms - [STRING] comma separated list of platforms for indels [all]</p>
1196
+ </li></ul>
1197
+
1198
+
1199
+
1200
+
1201
+ <div class="method-source-code" id="mpileup-source">
1202
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 195</span>
1203
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">mpileup</span>(<span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1204
+ <span class="ruby-comment">#long option form to short samtools form..</span>
1205
+ <span class="ruby-identifier">long_opts</span> = {
1206
+ <span class="ruby-value">:region</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:r</span>,
1207
+ <span class="ruby-value">:illumina_quals</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:six</span>,
1208
+ <span class="ruby-value">:count_anomalous</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:A</span>,
1209
+ <span class="ruby-value">:no_baq</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:B</span>,
1210
+ <span class="ruby-value">:adjust_mapq</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:C</span>,
1211
+ <span class="ruby-value">:max_per_bam_depth</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:d</span>,
1212
+ <span class="ruby-value">:extended_baq</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:E</span>,
1213
+ <span class="ruby-value">:exclude_reads_file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:G</span>,
1214
+ <span class="ruby-value">:list_of_positions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:l</span>,
1215
+ <span class="ruby-value">:mapping_quality_cap</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:M</span>,
1216
+ <span class="ruby-value">:ignore_rg</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:R</span>,
1217
+ <span class="ruby-value">:min_mapping_quality</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:q</span>,
1218
+ <span class="ruby-value">:min_base_quality</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:Q</span>,
1219
+ <span class="ruby-comment">###following options are for the -g -u option</span>
1220
+ <span class="ruby-value">:genotype_calling</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:g</span>,
1221
+ <span class="ruby-value">:uncompressed_bcf</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:u</span>,
1222
+ <span class="ruby-value">:extension_sequencing_probability</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:e</span>,
1223
+ <span class="ruby-value">:homopolymer_error_coefficient</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:h</span>,
1224
+ <span class="ruby-value">:no_indels</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:I</span>,
1225
+ <span class="ruby-value">:skip_indel_over_average_depth</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:L</span>,
1226
+ <span class="ruby-value">:gap_open_sequencing_error_probability</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:o</span>,
1227
+ <span class="ruby-value">:platforms</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:P</span>
1228
+ }
1229
+
1230
+ <span class="ruby-comment">##convert any long_opts to short opts </span>
1231
+ <span class="ruby-identifier">temp_opts</span> = <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">dup</span>
1232
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
1233
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">long_opts</span>[<span class="ruby-identifier">k</span>]
1234
+ <span class="ruby-identifier">temp_opts</span>[<span class="ruby-identifier">long_opts</span>[<span class="ruby-identifier">k</span>]] = <span class="ruby-identifier">v</span>
1235
+ <span class="ruby-identifier">temp_opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>)
1236
+ <span class="ruby-keyword">end</span>
1237
+ <span class="ruby-keyword">end</span>
1238
+ <span class="ruby-identifier">opts</span> = <span class="ruby-identifier">temp_opts</span>
1239
+ <span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>] = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:g</span>] <span class="ruby-comment">#so that we always get uncompressed output</span>
1240
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:g</span>)
1241
+
1242
+ <span class="ruby-identifier">opts</span>[<span class="ruby-value">:f</span>] = <span class="ruby-ivar">@fasta</span>
1243
+
1244
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:six</span>]
1245
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&quot;6&quot;</span>] = <span class="ruby-keyword">nil</span>
1246
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:six</span>)
1247
+ <span class="ruby-keyword">end</span>
1248
+
1249
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">&quot;mpileup&quot;</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:R</span>, <span class="ruby-value">:B</span>, <span class="ruby-value">:E</span>, <span class="ruby-string">&quot;6&quot;</span>, <span class="ruby-value">:A</span>, <span class="ruby-value">:g</span>, <span class="ruby-value">:u</span>, <span class="ruby-value">:I</span>] )
1250
+
1251
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>]
1252
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">command</span> <span class="ruby-operator">+</span> <span class="ruby-node">&quot; | #{@bcftools} view -cg -&quot;</span>
1253
+ <span class="ruby-keyword">end</span>
1254
+
1255
+ <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>] <span class="ruby-operator">?</span> <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">Vcf</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">Pileup</span>
1256
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1257
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-value">:text</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1258
+
1259
+ <span class="ruby-keyword">end</span></pre>
1260
+ </div>
1261
+
1262
+ </div>
1263
+
1264
+
1265
+
1266
+
1267
+ </div>
1268
+
1269
+
1270
+ <div id="method-i-open" class="method-detail ">
1271
+
1272
+ <div class="method-heading">
1273
+ <span class="method-name">open</span><span
1274
+ class="method-args">()</span>
1275
+
1276
+ <span class="method-click-advice">click to toggle source</span>
1277
+
1278
+ </div>
1279
+
1280
+
1281
+ <div class="method-description">
1282
+
1283
+ <p>backward compatibility method, returns true if file exists otherwise,
1284
+ complains and quits.</p>
1285
+
1286
+
1287
+
1288
+
1289
+ <div class="method-source-code" id="open-source">
1290
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 29</span>
1291
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">open</span>
1292
+ <span class="ruby-identifier">files_ok?</span>
1293
+ <span class="ruby-keyword">end</span></pre>
1294
+ </div>
1295
+
1296
+ </div>
1297
+
1298
+
1299
+
1300
+
1301
+ </div>
1302
+
1303
+
1304
+ <div id="method-i-phase" class="method-detail ">
1305
+
1306
+ <div class="method-heading">
1307
+ <span class="method-name">phase</span><span
1308
+ class="method-args">(opts={})</span>
1309
+
1310
+ <span class="method-click-advice">click to toggle source</span>
1311
+
1312
+ </div>
1313
+
1314
+
1315
+ <div class="method-description">
1316
+
1317
+ <p>Call and phase heterozygous SNPs</p>
1318
+ <ul><li>
1319
+ <p>A - Drop reads with ambiguous phase.</p>
1320
+ </li><li>
1321
+ <p>b - [STR] Prefix of BAM output. When this option is in use, phase-0 reads
1322
+ will be saved in file STR.0.bam and phase-1 reads in STR.1.bam. Phase
1323
+ unknown reads will be randomly allocated to one of the two files. Chimeric
1324
+ reads with switch errors will be saved in STR.chimeric.bam. [null]</p>
1325
+ </li><li>
1326
+ <p>F - Do not attempt to fix chimeric reads.</p>
1327
+ </li><li>
1328
+ <p>k - [INT] Maximum length for local phasing. [13]</p>
1329
+ </li><li>
1330
+ <p>q - [INT] Minimum Phred-scaled LOD to call a heterozygote. [40]</p>
1331
+ </li><li>
1332
+ <p>Q - [INT] Minimum base quality to be used in het calling. [13]</p>
1333
+ </li></ul>
1334
+
1335
+
1336
+
1337
+
1338
+ <div class="method-source-code" id="phase-source">
1339
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 525</span>
1340
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">phase</span>(<span class="ruby-identifier">opts</span>={})
1341
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{form_opt_string(@samtools, &quot;phase&quot;, opts, [:A, :F] )}&quot;</span>
1342
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1343
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1344
+ <span class="ruby-keyword">end</span></pre>
1345
+ </div>
1346
+
1347
+ </div>
1348
+
1349
+
1350
+
1351
+
1352
+ </div>
1353
+
1354
+
1355
+ <div id="method-i-plot_chromosome_coverage" class="method-detail ">
1356
+
1357
+ <div class="method-heading">
1358
+ <span class="method-name">plot_chromosome_coverage</span><span
1359
+ class="method-args">(chr,start,length, opts={})</span>
1360
+
1361
+ <span class="method-click-advice">click to toggle source</span>
1362
+
1363
+ </div>
1364
+
1365
+
1366
+ <div class="method-description">
1367
+
1368
+ <p>returns an array of coverage for each location for which there are mapped
1369
+ reads</p>
1370
+ <ul><li>
1371
+ <p>chr - the reference name</p>
1372
+ </li><li>
1373
+ <p>start - the start position</p>
1374
+ </li><li>
1375
+ <p>length - the length of the region queried</p>
1376
+ </li></ul>
1377
+
1378
+ <p>OPTIONS</p>
1379
+ <ul><li>
1380
+ <p>bin - the amount of bins to split the histogram into. A mean score for each
1381
+ bin will be plotted. [default 30 bins]</p>
1382
+ </li><li>
1383
+ <p>svg - a file to write the svg image to [default a String object containing
1384
+ the SVG]</p>
1385
+ </li></ul>
1386
+
1387
+
1388
+
1389
+
1390
+ <div class="method-source-code" id="plot_chromosome_coverage-source">
1391
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 119</span>
1392
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">plot_chromosome_coverage</span>(<span class="ruby-identifier">chr</span>,<span class="ruby-identifier">start</span>,<span class="ruby-identifier">length</span>, <span class="ruby-identifier">opts</span>={})
1393
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:bin</span>]
1394
+ <span class="ruby-identifier">bin</span> = <span class="ruby-identifier">length</span><span class="ruby-operator">/</span><span class="ruby-identifier">opts</span>[<span class="ruby-value">:bin</span>]
1395
+ <span class="ruby-keyword">else</span>
1396
+ <span class="ruby-identifier">bin</span> = <span class="ruby-identifier">length</span><span class="ruby-operator">/</span><span class="ruby-value">30</span>
1397
+ <span class="ruby-keyword">end</span>
1398
+ <span class="ruby-identifier">result</span> = []
1399
+ <span class="ruby-identifier">region</span> = <span class="ruby-node">&quot;#{chr}:#{start}-#{start + length}&quot;</span>
1400
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">mpileup</span>(<span class="ruby-value">:r</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">region</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
1401
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">coverage</span>
1402
+ <span class="ruby-keyword">end</span>
1403
+ <span class="ruby-identifier">p</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:width</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1000</span>,
1404
+ <span class="ruby-value">:height</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">200</span>,
1405
+ <span class="ruby-value">:number_of_intervals</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>,
1406
+ <span class="ruby-value">:font_size</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">14</span>
1407
+ )
1408
+ <span class="ruby-identifier">data_track</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">add_track</span>(<span class="ruby-value">:glyph</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">:histogram</span>,
1409
+ <span class="ruby-value">:stroke_color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;black&#39;</span>,
1410
+ <span class="ruby-value">:fill_color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;gold&#39;</span>,
1411
+ <span class="ruby-value">:track_height</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">150</span>,
1412
+ <span class="ruby-value">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;read coverage&#39;</span>,
1413
+ <span class="ruby-value">:label</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>,
1414
+ <span class="ruby-value">:stroke_width</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;1&#39;</span>,
1415
+ <span class="ruby-value">:x_round</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>,
1416
+ <span class="ruby-value">:y_round</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> )
1417
+ <span class="ruby-identifier">index</span> = <span class="ruby-value">0</span>;
1418
+ <span class="ruby-identifier">result</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-identifier">bin</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">slice</span><span class="ruby-operator">|</span>
1419
+ <span class="ruby-comment">#result.each_with_index {|val, index|</span>
1420
+ <span class="ruby-identifier">data_feature</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">MiniFeature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:start</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">start</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">index</span>,
1421
+ <span class="ruby-value">:end</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">start</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bin</span>),
1422
+ <span class="ruby-value">:segment_height</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">slice</span>.<span class="ruby-identifier">inject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>,<span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span> }.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">slice</span>.<span class="ruby-identifier">size</span>)
1423
+ <span class="ruby-identifier">data_track</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">data_feature</span>)
1424
+ <span class="ruby-identifier">index</span><span class="ruby-operator">+=</span><span class="ruby-identifier">bin</span>
1425
+ }
1426
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:svg</span>]
1427
+ <span class="ruby-identifier">svg</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:svg</span>].<span class="ruby-identifier">to_s</span>
1428
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">svg</span>)
1429
+ <span class="ruby-keyword">else</span>
1430
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">get_markup</span>
1431
+ <span class="ruby-keyword">end</span>
1432
+
1433
+
1434
+ <span class="ruby-keyword">end</span></pre>
1435
+ </div>
1436
+
1437
+ </div>
1438
+
1439
+
1440
+
1441
+
1442
+ </div>
1443
+
1444
+
1445
+ <div id="method-i-reheader" class="method-detail ">
1446
+
1447
+ <div class="method-heading">
1448
+ <span class="method-name">reheader</span><span
1449
+ class="method-args">(header_sam, opts={})</span>
1450
+
1451
+ <span class="method-click-advice">click to toggle source</span>
1452
+
1453
+ </div>
1454
+
1455
+
1456
+ <div class="method-description">
1457
+
1458
+ <p>Replace the header of the current bam file with the header in header_sam</p>
1459
+ <ul><li>
1460
+ <p>header_sam - the sam file from which the new header will be taken</p>
1461
+ </li><li>
1462
+ <p>out - [FILE] output bam file</p>
1463
+ </li></ul>
1464
+
1465
+
1466
+
1467
+
1468
+ <div class="method-source-code" id="reheader-source">
1469
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 471</span>
1470
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">reheader</span>(<span class="ruby-identifier">header_sam</span>, <span class="ruby-identifier">opts</span>={})
1471
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:out</span>)
1472
+ <span class="ruby-identifier">out</span>=<span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
1473
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} reheader #{header_sam} #{@bam} &gt; #{out}&quot;</span>
1474
+ <span class="ruby-keyword">else</span>
1475
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{@samtools} reheader #{header_sam} #{@bam}&quot;</span>
1476
+ <span class="ruby-keyword">end</span>
1477
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">command</span>
1478
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1479
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1480
+ <span class="ruby-keyword">end</span></pre>
1481
+ </div>
1482
+
1483
+ </div>
1484
+
1485
+
1486
+
1487
+
1488
+ </div>
1489
+
1490
+
1491
+ <div id="method-i-remove_duplicates" class="method-detail ">
1492
+
1493
+ <div class="method-heading">
1494
+ <span class="method-name">remove_duplicates</span><span
1495
+ class="method-args">(opts={})</span>
1496
+
1497
+ <span class="method-click-advice">click to toggle source</span>
1498
+
1499
+ </div>
1500
+
1501
+
1502
+ <div class="method-description">
1503
+
1504
+ <p>Remove potential PCR duplicates: if multiple read pairs have identical
1505
+ external coordinates, only retain the pair with highest mapping quality.</p>
1506
+ <ul><li>
1507
+ <p>s - rmdup for SE reads</p>
1508
+ </li><li>
1509
+ <p>S - treat PE reads as SE in rmdup (force -s)</p>
1510
+ </li><li>
1511
+ <p>out - [FILE] output bam</p>
1512
+ </li></ul>
1513
+
1514
+
1515
+
1516
+
1517
+ <div class="method-source-code" id="remove_duplicates-source">
1518
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 411</span>
1519
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">remove_duplicates</span>(<span class="ruby-identifier">opts</span>={})
1520
+ <span class="ruby-identifier">out</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:out</span>]
1521
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:out</span>)
1522
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{form_opt_string(@samtools, &quot;rmdup&quot;, opts, [:s, :S])} #{out} #{@bam}&quot;</span>
1523
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1524
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1525
+ <span class="ruby-keyword">end</span></pre>
1526
+ </div>
1527
+
1528
+ </div>
1529
+
1530
+
1531
+ <div class="aliases">
1532
+ Also aliased as: <a href="Sam.html#method-i-rmdup">rmdup</a>
1533
+ </div>
1534
+
1535
+
1536
+
1537
+ </div>
1538
+
1539
+
1540
+ <div id="method-i-rmdup" class="method-detail method-alias">
1541
+
1542
+ <div class="method-heading">
1543
+ <span class="method-name">rmdup</span><span
1544
+ class="method-args">(opts={})</span>
1545
+
1546
+ </div>
1547
+
1548
+
1549
+ <div class="method-description">
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+ </div>
1557
+
1558
+
1559
+
1560
+
1561
+ <div class="aliases">
1562
+ Alias for: <a href="Sam.html#method-i-remove_duplicates">remove_duplicates</a>
1563
+ </div>
1564
+
1565
+ </div>
1566
+
1567
+
1568
+ <div id="method-i-sort" class="method-detail ">
1569
+
1570
+ <div class="method-heading">
1571
+ <span class="method-name">sort</span><span
1572
+ class="method-args">(opts={})</span>
1573
+
1574
+ <span class="method-click-advice">click to toggle source</span>
1575
+
1576
+ </div>
1577
+
1578
+
1579
+ <div class="method-description">
1580
+
1581
+ <p>Sort alignments by leftmost coordinates</p>
1582
+ <ul><li>
1583
+ <p>n - sort by read name</p>
1584
+ </li><li>
1585
+ <p>f - use &lt;out.prefix&gt; as full file name instead of prefix</p>
1586
+ </li><li>
1587
+ <p>o - final output to stdout returns bio::db::alignment</p>
1588
+ </li><li>
1589
+ <p>l - [INT] compression level, from 0 to 9 [-1]</p>
1590
+ </li><li>
1591
+ <p>at - [INT] number of sorting and compression threads [1]</p>
1592
+ </li><li>
1593
+ <p>m - [INT] max memory per thread; suffix K/M/G recognized [768M]</p>
1594
+ </li><li>
1595
+ <p>prefix - [STRING] prefix for output bamfile</p>
1596
+ </li></ul>
1597
+
1598
+
1599
+
1600
+
1601
+ <div class="method-source-code" id="sort-source">
1602
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 429</span>
1603
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">sort</span>(<span class="ruby-identifier">opts</span>={})
1604
+ <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">opts</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:prefix</span>)
1605
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">merge!</span>({<span class="ruby-value">:prefix</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;sorted&quot;</span>})
1606
+ <span class="ruby-keyword">end</span>
1607
+ <span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:prefix</span>]
1608
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:prefix</span>)
1609
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">&quot;sort&quot;</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:n</span>, <span class="ruby-value">:f</span>, <span class="ruby-value">:o</span>])
1610
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">command</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">prefix</span>
1611
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1612
+ <span class="ruby-comment">#puts command</span>
1613
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:o</span>]
1614
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">Alignment</span>)
1615
+ <span class="ruby-keyword">else</span>
1616
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1617
+ <span class="ruby-keyword">end</span>
1618
+ <span class="ruby-keyword">end</span></pre>
1619
+ </div>
1620
+
1621
+ </div>
1622
+
1623
+
1624
+
1625
+
1626
+ </div>
1627
+
1628
+
1629
+ <div id="method-i-targetcut" class="method-detail ">
1630
+
1631
+ <div class="method-heading">
1632
+ <span class="method-name">targetcut</span><span
1633
+ class="method-args">(opts={})</span>
1634
+
1635
+ <span class="method-click-advice">click to toggle source</span>
1636
+
1637
+ </div>
1638
+
1639
+
1640
+ <div class="method-description">
1641
+
1642
+ <p>Identifies target regions by examining the continuity of read depth,
1643
+ computes haploid consensus sequences of targets and outputs a SAM with each
1644
+ sequence corresponding to a target. When option -f is in use, BAQ will be
1645
+ applied.</p>
1646
+ <ul><li>
1647
+ <p>Q - [INT] Minimum base quality for a base to be considered [13]</p>
1648
+ </li><li>
1649
+ <p>i - in penalty</p>
1650
+ </li><li>
1651
+ <p>0 - em0</p>
1652
+ </li><li>
1653
+ <p>1 - em1</p>
1654
+ </li><li>
1655
+ <p>2 - em2</p>
1656
+ </li><li>
1657
+ <p>f - reference</p>
1658
+ </li></ul>
1659
+
1660
+
1661
+
1662
+
1663
+ <div class="method-source-code" id="targetcut-source">
1664
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 507</span>
1665
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">targetcut</span>(<span class="ruby-identifier">opts</span>={})
1666
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:f</span>]
1667
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;f&#39;</span>] = <span class="ruby-ivar">@fasta</span>
1668
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:s</span>)
1669
+ <span class="ruby-keyword">end</span>
1670
+
1671
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{form_opt_string(@samtools, &quot;targetcut&quot;, opts, [] )}&quot;</span>
1672
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1673
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1674
+ <span class="ruby-keyword">end</span></pre>
1675
+ </div>
1676
+
1677
+ </div>
1678
+
1679
+
1680
+
1681
+
1682
+ </div>
1683
+
1684
+
1685
+ <div id="method-i-tview" class="method-detail ">
1686
+
1687
+ <div class="method-heading">
1688
+ <span class="method-name">tview</span><span
1689
+ class="method-args">(opts={})</span>
1690
+
1691
+ <span class="method-click-advice">click to toggle source</span>
1692
+
1693
+ </div>
1694
+
1695
+
1696
+ <div class="method-description">
1697
+
1698
+ <p>used to generate a text alignment viewer</p>
1699
+ <ul><li>
1700
+ <p>d - display, output as (H)tml or (C)urses or (T)ext</p>
1701
+ </li><li>
1702
+ <p>p - [chr:pos] go directly to this position</p>
1703
+ </li><li>
1704
+ <p>s - [STR] display only reads from this sample or group</p>
1705
+ </li></ul>
1706
+
1707
+
1708
+
1709
+
1710
+ <div class="method-source-code" id="tview-source">
1711
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 450</span>
1712
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">tview</span>(<span class="ruby-identifier">opts</span>={})
1713
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:d</span>]
1714
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;d&#39;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:d</span>]
1715
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:d</span>)
1716
+ <span class="ruby-keyword">end</span>
1717
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:p</span>]
1718
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;p&#39;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:p</span>]
1719
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:p</span>)
1720
+ <span class="ruby-keyword">end</span>
1721
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:s</span>]
1722
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;s&#39;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:s</span>]
1723
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:s</span>)
1724
+ <span class="ruby-keyword">end</span>
1725
+ <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;#{form_opt_string(@samtools, &quot;tview&quot;, opts)}&quot;</span>
1726
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1727
+ <span class="ruby-identifier">system</span>(<span class="ruby-identifier">command</span>)
1728
+ <span class="ruby-keyword">end</span></pre>
1729
+ </div>
1730
+
1731
+ </div>
1732
+
1733
+
1734
+
1735
+
1736
+ </div>
1737
+
1738
+
1739
+ <div id="method-i-view" class="method-detail ">
1740
+
1741
+ <div class="method-heading">
1742
+ <span class="method-name">view</span><span
1743
+ class="method-args">(opts={},&block)</span>
1744
+
1745
+ <span class="method-click-advice">click to toggle source</span>
1746
+
1747
+ </div>
1748
+
1749
+
1750
+ <div class="method-description">
1751
+
1752
+ <p>runs the samtools view command</p>
1753
+ <ul><li>
1754
+ <p>b - output BAM</p>
1755
+ </li><li>
1756
+ <p>h - print header for the SAM output</p>
1757
+ </li><li>
1758
+ <p>H - print header only (no alignments)</p>
1759
+ </li><li>
1760
+ <p>S - input is SAM</p>
1761
+ </li><li>
1762
+ <p>u - uncompressed BAM output (force -b)</p>
1763
+ </li><li>
1764
+ <p>one - fast compression (force -b)</p>
1765
+ </li><li>
1766
+ <p>x - output FLAG in HEX (samtools-C specific)</p>
1767
+ </li><li>
1768
+ <p>X - output FLAG in string (samtools-C specific)</p>
1769
+ </li><li>
1770
+ <p>c - print only the count of matching records</p>
1771
+ </li><li>
1772
+ <p>B - collapse the backward CIGAR operation</p>
1773
+ </li><li>
1774
+ <p>at - INT number of BAM compression threads [0]</p>
1775
+ </li><li>
1776
+ <p>L - FILE output alignments overlapping the input BED FILE [null]</p>
1777
+ </li><li>
1778
+ <p>t - FILE list of reference names and lengths (force -S) [null]</p>
1779
+ </li><li>
1780
+ <p>T - FILE reference sequence file (force -S) [null]</p>
1781
+ </li><li>
1782
+ <p>o - FILE output file name [stdout]</p>
1783
+ </li><li>
1784
+ <p>R - FILE list of read groups to be outputted [null]</p>
1785
+ </li><li>
1786
+ <p>f - INT required flag 0 for unset [0]</p>
1787
+ </li><li>
1788
+ <p>F - INT filtering flag 0 for unset [0]</p>
1789
+ </li><li>
1790
+ <p>q - INT minimum mapping quality [0]</p>
1791
+ </li><li>
1792
+ <p>l - STR only output reads in library STR [null]</p>
1793
+ </li><li>
1794
+ <p>r - STR only output reads in read group STR [null]</p>
1795
+ </li><li>
1796
+ <p>s - FLOAT fraction of templates to subsample; integer part as seed [-1]</p>
1797
+ </li><li>
1798
+ <p>chr - name of reference sequence to get alignments from</p>
1799
+ </li><li>
1800
+ <p>start - start position on reference sequence</p>
1801
+ </li><li>
1802
+ <p>stop - end postion on reference sequence</p>
1803
+ </li></ul>
1804
+
1805
+
1806
+
1807
+
1808
+ <div class="method-source-code" id="view-source">
1809
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 59</span>
1810
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">view</span>(<span class="ruby-identifier">opts</span>={},<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1811
+ <span class="ruby-identifier">region</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>
1812
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:chr</span>] <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:start</span>] <span class="ruby-keyword">and</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:stop</span>]
1813
+ <span class="ruby-identifier">region</span> = <span class="ruby-node">&quot;#{opts[:chr]}:#{opts[:start]}-#{opts[:stop]}&quot;</span>
1814
+ [<span class="ruby-value">:chr</span>, <span class="ruby-value">:start</span>, <span class="ruby-value">:stop</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">o</span>)}
1815
+ <span class="ruby-keyword">end</span>
1816
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
1817
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;@&#39;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:at</span>]
1818
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:at</span>)
1819
+ <span class="ruby-keyword">end</span>
1820
+
1821
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:one</span>]
1822
+ <span class="ruby-identifier">opts</span>[<span class="ruby-string">&#39;1&#39;</span>] = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:one</span>]
1823
+ <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:one</span>)
1824
+ <span class="ruby-keyword">end</span>
1825
+
1826
+ <span class="ruby-identifier">command</span> = <span class="ruby-identifier">form_opt_string</span>(<span class="ruby-ivar">@samtools</span>, <span class="ruby-string">&#39;view&#39;</span>, <span class="ruby-identifier">opts</span>, [<span class="ruby-value">:b</span>, <span class="ruby-value">:h</span>, <span class="ruby-value">:H</span>, <span class="ruby-value">:S</span>, <span class="ruby-value">:u</span>, <span class="ruby-string">&#39;1&#39;</span>, <span class="ruby-value">:x</span>, <span class="ruby-value">:X</span>, <span class="ruby-value">:c</span>, <span class="ruby-value">:B</span>]) <span class="ruby-operator">+</span> <span class="ruby-string">&quot; &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">region</span>
1827
+ <span class="ruby-ivar">@last_command</span> = <span class="ruby-identifier">command</span>
1828
+ <span class="ruby-identifier">type</span> = (<span class="ruby-identifier">opts</span>[<span class="ruby-value">:u</span>] <span class="ruby-keyword">or</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:b</span>]) <span class="ruby-operator">?</span> <span class="ruby-value">:binary</span> <span class="ruby-operator">:</span> <span class="ruby-value">:text</span>
1829
+ <span class="ruby-identifier">klass</span> = (<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:binary</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">String</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">DB</span><span class="ruby-operator">::</span><span class="ruby-constant">Alignment</span>
1830
+ <span class="ruby-identifier">yield_from_pipe</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">type</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
1831
+ <span class="ruby-keyword">end</span></pre>
1832
+ </div>
1833
+
1834
+ </div>
1835
+
1836
+
1837
+
1838
+
1839
+ </div>
1840
+
1841
+
1842
+ </section>
1843
+
1844
+ </section>
1845
+ </main>
1846
+
1847
+
1848
+ <footer id="validator-badges" role="contentinfo">
1849
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
1850
+ <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
1851
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
1852
+ </footer>
1853
+