bio-samtools 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/VERSION +1 -1
  2. data/bio-samtools.gemspec +60 -6
  3. data/doc/Bio.html +171 -0
  4. data/doc/Bio/DB.html +163 -0
  5. data/doc/Bio/DB/Alignment.html +780 -0
  6. data/doc/Bio/DB/SAM.html +1241 -0
  7. data/doc/Bio/DB/SAM/Library.html +217 -0
  8. data/doc/Bio/DB/SAM/Tools.html +331 -0
  9. data/doc/Bio/DB/SAM/Tools/Bam1CoreT.html +159 -0
  10. data/doc/Bio/DB/SAM/Tools/Bam1T.html +220 -0
  11. data/doc/Bio/DB/SAM/Tools/BamHeaderT.html +249 -0
  12. data/doc/Bio/DB/SAM/Tools/BamPileup1T.html +159 -0
  13. data/doc/Bio/DB/SAM/Tools/SamfileT.html +171 -0
  14. data/doc/Bio/DB/SAM/Tools/SamfileTX.html +159 -0
  15. data/doc/Bio/DB/SAMException.html +205 -0
  16. data/doc/Bio/DB/Tag.html +254 -0
  17. data/doc/LICENSE_txt.html +881 -0
  18. data/doc/LibC.html +153 -0
  19. data/doc/Pileup.html +571 -0
  20. data/doc/Vcf.html +473 -0
  21. data/doc/created.rid +10 -1
  22. data/doc/images/add.png +0 -0
  23. data/doc/images/brick.png +0 -0
  24. data/doc/images/brick_link.png +0 -0
  25. data/doc/images/bug.png +0 -0
  26. data/doc/images/bullet_black.png +0 -0
  27. data/doc/images/bullet_toggle_minus.png +0 -0
  28. data/doc/images/bullet_toggle_plus.png +0 -0
  29. data/doc/images/date.png +0 -0
  30. data/doc/images/delete.png +0 -0
  31. data/doc/images/find.png +0 -0
  32. data/doc/images/loadingAnimation.gif +0 -0
  33. data/doc/images/macFFBgHack.png +0 -0
  34. data/doc/images/package.png +0 -0
  35. data/doc/images/page_green.png +0 -0
  36. data/doc/images/page_white_text.png +0 -0
  37. data/doc/images/page_white_width.png +0 -0
  38. data/doc/images/plugin.png +0 -0
  39. data/doc/images/ruby.png +0 -0
  40. data/doc/images/tag_blue.png +0 -0
  41. data/doc/images/tag_green.png +0 -0
  42. data/doc/images/transparent.png +0 -0
  43. data/doc/images/wrench.png +0 -0
  44. data/doc/images/wrench_orange.png +0 -0
  45. data/doc/images/zoom.png +0 -0
  46. data/doc/index.html +109 -21
  47. data/doc/js/darkfish.js +153 -0
  48. data/doc/js/jquery.js +18 -0
  49. data/doc/js/navigation.js +142 -0
  50. data/doc/js/search.js +94 -0
  51. data/doc/js/search_index.js +1 -0
  52. data/doc/js/searcher.js +228 -0
  53. data/doc/lib/bio-samtools_rb.html +115 -0
  54. data/doc/lib/bio/db/sam/bam_rb.html +121 -0
  55. data/doc/lib/bio/db/sam/faidx_rb.html +117 -0
  56. data/doc/lib/bio/db/sam/library_rb.html +115 -0
  57. data/doc/lib/bio/db/sam/pileup_rb.html +171 -0
  58. data/doc/lib/bio/db/sam/sam_rb.html +121 -0
  59. data/doc/lib/bio/db/sam/vcf_rb.html +124 -0
  60. data/doc/lib/bio/db/sam_rb.html +115 -0
  61. data/doc/rdoc.css +543 -0
  62. data/doc/table_of_contents.html +186 -0
  63. data/ext/Makefile-bioruby.patch +1 -1
  64. data/ext/Rakefile +8 -1
  65. data/ext/mkrf_conf.rb +8 -1
  66. data/lib/bio/db/sam.rb +140 -27
  67. data/lib/bio/db/sam/vcf.rb +0 -1
  68. data/test/basictest.rb +4 -4
  69. data/test/test_basic.rb +50 -34
  70. metadata +79 -25
  71. data/test/coverage.rb +0 -26
  72. data/test/coverage_plot.rb +0 -28
  73. data/test/feature.rb +0 -0
  74. data/test/test_pileup.rb +0 -68
data/doc/Vcf.html ADDED
@@ -0,0 +1,473 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Class: Vcf</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/bio/db/sam/vcf.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+ <nav id="parent-class-section" class="section">
60
+ <h3 class="section-header">Parent</h3>
61
+
62
+ <p class="link">Object
63
+
64
+ </nav>
65
+
66
+
67
+ <!-- Method Quickref -->
68
+ <nav id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+
71
+ <ul class="link-list">
72
+
73
+ <li><a href="#method-c-new">::new</a>
74
+
75
+ <li><a href="#method-i-int_or_raw">#int_or_raw</a>
76
+
77
+ <li><a href="#method-i-parse_line">#parse_line</a>
78
+
79
+ </ul>
80
+ </nav>
81
+
82
+ </div>
83
+
84
+ <div id="project-metadata">
85
+ <nav id="fileindex-section" class="section project-section">
86
+ <h3 class="section-header">Pages</h3>
87
+
88
+ <ul>
89
+
90
+ <li class="file"><a href="./LICENSE_txt.html">LICENSE</a>
91
+
92
+ </ul>
93
+ </nav>
94
+
95
+ <nav id="classindex-section" class="section project-section">
96
+ <h3 class="section-header">Class and Module Index</h3>
97
+
98
+ <ul class="link-list">
99
+
100
+ <li><a href="./Bio.html">Bio</a>
101
+
102
+ <li><a href="./Bio/DB.html">Bio::DB</a>
103
+
104
+ <li><a href="./Bio/DB/Alignment.html">Bio::DB::Alignment</a>
105
+
106
+ <li><a href="./Bio/DB/SAM.html">Bio::DB::SAM</a>
107
+
108
+ <li><a href="./Bio/DB/SAM/Library.html">Bio::DB::SAM::Library</a>
109
+
110
+ <li><a href="./Bio/DB/SAM/Tools.html">Bio::DB::SAM::Tools</a>
111
+
112
+ <li><a href="./Bio/DB/SAM/Tools/Bam1CoreT.html">Bio::DB::SAM::Tools::Bam1CoreT</a>
113
+
114
+ <li><a href="./Bio/DB/SAM/Tools/Bam1T.html">Bio::DB::SAM::Tools::Bam1T</a>
115
+
116
+ <li><a href="./Bio/DB/SAM/Tools/BamHeaderT.html">Bio::DB::SAM::Tools::BamHeaderT</a>
117
+
118
+ <li><a href="./Bio/DB/SAM/Tools/BamPileup1T.html">Bio::DB::SAM::Tools::BamPileup1T</a>
119
+
120
+ <li><a href="./Bio/DB/SAM/Tools/SamfileT.html">Bio::DB::SAM::Tools::SamfileT</a>
121
+
122
+ <li><a href="./Bio/DB/SAM/Tools/SamfileTX.html">Bio::DB::SAM::Tools::SamfileTX</a>
123
+
124
+ <li><a href="./Bio/DB/SAMException.html">Bio::DB::SAMException</a>
125
+
126
+ <li><a href="./Bio/DB/Sam.html">Bio::DB::Sam</a>
127
+
128
+ <li><a href="./Bio/DB/Tag.html">Bio::DB::Tag</a>
129
+
130
+ <li><a href="./LibC.html">LibC</a>
131
+
132
+ <li><a href="./Pileup.html">Pileup</a>
133
+
134
+ <li><a href="./Vcf.html">Vcf</a>
135
+
136
+ </ul>
137
+ </nav>
138
+
139
+ </div>
140
+ </nav>
141
+
142
+ <div id="documentation">
143
+ <h1 class="class">class Vcf</h1>
144
+
145
+ <div id="description" class="description">
146
+
147
+ <h1 id="label-Vcf+"><a href="Vcf.html">Vcf</a> </h1>
148
+
149
+ <p>A class representing information in Variant Call Format Forked from vcfruby
150
+ at <a
151
+ href="https://github.com/jesserod/vcfruby">github.com/jesserod/vcfruby</a>
152
+ Modified and tests written by Dan MacLean (tsl at dan.maclean.ac.uk) VCF is
153
+ described at <a
154
+ href="http://www.1000genomes.org/node/101">www.1000genomes.org/node/101</a></p>
155
+
156
+ </div><!-- description -->
157
+
158
+
159
+
160
+
161
+ <section id="5Buntitled-5D" class="documentation-section">
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <!-- Attributes -->
170
+ <section id="attribute-method-details" class="method-section section">
171
+ <h3 class="section-header">Attributes</h3>
172
+
173
+
174
+ <div id="attribute-i-alt" class="method-detail">
175
+ <div class="method-heading attribute-method-heading">
176
+ <span class="method-name">alt</span><span
177
+ class="attribute-access-type">[RW]</span>
178
+ </div>
179
+
180
+ <div class="method-description">
181
+
182
+
183
+
184
+ </div>
185
+ </div>
186
+
187
+ <div id="attribute-i-chrom" class="method-detail">
188
+ <div class="method-heading attribute-method-heading">
189
+ <span class="method-name">chrom</span><span
190
+ class="attribute-access-type">[RW]</span>
191
+ </div>
192
+
193
+ <div class="method-description">
194
+
195
+
196
+
197
+ </div>
198
+ </div>
199
+
200
+ <div id="attribute-i-filter" class="method-detail">
201
+ <div class="method-heading attribute-method-heading">
202
+ <span class="method-name">filter</span><span
203
+ class="attribute-access-type">[RW]</span>
204
+ </div>
205
+
206
+ <div class="method-description">
207
+
208
+
209
+
210
+ </div>
211
+ </div>
212
+
213
+ <div id="attribute-i-format" class="method-detail">
214
+ <div class="method-heading attribute-method-heading">
215
+ <span class="method-name">format</span><span
216
+ class="attribute-access-type">[RW]</span>
217
+ </div>
218
+
219
+ <div class="method-description">
220
+
221
+
222
+
223
+ </div>
224
+ </div>
225
+
226
+ <div id="attribute-i-id" class="method-detail">
227
+ <div class="method-heading attribute-method-heading">
228
+ <span class="method-name">id</span><span
229
+ class="attribute-access-type">[RW]</span>
230
+ </div>
231
+
232
+ <div class="method-description">
233
+
234
+
235
+
236
+ </div>
237
+ </div>
238
+
239
+ <div id="attribute-i-info" class="method-detail">
240
+ <div class="method-heading attribute-method-heading">
241
+ <span class="method-name">info</span><span
242
+ class="attribute-access-type">[RW]</span>
243
+ </div>
244
+
245
+ <div class="method-description">
246
+
247
+
248
+
249
+ </div>
250
+ </div>
251
+
252
+ <div id="attribute-i-pos" class="method-detail">
253
+ <div class="method-heading attribute-method-heading">
254
+ <span class="method-name">pos</span><span
255
+ class="attribute-access-type">[RW]</span>
256
+ </div>
257
+
258
+ <div class="method-description">
259
+
260
+
261
+
262
+ </div>
263
+ </div>
264
+
265
+ <div id="attribute-i-qual" class="method-detail">
266
+ <div class="method-heading attribute-method-heading">
267
+ <span class="method-name">qual</span><span
268
+ class="attribute-access-type">[RW]</span>
269
+ </div>
270
+
271
+ <div class="method-description">
272
+
273
+
274
+
275
+ </div>
276
+ </div>
277
+
278
+ <div id="attribute-i-ref" class="method-detail">
279
+ <div class="method-heading attribute-method-heading">
280
+ <span class="method-name">ref</span><span
281
+ class="attribute-access-type">[RW]</span>
282
+ </div>
283
+
284
+ <div class="method-description">
285
+
286
+
287
+
288
+ </div>
289
+ </div>
290
+
291
+ <div id="attribute-i-samples" class="method-detail">
292
+ <div class="method-heading attribute-method-heading">
293
+ <span class="method-name">samples</span><span
294
+ class="attribute-access-type">[RW]</span>
295
+ </div>
296
+
297
+ <div class="method-description">
298
+
299
+
300
+
301
+ </div>
302
+ </div>
303
+
304
+ </section><!-- attribute-method-details -->
305
+
306
+
307
+ <!-- Methods -->
308
+
309
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
310
+ <h3 class="section-header">Public Class Methods</h3>
311
+
312
+
313
+ <div id="method-c-new" class="method-detail ">
314
+
315
+ <div class="method-heading">
316
+ <span class="method-name">new</span><span
317
+ class="method-args">(line=nil, sample_names=nil)</span>
318
+ <span class="method-click-advice">click to toggle source</span>
319
+ </div>
320
+
321
+
322
+ <div class="method-description">
323
+
324
+ <p>create the vcf object, use the ordered list of sample names to label
325
+ samples if provided [‘A’, ‘B’, ‘C’], otherwise uses, 1,2,3 etc</p>
326
+
327
+
328
+
329
+ <div class="method-source-code" id="new-source">
330
+ <pre><span class="ruby-comment"># File lib/bio/db/sam/vcf.rb, line 13</span>
331
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">line</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">sample_names</span>=<span class="ruby-keyword">nil</span>)
332
+ <span class="ruby-ivar">@info</span> = {}
333
+ <span class="ruby-ivar">@samples</span> = {}
334
+ <span class="ruby-identifier">parse_line</span>(<span class="ruby-identifier">line</span>, <span class="ruby-identifier">sample_names</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
335
+ <span class="ruby-keyword">end</span></pre>
336
+ </div><!-- new-source -->
337
+
338
+ </div>
339
+
340
+
341
+
342
+
343
+ </div><!-- new-method -->
344
+
345
+
346
+ </section><!-- public-class-method-details -->
347
+
348
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
349
+ <h3 class="section-header">Public Instance Methods</h3>
350
+
351
+
352
+ <div id="method-i-int_or_raw" class="method-detail ">
353
+
354
+ <div class="method-heading">
355
+ <span class="method-name">int_or_raw</span><span
356
+ class="method-args">(x)</span>
357
+ <span class="method-click-advice">click to toggle source</span>
358
+ </div>
359
+
360
+
361
+ <div class="method-description">
362
+
363
+
364
+
365
+
366
+
367
+ <div class="method-source-code" id="int_or_raw-source">
368
+ <pre><span class="ruby-comment"># File lib/bio/db/sam/vcf.rb, line 19</span>
369
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">int_or_raw</span>(<span class="ruby-identifier">x</span>)
370
+ <span class="ruby-constant">Integer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">x</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">x</span>
371
+ <span class="ruby-keyword">end</span></pre>
372
+ </div><!-- int_or_raw-source -->
373
+
374
+ </div>
375
+
376
+
377
+
378
+
379
+ </div><!-- int_or_raw-method -->
380
+
381
+
382
+ <div id="method-i-parse_line" class="method-detail ">
383
+
384
+ <div class="method-heading">
385
+ <span class="method-name">parse_line</span><span
386
+ class="method-args">(line, sample_names=nil)</span>
387
+ <span class="method-click-advice">click to toggle source</span>
388
+ </div>
389
+
390
+
391
+ <div class="method-description">
392
+
393
+ <p>gets the info in the <a href="Vcf.html">Vcf</a> lines and parses the</p>
394
+
395
+
396
+
397
+ <div class="method-source-code" id="parse_line-source">
398
+ <pre><span class="ruby-comment"># File lib/bio/db/sam/vcf.rb, line 24</span>
399
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_line</span>(<span class="ruby-identifier">line</span>, <span class="ruby-identifier">sample_names</span>=<span class="ruby-keyword">nil</span>)
400
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'#'</span>
401
+
402
+ <span class="ruby-identifier">f</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\t&quot;</span>, <span class="ruby-value">-1</span>)
403
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;VCF lines must have at least 8 fields&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">8</span>
404
+ <span class="ruby-ivar">@chrom</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">0</span>]
405
+ <span class="ruby-ivar">@pos</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>
406
+ <span class="ruby-ivar">@id</span> = <span class="ruby-string">'.'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">2</span>]
407
+ <span class="ruby-ivar">@ref</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">3</span>]
408
+ <span class="ruby-ivar">@alt</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">4</span>]
409
+ <span class="ruby-ivar">@qual</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">5</span>].<span class="ruby-identifier">to_f</span>
410
+ <span class="ruby-ivar">@filter</span> = <span class="ruby-string">'.'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">6</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">6</span>]
411
+
412
+ <span class="ruby-ivar">@info</span> = <span class="ruby-string">'.'</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">7</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> {}
413
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@info</span>
414
+ <span class="ruby-identifier">info_vec</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">7</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;;&quot;</span>)
415
+ <span class="ruby-identifier">info_vec</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
416
+ <span class="ruby-identifier">keyval</span> = <span class="ruby-identifier">x</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;=&quot;</span>, <span class="ruby-value">-1</span>)
417
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">keyval</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-comment"># If it's key=value</span>
418
+ <span class="ruby-ivar">@info</span>[<span class="ruby-identifier">keyval</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">keyval</span>[<span class="ruby-value">1</span>]
419
+ <span class="ruby-keyword">else</span> <span class="ruby-comment"># Otherwise, it's just a flag</span>
420
+ <span class="ruby-ivar">@info</span>[<span class="ruby-identifier">x</span>] = <span class="ruby-keyword">nil</span>
421
+ <span class="ruby-keyword">end</span>
422
+ <span class="ruby-keyword">end</span>
423
+ <span class="ruby-keyword">end</span>
424
+
425
+ <span class="ruby-ivar">@samples</span> = {}
426
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">8</span> <span class="ruby-comment"># Has just upto info</span>
427
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Can't have format with no samples&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">9</span>
428
+
429
+ <span class="ruby-ivar">@format</span> = <span class="ruby-identifier">f</span>[<span class="ruby-value">8</span>]
430
+
431
+ <span class="ruby-identifier">sample_keys</span> = <span class="ruby-ivar">@format</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;:&quot;</span>)
432
+
433
+ <span class="ruby-identifier">num_samples</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">9</span> <span class="ruby-comment"># How many fields are past the format</span>
434
+
435
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">sample_names</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-comment"># Make the sample names just [&quot;1&quot;, &quot;2&quot;, ... , &quot;num_samples}&quot;</span>
436
+ <span class="ruby-identifier">sample_names</span> = (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">num_samples</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">to_s</span>}
437
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">sample_names</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">num_samples</span>
438
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unexpected number of samples (#{num_samples}) based on the provided sample names (#{sample_names.inspect})&quot;</span>
439
+ <span class="ruby-keyword">end</span>
440
+
441
+ <span class="ruby-identifier">sample_names</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sample_name</span>, <span class="ruby-identifier">sample_index</span><span class="ruby-operator">|</span>
442
+ <span class="ruby-identifier">i</span> = <span class="ruby-identifier">sample_index</span> <span class="ruby-operator">+</span> <span class="ruby-value">9</span> <span class="ruby-comment"># index into columns (f)</span>
443
+ <span class="ruby-identifier">sample_values</span> = <span class="ruby-identifier">f</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;:&quot;</span>)
444
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Expected number of sample values to be &lt;= number of sample keys in FORMAT column Format=#{@format} but sample=#{f[i]}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">sample_values</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">sample_keys</span>.<span class="ruby-identifier">size</span>
445
+ <span class="ruby-ivar">@samples</span>[<span class="ruby-identifier">sample_name</span>] = {}
446
+ <span class="ruby-identifier">sample_keys</span>.<span class="ruby-identifier">each_with_index</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value_index</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@samples</span>[<span class="ruby-identifier">sample_name</span>][<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">sample_values</span>[<span class="ruby-identifier">value_index</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&quot;&quot;</span>}
447
+ <span class="ruby-keyword">end</span>
448
+
449
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>;
450
+ <span class="ruby-keyword">end</span></pre>
451
+ </div><!-- parse_line-source -->
452
+
453
+ </div>
454
+
455
+
456
+
457
+
458
+ </div><!-- parse_line-method -->
459
+
460
+
461
+ </section><!-- public-instance-method-details -->
462
+
463
+ </section><!-- 5Buntitled-5D -->
464
+
465
+ </div><!-- documentation -->
466
+
467
+
468
+ <footer id="validator-badges">
469
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
470
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
471
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
472
+ </footer>
473
+