bio-samtools 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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/test/test_basic.rb CHANGED
@@ -22,18 +22,18 @@ class TestBioDbSam < Test::Unit::TestCase
22
22
  def teardown
23
23
  begin
24
24
  File.delete(@testReference + ".fai")
25
- p "deleted: " + @testReference + ".fai "
25
+ #p "deleted: " + @testReference + ".fai "
26
26
  rescue
27
27
  end
28
28
  begin
29
29
  File.delete(@testBAMFile + ".fai")
30
- p "deleted: " + @testBAMFile + ".bai "
30
+ #p "deleted: " + @testBAMFile + ".bai "
31
31
  rescue
32
32
  end
33
33
  end
34
- =begin
34
+
35
35
  def default_test
36
- puts $LOAD_PATH
36
+ #puts $LOAD_PATH
37
37
  assert(true, "Unit test test")
38
38
  end
39
39
 
@@ -48,7 +48,7 @@ class TestBioDbSam < Test::Unit::TestCase
48
48
  bam = Bio::DB::Sam.new({})
49
49
  assert(false, "Should fail while opening without parameters")
50
50
  rescue Bio::DB::SAMException => e
51
- puts e.message
51
+ #puts e.message
52
52
  assert(true, e.message)
53
53
  end
54
54
  end
@@ -60,7 +60,7 @@ class TestBioDbSam < Test::Unit::TestCase
60
60
  sam.close
61
61
  assert(false, "Should fail with an invalid path")
62
62
  rescue Bio::DB::SAMException => e
63
- puts e.message
63
+ #puts e.message
64
64
  assert(true, e.message)
65
65
  end
66
66
  end
@@ -93,10 +93,10 @@ class TestBioDbSam < Test::Unit::TestCase
93
93
  sam = Bio::DB::Sam.new({:bam=>@testBAMFile, :fasta=>@testReference})
94
94
  sam.open
95
95
  File.open( @test_folder +"/ids2.txt", "r") do |file|
96
- puts "file opened"
96
+ #puts "file opened"
97
97
  file.each_line{|line|
98
98
  fetching = line.split(' ')[0]
99
- puts "fetching: " + fetching
99
+ #puts "fetching: " + fetching
100
100
  sam.load_reference
101
101
  seq = sam.fetch_reference(fetching, 0, 16000)
102
102
  # puts seq
@@ -104,8 +104,8 @@ class TestBioDbSam < Test::Unit::TestCase
104
104
  als = sam.fetch(fetching, 0, seq.length)
105
105
  # p als
106
106
  if als.length() > 0 then
107
- p fetching
108
- p als
107
+ # p fetching
108
+ # p als
109
109
  end
110
110
  }
111
111
 
@@ -162,7 +162,7 @@ class TestBioDbSam < Test::Unit::TestCase
162
162
  sam = Bio::DB::Sam.new({:bam=>@testBAMFile})
163
163
  sam.open
164
164
  als = sam.fetch("chr_1", 0, 500)
165
- p als
165
+ #p als
166
166
  sam.close
167
167
  assert(true, "Seems it ran the query")
168
168
  #node_7263 238 60 has 550+, query from 0 to 500, something shall come....
@@ -173,11 +173,11 @@ class TestBioDbSam < Test::Unit::TestCase
173
173
  sam.open
174
174
  begin
175
175
  als = sam.fetch("Chr1", 0, 500)
176
- p als
176
+ #p als
177
177
  sam.close
178
178
  assert(false, "Seems it ran the query")
179
179
  rescue Bio::DB::SAMException => e
180
- p e
180
+ #p e
181
181
  assert(true, "Exception generated and catched")
182
182
  end
183
183
  end
@@ -187,11 +187,11 @@ class TestBioDbSam < Test::Unit::TestCase
187
187
  sam.open
188
188
  begin
189
189
  als = sam.fetch("chr", -1, 500)
190
- p als
190
+ #p als
191
191
  sam.close
192
192
  assert(false, "Seems it ran the query")
193
193
  rescue Bio::DB::SAMException => e
194
- p e
194
+ #p e
195
195
  assert(true, "Exception generated and catched")
196
196
  end
197
197
  end
@@ -201,25 +201,25 @@ class TestBioDbSam < Test::Unit::TestCase
201
201
  sam.open
202
202
  begin
203
203
  als = sam.fetch("chr", 0, 50000)
204
- p als
204
+ #p als
205
205
  sam.close
206
206
  assert(false, "Seems it ran the query")
207
207
  rescue Bio::DB::SAMException => e
208
- p e
208
+ #p e
209
209
  assert(true, "Exception generated and catched")
210
210
  end
211
211
  end
212
-
212
+
213
213
  def test_read_invalid_reference_swaped_coordinates
214
214
  sam = Bio::DB::Sam.new({:bam=>@testBAMFile})
215
215
  sam.open
216
216
  begin
217
217
  als = sam.fetch("chr", 500, 0)
218
- p als
218
+ #p als
219
219
  sam.close
220
220
  assert(false, "Seems it ran the query")
221
221
  rescue Bio::DB::SAMException => e
222
- p e
222
+ #p e
223
223
  assert(true, "Exception generated and catched")
224
224
  end
225
225
  end
@@ -228,7 +228,7 @@ class TestBioDbSam < Test::Unit::TestCase
228
228
  sam = Bio::DB::Sam.new({:fasta=>@testReference})
229
229
  sam.load_reference
230
230
  seq = sam.fetch_reference("chr_1", 0, 500)
231
- p seq
231
+ #p seq
232
232
  sam.close
233
233
  assert(true, "The reference was loaded")
234
234
  end
@@ -238,11 +238,11 @@ class TestBioDbSam < Test::Unit::TestCase
238
238
  sam.load_reference
239
239
  begin
240
240
  seq = sam.fetch_reference("chr1", 0, 500)
241
- p "Error seq:"+ seq
241
+ #p "Error seq:"+ seq
242
242
  sam.close
243
243
  assert(false, "The reference was loaded")
244
244
  rescue Bio::DB::SAMException => e
245
- p e
245
+ #p e
246
246
  assert(true, "The references was not loaded")
247
247
  end
248
248
  end
@@ -251,7 +251,7 @@ class TestBioDbSam < Test::Unit::TestCase
251
251
 
252
252
  fs = Feature.find_by_bam("chr_1", 0, 500,@testBAMFile)
253
253
 
254
- p fs
254
+ #p fs
255
255
  assert(true, "Loaded as features")
256
256
  end
257
257
 
@@ -259,7 +259,7 @@ class TestBioDbSam < Test::Unit::TestCase
259
259
  sam = Bio::DB::Sam.new({:fasta=>@testReference, :bam=>@testBAMFile })
260
260
  sam.open
261
261
  cov = sam.average_coverage("chr_1", 60, 30)
262
- p "Coverage: " + cov.to_s
262
+ #p "Coverage: " + cov.to_s
263
263
  sam.close
264
264
  assert(true, "Average coverage ran")
265
265
  assert(3 == cov, "The coverage is 3")
@@ -270,21 +270,21 @@ class TestBioDbSam < Test::Unit::TestCase
270
270
  sam = Bio::DB::Sam.new({:fasta=>@testReference, :bam=>@testBAMFile })
271
271
  sam.open
272
272
  covs = sam.chromosome_coverage("chr_1", 0, 60)
273
- p "Coverage: "
274
- p covs
275
- puts "POS\tCOV"
273
+ #p "Coverage: "
274
+ #p covs
275
+ #puts "POS\tCOV"
276
276
  covs.each_with_index{ |cov, i| puts "#{i}\t#{cov}" }
277
277
  sam.close
278
278
  assert(true, "Average coverage ran")
279
279
  #assert(3 == cov, "The coverage is 3")
280
280
  end
281
- =end
281
+
282
282
  #test whether the call to mpileup works and returns 10 objects of class pileup
283
- def test_pileup
283
+ def test_mpileup
284
284
  sam = Bio::DB::Sam.new(:fasta=>@testReference, :bam=>@testBAMFile )
285
285
  pileup_list = []
286
286
  sam.mpileup(:region => "chr_1:100-109") do |pile|
287
- next unless pile.ref_name == 'chr_1' ##required because in the test environment stdout gets mixed in with the captured stdout in the function and non pileup lines are passed...
287
+ #next unless pile.ref_name == 'chr_1' ##required because in the test environment stdout gets mixed in with the captured stdout in the function and non pileup lines are passed...
288
288
  pileup_list << pile
289
289
  end
290
290
  assert_equal(10,pileup_list.length)
@@ -292,7 +292,24 @@ class TestBioDbSam < Test::Unit::TestCase
292
292
  assert_kind_of(Pileup, p)
293
293
  end
294
294
  end
295
-
295
+
296
+ #test whether the call to experimental mpileup_plus returns vcf or pileup objects appropriately
297
+ #return ten objects of each class according to set of :g option
298
+ def test_mpileup_plus
299
+ sam = Bio::DB::Sam.new(:fasta=>@testReference, :bam=>@testBAMFile)
300
+ list = []
301
+ sam.mpileup_plus(:region => "chr_1:100-109") do |pile|
302
+ list << pile
303
+ end
304
+ assert_equal(10,list.length)
305
+ list.each {|p| assert_kind_of(Pileup, p)}
306
+ vcf_list = []
307
+ sam.mpileup_plus(:region => "chr_1:100-109", :g => true) do |vcf|
308
+ vcf_list << vcf
309
+ end
310
+ assert_equal(10,vcf_list.length)
311
+ vcf_list.each {|p| assert_kind_of(Vcf, p)}
312
+ end
296
313
 
297
314
  #test whether the call to mpileup returns a vcf object if :g => true is used on the command-line
298
315
  # def test_vcf
@@ -310,14 +327,13 @@ class TestBioDbSam < Test::Unit::TestCase
310
327
  "*"=>{:length=>0, :mapped_reads=>0, :unmapped_reads=>0}
311
328
  }, sam.index_stats)
312
329
  end
313
-
314
330
  end
315
331
 
316
332
  class Feature
317
333
  attr_reader :start, :end, :strand, :sequence, :quality
318
334
 
319
335
  def initialize(a={})
320
- p a
336
+ #p a
321
337
  @start = a[:start]
322
338
  @end = a[:enf]
323
339
  @strand = a[:strand]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-samtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-11-09 00:00:00.000000000Z
14
+ date: 2011-11-10 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ffi
18
- requirement: &2151877660 !ruby/object:Gem::Requirement
18
+ requirement: &2157872120 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2151877660
26
+ version_requirements: *2157872120
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bio
29
- requirement: &2151875400 !ruby/object:Gem::Requirement
29
+ requirement: &2157870700 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 1.4.2
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2151875400
37
+ version_requirements: *2157870700
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: shoulda
40
- requirement: &2151871380 !ruby/object:Gem::Requirement
40
+ requirement: &2157869680 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *2151871380
48
+ version_requirements: *2157869680
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: bundler
51
- requirement: &2151863520 !ruby/object:Gem::Requirement
51
+ requirement: &2157868840 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ~>
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 1.0.0
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *2151863520
59
+ version_requirements: *2157868840
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: jeweler
62
- requirement: &2151851920 !ruby/object:Gem::Requirement
62
+ requirement: &2157857240 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *2151851920
70
+ version_requirements: *2157857240
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rcov
73
- requirement: &2151845300 !ruby/object:Gem::Requirement
73
+ requirement: &2157856580 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *2151845300
81
+ version_requirements: *2157856580
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: bio
84
- requirement: &2151840740 !ruby/object:Gem::Requirement
84
+ requirement: &2157856020 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: 1.4.2
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *2151840740
92
+ version_requirements: *2157856020
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: ffi
95
- requirement: &2151830540 !ruby/object:Gem::Requirement
95
+ requirement: &2157855320 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: '0'
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *2151830540
103
+ version_requirements: *2157855320
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rdoc
106
- requirement: &2151828720 !ruby/object:Gem::Requirement
106
+ requirement: &2157854640 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ! '>='
@@ -111,7 +111,7 @@ dependencies:
111
111
  version: '0'
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *2151828720
114
+ version_requirements: *2157854640
115
115
  description: ! "Binder of samtools for ruby, on the top of FFI. \n\n This project
116
116
  was born from the need to add support of BAM files to \n the gee_fu genome browser
117
117
  (http://github.com/danmaclean/gee_fu)."
@@ -131,6 +131,24 @@ files:
131
131
  - Rakefile
132
132
  - VERSION
133
133
  - bio-samtools.gemspec
134
+ - doc/Bio.html
135
+ - doc/Bio/DB.html
136
+ - doc/Bio/DB/Alignment.html
137
+ - doc/Bio/DB/SAM.html
138
+ - doc/Bio/DB/SAM/Library.html
139
+ - doc/Bio/DB/SAM/Tools.html
140
+ - doc/Bio/DB/SAM/Tools/Bam1CoreT.html
141
+ - doc/Bio/DB/SAM/Tools/Bam1T.html
142
+ - doc/Bio/DB/SAM/Tools/BamHeaderT.html
143
+ - doc/Bio/DB/SAM/Tools/BamPileup1T.html
144
+ - doc/Bio/DB/SAM/Tools/SamfileT.html
145
+ - doc/Bio/DB/SAM/Tools/SamfileTX.html
146
+ - doc/Bio/DB/SAMException.html
147
+ - doc/Bio/DB/Tag.html
148
+ - doc/LICENSE_txt.html
149
+ - doc/LibC.html
150
+ - doc/Pileup.html
151
+ - doc/Vcf.html
134
152
  - doc/basic_styles.css
135
153
  - doc/classes/Bio.html
136
154
  - doc/classes/Bio/DB.html
@@ -191,8 +209,48 @@ files:
191
209
  - doc/fr_class_index.html
192
210
  - doc/fr_file_index.html
193
211
  - doc/fr_method_index.html
212
+ - doc/images/add.png
213
+ - doc/images/brick.png
214
+ - doc/images/brick_link.png
215
+ - doc/images/bug.png
216
+ - doc/images/bullet_black.png
217
+ - doc/images/bullet_toggle_minus.png
218
+ - doc/images/bullet_toggle_plus.png
219
+ - doc/images/date.png
220
+ - doc/images/delete.png
221
+ - doc/images/find.png
222
+ - doc/images/loadingAnimation.gif
223
+ - doc/images/macFFBgHack.png
224
+ - doc/images/package.png
225
+ - doc/images/page_green.png
226
+ - doc/images/page_white_text.png
227
+ - doc/images/page_white_width.png
228
+ - doc/images/plugin.png
229
+ - doc/images/ruby.png
230
+ - doc/images/tag_blue.png
231
+ - doc/images/tag_green.png
232
+ - doc/images/transparent.png
233
+ - doc/images/wrench.png
234
+ - doc/images/wrench_orange.png
235
+ - doc/images/zoom.png
194
236
  - doc/index.html
237
+ - doc/js/darkfish.js
238
+ - doc/js/jquery.js
239
+ - doc/js/navigation.js
240
+ - doc/js/search.js
241
+ - doc/js/search_index.js
242
+ - doc/js/searcher.js
243
+ - doc/lib/bio-samtools_rb.html
244
+ - doc/lib/bio/db/sam/bam_rb.html
245
+ - doc/lib/bio/db/sam/faidx_rb.html
246
+ - doc/lib/bio/db/sam/library_rb.html
247
+ - doc/lib/bio/db/sam/pileup_rb.html
248
+ - doc/lib/bio/db/sam/sam_rb.html
249
+ - doc/lib/bio/db/sam/vcf_rb.html
250
+ - doc/lib/bio/db/sam_rb.html
195
251
  - doc/rdoc-style.css
252
+ - doc/rdoc.css
253
+ - doc/table_of_contents.html
196
254
  - doc/tutorial.html
197
255
  - doc/tutorial.pdf
198
256
  - ext/Makefile-bioruby.patch
@@ -210,9 +268,6 @@ files:
210
268
  - lib/bio/db/sam/sam.rb
211
269
  - lib/bio/db/sam/vcf.rb
212
270
  - test/basictest.rb
213
- - test/coverage.rb
214
- - test/coverage_plot.rb
215
- - test/feature.rb
216
271
  - test/helper.rb
217
272
  - test/pileup.rb
218
273
  - test/samples/small/ids2.txt
@@ -236,7 +291,6 @@ files:
236
291
  - test/samples/small/testu.bam.bai
237
292
  - test/test_basic.rb
238
293
  - test/test_bio-samtools.rb
239
- - test/test_pileup.rb
240
294
  - test/test_vcf.rb
241
295
  homepage: http://github.com/helios/bioruby-samtools
242
296
  licenses:
@@ -253,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
307
  version: '0'
254
308
  segments:
255
309
  - 0
256
- hash: -1752695698829417260
310
+ hash: -4357702541244266034
257
311
  required_rubygems_version: !ruby/object:Gem::Requirement
258
312
  none: false
259
313
  requirements: