bio-samtools 0.6.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +4 -7
  4. data/VERSION +1 -1
  5. data/bio-samtools.gemspec +47 -105
  6. data/doc/Bio.html +68 -131
  7. data/doc/Bio/DB.html +51 -111
  8. data/doc/Bio/DB/Alignment.html +135 -363
  9. data/doc/Bio/DB/Pileup.html +183 -170
  10. data/doc/Bio/DB/SAM.html +1396 -820
  11. data/doc/Bio/DB/SAM/Library.html +73 -123
  12. data/doc/Bio/DB/SAM/Tools.html +51 -273
  13. data/doc/Bio/DB/Tag.html +78 -124
  14. data/doc/Bio/DB/Vcf.html +111 -147
  15. data/doc/LICENSE_txt.html +113 -148
  16. data/doc/created.rid +9 -10
  17. data/doc/fonts.css +167 -0
  18. data/doc/fonts/Lato-Light.ttf +0 -0
  19. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  20. data/doc/fonts/Lato-Regular.ttf +0 -0
  21. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  22. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  23. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  24. data/doc/images/add.png +0 -0
  25. data/doc/images/arrow_up.png +0 -0
  26. data/doc/images/delete.png +0 -0
  27. data/doc/images/tag_blue.png +0 -0
  28. data/doc/index.html +48 -54
  29. data/doc/js/darkfish.js +9 -22
  30. data/doc/js/search.js +20 -5
  31. data/doc/js/search_index.js +1 -1
  32. data/doc/rdoc.css +255 -218
  33. data/doc/table_of_contents.html +256 -137
  34. data/ext/Rakefile +57 -0
  35. data/lib/bio-samtools.rb +7 -2
  36. data/lib/bio/BIOExtensions.rb +89 -0
  37. data/lib/bio/db/alignment.rb +59 -0
  38. data/lib/bio/db/fastadb.rb +255 -0
  39. data/lib/bio/db/pileup.rb +221 -172
  40. data/lib/bio/db/sam.rb +639 -589
  41. data/lib/bio/db/sam/{faidx.rb → faidx_old.rb} +0 -0
  42. data/lib/bio/db/vcf.rb +69 -68
  43. data/test/.gitignore +1 -0
  44. data/test/{test_basic.rb → old_test_basic.rb} +33 -1
  45. data/test/samples/small/dupes.bam +0 -0
  46. data/test/samples/small/dupes.sam +274 -0
  47. data/test/samples/small/map_for_reheader.sam +8 -0
  48. data/test/samples/small/map_to_merge1.bam +0 -0
  49. data/test/samples/small/map_to_merge1.bam.bai +0 -0
  50. data/test/samples/small/map_to_merge1.sam +8 -0
  51. data/test/samples/small/map_to_merge2.bam +0 -0
  52. data/test/samples/small/map_to_merge2.bam.bai +0 -0
  53. data/test/samples/small/map_to_merge2.sam +8 -0
  54. data/test/samples/small/no_md.sam +8 -0
  55. data/test/samples/small/test_chr.fasta.1.bt2 +0 -0
  56. data/test/samples/small/test_chr.fasta.2.bt2 +0 -0
  57. data/test/samples/small/test_chr.fasta.3.bt2 +0 -0
  58. data/test/samples/small/test_chr.fasta.4.bt2 +0 -0
  59. data/test/samples/small/test_chr.fasta.rev.1.bt2 +0 -0
  60. data/test/samples/small/test_chr.fasta.rev.2.bt2 +0 -0
  61. data/test/samples/small/test_cov.svg +273 -0
  62. data/test/samples/small/testu.bam.bai +0 -0
  63. data/test/svg +133 -0
  64. data/test/test_pileup.rb +84 -0
  65. data/test/test_sam.rb +331 -0
  66. data/test/test_vcf.rb +11 -0
  67. data/{doc → tutorial}/tutorial.html +0 -0
  68. data/{doc → tutorial}/tutorial.pdf +0 -0
  69. metadata +56 -114
  70. data/doc/Bio/DB/SAM/Tools/Bam1CoreT.html +0 -159
  71. data/doc/Bio/DB/SAM/Tools/Bam1T.html +0 -220
  72. data/doc/Bio/DB/SAM/Tools/BamHeaderT.html +0 -249
  73. data/doc/Bio/DB/SAM/Tools/BamPileup1T.html +0 -159
  74. data/doc/Bio/DB/SAM/Tools/SamfileT.html +0 -171
  75. data/doc/Bio/DB/SAM/Tools/SamfileTX.html +0 -159
  76. data/doc/Bio/DB/SAMException.html +0 -205
  77. data/doc/LibC.html +0 -155
  78. data/doc/Pileup.html +0 -571
  79. data/doc/Vcf.html +0 -473
  80. data/doc/basic_styles.css +0 -31
  81. data/doc/classes/Bio.html +0 -139
  82. data/doc/classes/Bio/DB.html +0 -137
  83. data/doc/classes/Bio/DB/Alignment.html +0 -441
  84. data/doc/classes/Bio/DB/Alignment.src/M000012.html +0 -19
  85. data/doc/classes/Bio/DB/Alignment.src/M000013.html +0 -27
  86. data/doc/classes/Bio/DB/Alignment.src/M000014.html +0 -45
  87. data/doc/classes/Bio/DB/Alignment.src/M000015.html +0 -40
  88. data/doc/classes/Bio/DB/SAM.html +0 -510
  89. data/doc/classes/Bio/DB/SAM/Library.html +0 -135
  90. data/doc/classes/Bio/DB/SAM/Library.src/M000006.html +0 -28
  91. data/doc/classes/Bio/DB/SAM/Tools.html +0 -278
  92. data/doc/classes/Bio/DB/SAM/Tools.src/M000007.html +0 -20
  93. data/doc/classes/Bio/DB/SAM/Tools/Bam1CoreT.html +0 -111
  94. data/doc/classes/Bio/DB/SAM/Tools/Bam1T.html +0 -150
  95. data/doc/classes/Bio/DB/SAM/Tools/Bam1T.src/M000010.html +0 -20
  96. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.html +0 -169
  97. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000008.html +0 -19
  98. data/doc/classes/Bio/DB/SAM/Tools/BamHeaderT.src/M000009.html +0 -18
  99. data/doc/classes/Bio/DB/SAM/Tools/BamPileup1T.html +0 -111
  100. data/doc/classes/Bio/DB/SAM/Tools/SamfileT.html +0 -129
  101. data/doc/classes/Bio/DB/SAM/Tools/SamfileTX.html +0 -111
  102. data/doc/classes/Bio/DB/SAMException.html +0 -140
  103. data/doc/classes/Bio/DB/SAMException.src/M000016.html +0 -18
  104. data/doc/classes/Bio/DB/Sam.src/M000017.html +0 -43
  105. data/doc/classes/Bio/DB/Sam.src/M000018.html +0 -42
  106. data/doc/classes/Bio/DB/Sam.src/M000019.html +0 -18
  107. data/doc/classes/Bio/DB/Sam.src/M000020.html +0 -22
  108. data/doc/classes/Bio/DB/Sam.src/M000021.html +0 -19
  109. data/doc/classes/Bio/DB/Sam.src/M000022.html +0 -25
  110. data/doc/classes/Bio/DB/Sam.src/M000023.html +0 -28
  111. data/doc/classes/Bio/DB/Sam.src/M000024.html +0 -28
  112. data/doc/classes/Bio/DB/Sam.src/M000025.html +0 -46
  113. data/doc/classes/Bio/DB/Sam.src/M000026.html +0 -24
  114. data/doc/classes/Bio/DB/Sam.src/M000027.html +0 -19
  115. data/doc/classes/Bio/DB/Sam.src/M000028.html +0 -24
  116. data/doc/classes/Bio/DB/Sam.src/M000029.html +0 -41
  117. data/doc/classes/Bio/DB/Sam.src/M000030.html +0 -31
  118. data/doc/classes/Bio/DB/Sam.src/M000031.html +0 -86
  119. data/doc/classes/Bio/DB/Sam.src/M000032.html +0 -34
  120. data/doc/classes/Bio/DB/Tag.html +0 -160
  121. data/doc/classes/Bio/DB/Tag.src/M000011.html +0 -21
  122. data/doc/classes/LibC.html +0 -105
  123. data/doc/classes/Pileup.html +0 -374
  124. data/doc/classes/Pileup.src/M000001.html +0 -34
  125. data/doc/classes/Pileup.src/M000002.html +0 -21
  126. data/doc/classes/Pileup.src/M000003.html +0 -21
  127. data/doc/classes/Pileup.src/M000004.html +0 -21
  128. data/doc/classes/Pileup.src/M000005.html +0 -31
  129. data/doc/files/lib/bio-samtools_rb.html +0 -109
  130. data/doc/files/lib/bio/db/sam/bam_rb.html +0 -108
  131. data/doc/files/lib/bio/db/sam/faidx_rb.html +0 -108
  132. data/doc/files/lib/bio/db/sam/library_rb.html +0 -101
  133. data/doc/files/lib/bio/db/sam/pileup_rb.html +0 -178
  134. data/doc/files/lib/bio/db/sam/sam_rb.html +0 -113
  135. data/doc/files/lib/bio/db/sam_rb.html +0 -111
  136. data/doc/fr_class_index.html +0 -43
  137. data/doc/fr_file_index.html +0 -33
  138. data/doc/fr_method_index.html +0 -58
  139. data/doc/lib/bio-samtools_rb.html +0 -115
  140. data/doc/lib/bio/db/pileup_rb.html +0 -171
  141. data/doc/lib/bio/db/sam/bam_rb.html +0 -121
  142. data/doc/lib/bio/db/sam/faidx_rb.html +0 -117
  143. data/doc/lib/bio/db/sam/library_rb.html +0 -115
  144. data/doc/lib/bio/db/sam/pileup_rb.html +0 -171
  145. data/doc/lib/bio/db/sam/sam_rb.html +0 -121
  146. data/doc/lib/bio/db/sam/vcf_rb.html +0 -124
  147. data/doc/lib/bio/db/sam_rb.html +0 -115
  148. data/doc/lib/bio/db/vcf_rb.html +0 -124
  149. data/doc/rdoc-style.css +0 -208
  150. data/lib/bio/db/sam/bam.rb +0 -210
  151. data/lib/bio/db/sam/sam.rb +0 -86
  152. data/test/samples/pipe_char/test.bam +0 -0
  153. data/test/samples/pipe_char/test.bam.bai +0 -0
  154. data/test/samples/pipe_char/test.tam +0 -10
  155. data/test/samples/pipe_char/test_chr.fasta +0 -1000
  156. data/test/samples/pipe_char/test_chr.fasta.fai +0 -1
  157. data/test/samples/small/test +0 -0
  158. data/test/samples/small/test.bam +0 -0
  159. data/test/samples/small/test.fa +0 -20
  160. data/test/samples/small/test.fai +0 -0
@@ -1,473 +0,0 @@
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
-