bio-samtools 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.6.0
data/bio-samtools.gemspec CHANGED
@@ -4,18 +4,15 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{bio-samtools}
8
- s.version = "0.5.3"
7
+ s.name = "bio-samtools"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Ricardo Ramirez-Gonzalez}, %q{Dan MacLean}, %q{Raoul J.P. Bonnal}]
12
- s.date = %q{2012-04-14}
13
- s.description = %q{Binder of samtools for ruby, on the top of FFI.
14
-
15
- This project was born from the need to add support of BAM files to
16
- the gee_fu genome browser (http://github.com/danmaclean/gee_fu).}
17
- s.email = %q{ilpuccio.febo@gmail.com}
18
- s.extensions = [%q{ext/mkrf_conf.rb}]
11
+ s.authors = ["Ricardo Ramirez-Gonzalez", "Dan MacLean", "Raoul J.P. Bonnal"]
12
+ s.date = "2012-12-03"
13
+ s.description = "Binder of samtools for ruby, on the top of FFI. \n\n This project was born from the need to add support of BAM files to \n the gee_fu genome browser (http://github.com/danmaclean/gee_fu)."
14
+ s.email = "ilpuccio.febo@gmail.com"
15
+ s.extensions = ["ext/mkrf_conf.rb"]
19
16
  s.extra_rdoc_files = [
20
17
  "LICENSE.txt",
21
18
  "README.rdoc"
@@ -194,11 +191,11 @@ Gem::Specification.new do |s|
194
191
  "test/test_bio-samtools.rb",
195
192
  "test/test_vcf.rb"
196
193
  ]
197
- s.homepage = %q{http://github.com/helios/bioruby-samtools}
198
- s.licenses = [%q{MIT}]
199
- s.require_paths = [%q{lib}]
200
- s.rubygems_version = %q{1.8.6}
201
- s.summary = %q{Binder of samtools for ruby, on the top of FFI.}
194
+ s.homepage = "http://github.com/helios/bioruby-samtools"
195
+ s.licenses = ["MIT"]
196
+ s.require_paths = ["lib"]
197
+ s.rubygems_version = "1.8.24"
198
+ s.summary = "Binder of samtools for ruby, on the top of FFI."
202
199
 
203
200
  if s.respond_to? :specification_version then
204
201
  s.specification_version = 3
data/doc/Bio.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
6
 
7
- <title>Module: Bio</title>
7
+ <title>module Bio - Pileup</title>
8
8
 
9
9
  <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
10
 
@@ -178,13 +178,13 @@ the 1st indel allele otherwise</p>
178
178
  <p>(13) indel line only: # reads supporting a third indel allele</p>
179
179
  </li></ul>
180
180
 
181
- <p>If pileup is invoked without `-c’, indel lines and columns between 3 and 7
182
- inclusive will not be outputted.</p>
181
+ <p>If pileup is invoked without `-c’, indel lines and columns between 3 and
182
+ 7 inclusive will not be outputted.</p>
183
183
 
184
184
  <p>NB mpileup uses the 6 column output format eg
185
- “seq2t151tGtGt36t0t99t12t.….……At:9&lt;;;7=&lt;&lt;&lt;&lt;&lt;” Pileup
186
- provides accessors for all columns (6 or 10 column format) and a few other
187
- useful methods</p>
185
+ “seq2t151tGtGt36t0t99t12t.….……At:9&lt;;;7=&lt;&lt;&lt;&lt;&lt;”
186
+ Pileup provides accessors for all columns (6 or 10 column format) and a few
187
+ other useful methods</p>
188
188
 
189
189
  <p>require ‘rubygems’ require ‘ffi’</p>
190
190
 
@@ -232,7 +232,7 @@ href="http://www.1000genomes.org/node/101">www.1000genomes.org/node/101</a></p>
232
232
 
233
233
  <footer id="validator-badges">
234
234
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
235
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
235
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
236
236
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
237
237
  </footer>
238
238
 
data/doc/Bio/DB.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
6
 
7
- <title>Class: Bio::DB</title>
7
+ <title>class Bio::DB - Pileup</title>
8
8
 
9
9
  <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
10
 
@@ -159,7 +159,7 @@
159
159
 
160
160
  <footer id="validator-badges">
161
161
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
162
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
162
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
163
163
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
164
164
  </footer>
165
165
 
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
6
 
7
- <title>Class: Bio::DB::Alignment</title>
7
+ <title>class Bio::DB::Alignment - Pileup</title>
8
8
 
9
9
  <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
10
 
@@ -595,7 +595,7 @@ for clarity. primary is the negation of is_negative from the BAM format</p>
595
595
 
596
596
 
597
597
  <div class="method-source-code" id="finalize-source">
598
- <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 554</span>
598
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 560</span>
599
599
  <span class="ruby-keyword">def</span> <span class="ruby-constant">Alignment</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-identifier">object_id</span>)
600
600
 
601
601
  <span class="ruby-comment"># puts &quot;Object #{object_id} dying at #{Time.new}&quot;</span>
@@ -634,7 +634,7 @@ for clarity. primary is the negation of is_negative from the BAM format</p>
634
634
 
635
635
 
636
636
  <div class="method-source-code" id="new-source">
637
- <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 550</span>
637
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 556</span>
638
638
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
639
639
  <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">define_finalizer</span>(<span class="ruby-keyword">self</span>,
640
640
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">method</span>(<span class="ruby-value">:finalize</span>).<span class="ruby-identifier">to_proc</span>)
@@ -671,7 +671,7 @@ for clarity. primary is the negation of is_negative from the BAM format</p>
671
671
 
672
672
 
673
673
  <div class="method-source-code" id="sam-3D-source">
674
- <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 608</span>
674
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 614</span>
675
675
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">sam=</span>(<span class="ruby-identifier">sam</span>)
676
676
  <span class="ruby-comment">#p sam</span>
677
677
  <span class="ruby-identifier">s</span> = <span class="ruby-identifier">sam</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\t&quot;</span>)
@@ -724,7 +724,7 @@ for clarity. primary is the negation of is_negative from the BAM format</p>
724
724
 
725
725
 
726
726
  <div class="method-source-code" id="set-source">
727
- <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 576</span>
727
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 582</span>
728
728
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">bam_alignment</span>, <span class="ruby-identifier">header</span>)
729
729
  <span class="ruby-comment">#Create the FFI object</span>
730
730
  <span class="ruby-ivar">@al</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">SAM</span><span class="ruby-operator">::</span><span class="ruby-constant">Tools</span><span class="ruby-operator">::</span><span class="ruby-constant">Bam1T</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bam_alignment</span>)
@@ -774,7 +774,7 @@ for clarity. primary is the negation of is_negative from the BAM format</p>
774
774
 
775
775
  <footer id="validator-badges">
776
776
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
777
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
777
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
778
778
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
779
779
  </footer>
780
780
 
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
6
 
7
- <title>Class: Bio::DB::Pileup</title>
7
+ <title>class Bio::DB::Pileup - Pileup</title>
8
8
 
9
9
  <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
10
 
@@ -70,14 +70,22 @@
70
70
 
71
71
  <ul class="link-list">
72
72
 
73
+ <li><a href="#method-c-iupac_to_base">::iupac_to_base</a>
74
+
73
75
  <li><a href="#method-c-new">::new</a>
74
76
 
77
+ <li><a href="#method-i-genotype_list">#genotype_list</a>
78
+
75
79
  <li><a href="#method-i-non_ref_count">#non_ref_count</a>
76
80
 
77
81
  <li><a href="#method-i-non_refs">#non_refs</a>
78
82
 
79
83
  <li><a href="#method-i-ref_count">#ref_count</a>
80
84
 
85
+ <li><a href="#method-i-to_s">#to_s</a>
86
+
87
+ <li><a href="#method-i-to_vcf">#to_vcf</a>
88
+
81
89
  </ul>
82
90
  </nav>
83
91
 
@@ -239,6 +247,32 @@
239
247
 
240
248
 
241
249
 
250
+ </div>
251
+ </div>
252
+
253
+ <div id="attribute-i-indel_1" class="method-detail">
254
+ <div class="method-heading attribute-method-heading">
255
+ <span class="method-name">indel_1</span><span
256
+ class="attribute-access-type">[RW]</span>
257
+ </div>
258
+
259
+ <div class="method-description">
260
+
261
+
262
+
263
+ </div>
264
+ </div>
265
+
266
+ <div id="attribute-i-indel_2" class="method-detail">
267
+ <div class="method-heading attribute-method-heading">
268
+ <span class="method-name">indel_2</span><span
269
+ class="attribute-access-type">[RW]</span>
270
+ </div>
271
+
272
+ <div class="method-description">
273
+
274
+
275
+
242
276
  </div>
243
277
  </div>
244
278
 
@@ -342,6 +376,44 @@
342
376
  <h3 class="section-header">Public Class Methods</h3>
343
377
 
344
378
 
379
+ <div id="method-c-iupac_to_base" class="method-detail ">
380
+
381
+ <div class="method-heading">
382
+ <span class="method-name">iupac_to_base</span><span
383
+ class="method-args">(alt_base)</span>
384
+ <span class="method-click-advice">click to toggle source</span>
385
+ </div>
386
+
387
+
388
+ <div class="method-description">
389
+
390
+ <p>returns</p>
391
+
392
+
393
+
394
+ <div class="method-source-code" id="iupac_to_base-source">
395
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 184</span>
396
+ <span class="ruby-keyword">def</span> <span class="ruby-constant">Pileup</span>.<span class="ruby-identifier">iupac_to_base</span>(<span class="ruby-identifier">alt_base</span>)
397
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">alt_base</span>
398
+ <span class="ruby-keyword">when</span> <span class="ruby-string">'K'</span> <span class="ruby-keyword">then</span> [<span class="ruby-string">'G'</span>,<span class="ruby-string">'T'</span>]
399
+ <span class="ruby-keyword">when</span> <span class="ruby-string">'M'</span> <span class="ruby-keyword">then</span> [<span class="ruby-string">'A'</span>,<span class="ruby-string">'C'</span>]
400
+ <span class="ruby-keyword">when</span> <span class="ruby-string">'S'</span> <span class="ruby-keyword">then</span> [<span class="ruby-string">'C'</span>,<span class="ruby-string">'G'</span>]
401
+ <span class="ruby-keyword">when</span> <span class="ruby-string">'R'</span> <span class="ruby-keyword">then</span> [<span class="ruby-string">'A'</span>,<span class="ruby-string">'G'</span>]
402
+ <span class="ruby-keyword">when</span> <span class="ruby-string">'W'</span> <span class="ruby-keyword">then</span> [<span class="ruby-string">'A'</span>,<span class="ruby-string">'T'</span>]
403
+ <span class="ruby-keyword">when</span> <span class="ruby-string">'Y'</span> <span class="ruby-keyword">then</span> [<span class="ruby-string">'C'</span>,<span class="ruby-string">'T'</span>]
404
+ <span class="ruby-keyword">else</span> <span class="ruby-identifier">alt_base</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r/</span>)
405
+ <span class="ruby-keyword">end</span>
406
+ <span class="ruby-keyword">end</span></pre>
407
+ </div><!-- iupac_to_base-source -->
408
+
409
+ </div>
410
+
411
+
412
+
413
+
414
+ </div><!-- iupac_to_base-method -->
415
+
416
+
345
417
  <div id="method-c-new" class="method-detail ">
346
418
 
347
419
  <div class="method-heading">
@@ -363,11 +435,15 @@ pile = Bio::DB::Pileup.new(pile_up_line)</pre>
363
435
  <div class="method-source-code" id="new-source">
364
436
  <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 35</span>
365
437
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">pile_up_line</span>)
366
- <span class="ruby-identifier">cols</span> = <span class="ruby-identifier">pile_up_line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\t/</span>)
438
+ <span class="ruby-identifier">cols</span> = <span class="ruby-identifier">pile_up_line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r\t/</span>)
367
439
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> <span class="ruby-comment">##should only be able to get 6 lines from mpileup</span>
368
440
  <span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@coverage</span>, <span class="ruby-ivar">@read_bases</span>, <span class="ruby-ivar">@read_quals</span> = <span class="ruby-identifier">cols</span>
369
441
  <span class="ruby-keyword">elsif</span> (<span class="ruby-value">10</span><span class="ruby-operator">..</span><span class="ruby-value">13</span>).<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">cols</span>.<span class="ruby-identifier">length</span>) <span class="ruby-comment">##incase anyone tries to use deprecated pileup with -c flag we get upto 13 cols...</span>
370
- <span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@consensus</span>, <span class="ruby-ivar">@consensus_quality</span>, <span class="ruby-ivar">@snp_quality</span>, <span class="ruby-ivar">@rms_mapq</span>, <span class="ruby-ivar">@coverage</span>, <span class="ruby-ivar">@read_bases</span>, <span class="ruby-ivar">@read_quals</span>, <span class="ruby-ivar">@ar1</span>, <span class="ruby-ivar">@ar2</span>, <span class="ruby-ivar">@ar3</span> = <span class="ruby-identifier">cols</span>
442
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">cols</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'*'</span> <span class="ruby-comment">#indel</span>
443
+ <span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@consensus</span>, <span class="ruby-ivar">@consensus_quality</span>, <span class="ruby-ivar">@snp_quality</span>, <span class="ruby-ivar">@rms_mapq</span>, <span class="ruby-ivar">@coverage</span>, <span class="ruby-ivar">@indel_1</span>, <span class="ruby-ivar">@indel_2</span>, <span class="ruby-ivar">@ar1</span>, <span class="ruby-ivar">@ar2</span>, <span class="ruby-ivar">@ar3</span> = <span class="ruby-identifier">cols</span>
444
+ <span class="ruby-keyword">else</span> <span class="ruby-comment">#snp / identity</span>
445
+ <span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@consensus</span>, <span class="ruby-ivar">@consensus_quality</span>, <span class="ruby-ivar">@snp_quality</span>, <span class="ruby-ivar">@rms_mapq</span>, <span class="ruby-ivar">@coverage</span>, <span class="ruby-ivar">@read_bases</span>, <span class="ruby-ivar">@read_quals</span> = <span class="ruby-identifier">cols</span>
446
+ <span class="ruby-keyword">end</span>
371
447
  <span class="ruby-ivar">@consensus_quality</span> = <span class="ruby-ivar">@consensus_quality</span>.<span class="ruby-identifier">to_f</span>
372
448
  <span class="ruby-ivar">@snp_quality</span> = <span class="ruby-ivar">@snp_quality</span>.<span class="ruby-identifier">to_f</span>
373
449
  <span class="ruby-ivar">@rms_mapq</span> = <span class="ruby-ivar">@rms_mapq</span>.<span class="ruby-identifier">to_f</span>
@@ -397,6 +473,40 @@ pile = Bio::DB::Pileup.new(pile_up_line)</pre>
397
473
  <h3 class="section-header">Public Instance Methods</h3>
398
474
 
399
475
 
476
+ <div id="method-i-genotype_list" class="method-detail ">
477
+
478
+ <div class="method-heading">
479
+ <span class="method-name">genotype_list</span><span
480
+ class="method-args">()</span>
481
+ <span class="method-click-advice">click to toggle source</span>
482
+ </div>
483
+
484
+
485
+ <div class="method-description">
486
+
487
+
488
+
489
+
490
+
491
+ <div class="method-source-code" id="genotype_list-source">
492
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 174</span>
493
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">genotype_list</span>
494
+ <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ref_base</span> <span class="ruby-operator">==</span> <span class="ruby-string">'*'</span>
495
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">indel_gt</span>
496
+ <span class="ruby-keyword">else</span>
497
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">snp_gt</span>
498
+ <span class="ruby-keyword">end</span>
499
+ <span class="ruby-keyword">end</span></pre>
500
+ </div><!-- genotype_list-source -->
501
+
502
+ </div>
503
+
504
+
505
+
506
+
507
+ </div><!-- genotype_list-method -->
508
+
509
+
400
510
  <div id="method-i-non_ref_count" class="method-detail ">
401
511
 
402
512
  <div class="method-heading">
@@ -413,7 +523,7 @@ pile = Bio::DB::Pileup.new(pile_up_line)</pre>
413
523
 
414
524
 
415
525
  <div class="method-source-code" id="non_ref_count-source">
416
- <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 65</span>
526
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 69</span>
417
527
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">non_ref_count</span>
418
528
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@non_ref_count</span>.<span class="ruby-identifier">nil?</span>
419
529
  <span class="ruby-ivar">@non_ref_count</span> = <span class="ruby-ivar">@read_bases</span>.<span class="ruby-identifier">count</span>(<span class="ruby-string">&quot;ATGCatgc&quot;</span>).<span class="ruby-identifier">to_f</span>
@@ -450,7 +560,7 @@ hash of all 4 nt counts, returns a hash</p>
450
560
 
451
561
 
452
562
  <div class="method-source-code" id="non_refs-source">
453
- <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 57</span>
563
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 61</span>
454
564
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">non_refs</span>
455
565
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@non_ref_count_hash</span>.<span class="ruby-identifier">nil?</span>
456
566
  <span class="ruby-ivar">@non_ref_count_hash</span> = {<span class="ruby-value">:A</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_bases</span>.<span class="ruby-identifier">count</span>(<span class="ruby-string">&quot;Aa&quot;</span>), <span class="ruby-value">:C</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_bases</span>.<span class="ruby-identifier">count</span>(<span class="ruby-string">&quot;Cc&quot;</span>), <span class="ruby-value">:G</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_bases</span>.<span class="ruby-identifier">count</span>(<span class="ruby-string">&quot;Gg&quot;</span>), <span class="ruby-value">:T</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_bases</span>.<span class="ruby-identifier">count</span>(<span class="ruby-string">&quot;Tt&quot;</span>)}
@@ -483,7 +593,7 @@ hash of all 4 nt counts, returns a hash</p>
483
593
 
484
594
 
485
595
  <div class="method-source-code" id="ref_count-source">
486
- <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 73</span>
596
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 77</span>
487
597
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">ref_count</span>
488
598
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@ref_count</span>.<span class="ruby-identifier">nil?</span>
489
599
  <span class="ruby-ivar">@ref_count</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">read_bases</span>.<span class="ruby-identifier">count</span>(<span class="ruby-string">&quot;.,&quot;</span>)
@@ -500,6 +610,79 @@ hash of all 4 nt counts, returns a hash</p>
500
610
  </div><!-- ref_count-method -->
501
611
 
502
612
 
613
+ <div id="method-i-to_s" class="method-detail ">
614
+
615
+ <div class="method-heading">
616
+ <span class="method-name">to_s</span><span
617
+ class="method-args">()</span>
618
+ <span class="method-click-advice">click to toggle source</span>
619
+ </div>
620
+
621
+
622
+ <div class="method-description">
623
+
624
+ <p>returns pileup format line as</p>
625
+
626
+
627
+
628
+ <div class="method-source-code" id="to_s-source">
629
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 197</span>
630
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
631
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@read_quals</span> <span class="ruby-keyword">and</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@consensus_quality</span> <span class="ruby-comment">#6col</span>
632
+ [<span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@coverage</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@read_bases</span>, <span class="ruby-ivar">@read_quals</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\t&quot;</span>)
633
+ <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@indel_1</span> <span class="ruby-comment">#13 cols</span>
634
+ [<span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@consensus</span>, <span class="ruby-ivar">@consensus_quality</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@snp_quality</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@rms_mapq</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@coverage</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@indel_1</span>, <span class="ruby-ivar">@indel_2</span>, <span class="ruby-ivar">@ar1</span>, <span class="ruby-ivar">@ar2</span>, <span class="ruby-ivar">@ar3</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\t&quot;</span>)
635
+ <span class="ruby-keyword">else</span> <span class="ruby-comment">#10 cols</span>
636
+ [<span class="ruby-ivar">@ref_name</span>, <span class="ruby-ivar">@pos</span>, <span class="ruby-ivar">@ref_base</span>, <span class="ruby-ivar">@consensus</span>, <span class="ruby-ivar">@consensus_quality</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@snp_quality</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@rms_mapq</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@coverage</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@read_bases</span>, <span class="ruby-ivar">@read_quals</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\t&quot;</span>)
637
+ <span class="ruby-keyword">end</span>
638
+
639
+ <span class="ruby-keyword">end</span></pre>
640
+ </div><!-- to_s-source -->
641
+
642
+ </div>
643
+
644
+
645
+
646
+
647
+ </div><!-- to_s-method -->
648
+
649
+
650
+ <div id="method-i-to_vcf" class="method-detail ">
651
+
652
+ <div class="method-heading">
653
+ <span class="method-name">to_vcf</span><span
654
+ class="method-args">()</span>
655
+ <span class="method-click-advice">click to toggle source</span>
656
+ </div>
657
+
658
+
659
+ <div class="method-description">
660
+
661
+ <p>returns basic VCF string as per samtools/misc sam2vcf.pl except that it
662
+ scrimps on the ref for indels, returning a ‘*’ instead of the reference
663
+ allele</p>
664
+
665
+
666
+
667
+ <div class="method-source-code" id="to_vcf-source">
668
+ <pre><span class="ruby-comment"># File lib/bio/db/pileup.rb, line 103</span>
669
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_vcf</span>
670
+
671
+ <span class="ruby-identifier">alt</span>,<span class="ruby-identifier">g</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">genotype_list</span>
672
+ <span class="ruby-identifier">alt</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">consensus</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r/</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">','</span>) <span class="ruby-keyword">unless</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ref_base</span> <span class="ruby-operator">==</span> <span class="ruby-string">'*'</span>
673
+ <span class="ruby-identifier">alt</span> = <span class="ruby-string">'.'</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">alt</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ref_base</span>
674
+ [<span class="ruby-keyword">self</span>.<span class="ruby-identifier">ref_name</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">pos</span>, <span class="ruby-string">'.'</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ref_base</span>, <span class="ruby-identifier">alt</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">snp_quality</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-string">&quot;0&quot;</span>, <span class="ruby-node">&quot;DP=#{self.coverage.to_i}&quot;</span>, <span class="ruby-string">&quot;GT:GQ:DP&quot;</span>, <span class="ruby-node">&quot;#{g}:#{self.consensus_quality.to_i}:#{self.coverage.to_i}&quot;</span> ].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\t&quot;</span>)
675
+ <span class="ruby-keyword">end</span></pre>
676
+ </div><!-- to_vcf-source -->
677
+
678
+ </div>
679
+
680
+
681
+
682
+
683
+ </div><!-- to_vcf-method -->
684
+
685
+
503
686
  </section><!-- public-instance-method-details -->
504
687
 
505
688
  </section><!-- 5Buntitled-5D -->
@@ -509,7 +692,7 @@ hash of all 4 nt counts, returns a hash</p>
509
692
 
510
693
  <footer id="validator-badges">
511
694
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
512
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
695
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
513
696
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
514
697
  </footer>
515
698
 
data/doc/Bio/DB/SAM.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
6
 
7
- <title>Class: Bio::DB::Sam</title>
7
+ <title>class Bio::DB::Sam - Pileup</title>
8
8
 
9
9
  <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
10
10
 
@@ -84,6 +84,8 @@
84
84
 
85
85
  <li><a href="#method-i-deprecated_pileup">#deprecated_pileup</a>
86
86
 
87
+ <li><a href="#method-i-each_reference">#each_reference</a>
88
+
87
89
  <li><a href="#method-i-fetch">#fetch</a>
88
90
 
89
91
  <li><a href="#method-i-fetch_reference">#fetch_reference</a>
@@ -337,10 +339,10 @@ following elemets:</p>
337
339
  <p>If the file is to be writen (false). Not supported yet.</p>
338
340
  </dd></dl>
339
341
 
340
- <p><strong>NOTE:</strong> you can't use binary and text formats simultaneusly.
341
- To make queries, the file has to be a sorted binary. This function doesn't
342
- actually open the file, it just prepares the object to be opened in a later
343
- stage.</p>
342
+ <p><strong>NOTE:</strong> you cant use binary and text formats
343
+ simultaneusly. To make queries, the file has to be a sorted binary. This
344
+ function doesn’t actually open the file, it just prepares the object to
345
+ be opened in a later stage.</p>
344
346
 
345
347
 
346
348
 
@@ -542,8 +544,8 @@ method you must have a version of samtools that supports the pileup command
542
544
  (&lt; 0.1.17) otherwise the command will fail. mpileup is the preferred
543
545
  method for getting pileups. With this method the sam object should be
544
546
  created as usual, but you need to pass this method a string of options for
545
- samtools you don’t need to provide the call to samtools pileup itself or -f
546
- &lt;fasta file&gt; or the bam file itself, these are taken from the sam
547
+ samtools you don’t need to provide the call to samtools pileup itself or
548
+ -f &lt;fasta file&gt; or the bam file itself, these are taken from the sam
547
549
  object</p>
548
550
 
549
551
 
@@ -579,6 +581,39 @@ object</p>
579
581
  </div><!-- deprecated_pileup-method -->
580
582
 
581
583
 
584
+ <div id="method-i-each_reference" class="method-detail ">
585
+
586
+ <div class="method-heading">
587
+ <span class="method-name">each_reference</span><span
588
+ class="method-args">() { |k, v| ... }</span>
589
+ <span class="method-click-advice">click to toggle source</span>
590
+ </div>
591
+
592
+
593
+ <div class="method-description">
594
+
595
+ <p>yields each reference name and its length</p>
596
+
597
+
598
+
599
+ <div class="method-source-code" id="each_reference-source">
600
+ <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 535</span>
601
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">each_reference</span>
602
+ <span class="ruby-identifier">refs</span> = <span class="ruby-identifier">index_stats</span>
603
+ <span class="ruby-identifier">refs</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>
604
+ <span class="ruby-keyword">yield</span> <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>[<span class="ruby-value">:length</span>]
605
+ <span class="ruby-keyword">end</span>
606
+ <span class="ruby-keyword">end</span></pre>
607
+ </div><!-- each_reference-source -->
608
+
609
+ </div>
610
+
611
+
612
+
613
+
614
+ </div><!-- each_reference-method -->
615
+
616
+
582
617
  <div id="method-i-fetch" class="method-detail ">
583
618
 
584
619
  <div class="method-heading">
@@ -755,7 +790,7 @@ use your own FixNum (FFI-bug?)</p>
755
790
  <span class="ruby-keyword">begin</span>
756
791
 
757
792
  <span class="ruby-keyword">while</span> <span class="ruby-identifier">line</span> = <span class="ruby-identifier">read_pipe</span>.<span class="ruby-identifier">readline</span> <span class="ruby-comment">#TAB delimited with each line consisting of reference sequence name, sequence length, # mapped reads and # unmapped reads.</span>
758
- <span class="ruby-identifier">info</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\t/</span>)
793
+ <span class="ruby-identifier">info</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r\t/</span>)
759
794
  <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">info</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>
760
795
  <span class="ruby-identifier">index_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> }
761
796
  <span class="ruby-keyword">end</span>
@@ -790,10 +825,10 @@ use your own FixNum (FFI-bug?)</p>
790
825
  <p>Loads the bam index to be used for fetching. If the index doesn’t exists
791
826
  the index is built provided that the user has writing access to the folder
792
827
  where the BAM file is located. If the creation of the file fails a <a
793
- href="SAMException.html">SAMException</a> is thrown. If the index doesn’t
794
- exist, loading it will take more time. It is suggested to generate the
795
- index separatedly if the bam file sits on a server where the executing user
796
- may not have writing permissions in the server.</p>
828
+ href="SAMException.html">SAMException</a> is thrown. If the index
829
+ doesn’t exist, loading it will take more time. It is suggested to
830
+ generate the index separatedly if the bam file sits on a server where the
831
+ executing user may not have writing permissions in the server.</p>
797
832
 
798
833
 
799
834
 
@@ -831,10 +866,11 @@ may not have writing permissions in the server.</p>
831
866
  <div class="method-description">
832
867
 
833
868
  <p>Loads the reference file to be able to query regions of it. This requires
834
- the fai index to exist in the same folder than the reference. If it doesn’t
835
- exisits, this functions attempts to generate it. If user doesn’t have
836
- writing permissions on the folder, or the creation of the fai fails for any
837
- reason, a <a href="SAMException.html">SAMException</a> is thrown.</p>
869
+ the fai index to exist in the same folder than the reference. If it
870
+ doesn’t exisits, this functions attempts to generate it. If user
871
+ doesn’t have writing permissions on the folder, or the creation of the
872
+ fai fails for any reason, a <a href="SAMException.html">SAMException</a> is
873
+ thrown.</p>
838
874
 
839
875
 
840
876
 
@@ -867,7 +903,7 @@ reason, a <a href="SAMException.html">SAMException</a> is thrown.</p>
867
903
 
868
904
  <div class="method-heading">
869
905
  <span class="method-name">mpileup</span><span
870
- class="method-args">( opts ) { |pileup| ... }</span>
906
+ class="method-args">( opts={}) { |pileup| ... }</span>
871
907
  <span class="method-click-advice">click to toggle source</span>
872
908
  </div>
873
909
 
@@ -879,15 +915,15 @@ command line options for mpileup. is an iterator that yields a <a
879
915
  href="Pileup.html">Pileup</a> object for each postion the command line
880
916
  options that generate/affect BCF/VCF are ignored ie (g,u,e,h,I,L,o,p) call
881
917
  the option as a symbol of the flag, eg -r for region is called :r =&gt;
882
- “some <a href="SAM.html">SAM</a> compatible region” eg bam.mpileup(:r =&gt;
883
- “chr1:1000-2000”, :q =&gt; 50) gets the bases with quality &gt; 50 on chr1
884
- between 1000-5000</p>
918
+ “some <a href="SAM.html">SAM</a> compatible region” eg bam.mpileup(:r
919
+ =&gt; “chr1:1000-2000”, :q =&gt; 50) gets the bases with quality &gt;
920
+ 50 on chr1 between 1000-5000</p>
885
921
 
886
922
 
887
923
 
888
924
  <div class="method-source-code" id="mpileup-source">
889
925
  <pre><span class="ruby-comment"># File lib/bio/db/sam.rb, line 281</span>
890
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">mpileup</span>( <span class="ruby-identifier">opts</span> )
926
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">mpileup</span>( <span class="ruby-identifier">opts</span>={})
891
927
 
892
928
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">&quot;No BAMFile provided&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@sam</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@binary</span>
893
929
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">SAMException</span>.<span class="ruby-identifier">new</span>(), <span class="ruby-string">&quot;No FastA provided&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@fasta_path</span>
@@ -1235,7 +1271,7 @@ binary or text, the path and the fasta file of the reference</p>
1235
1271
 
1236
1272
  <footer id="validator-badges">
1237
1273
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
1238
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
1274
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
1239
1275
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
1240
1276
  </footer>
1241
1277