bio-dbsnp 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.3.0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+ gem "bio", ">= 1.4.1"
14
+ end
@@ -0,0 +1,30 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ bio (1.4.2)
5
+ diff-lcs (1.1.3)
6
+ git (1.2.5)
7
+ jeweler (1.6.4)
8
+ bundler (~> 1.0)
9
+ git (>= 1.2.5)
10
+ rake
11
+ rake (0.9.2)
12
+ rcov (0.9.10)
13
+ rspec (2.3.0)
14
+ rspec-core (~> 2.3.0)
15
+ rspec-expectations (~> 2.3.0)
16
+ rspec-mocks (~> 2.3.0)
17
+ rspec-core (2.3.1)
18
+ rspec-expectations (2.3.0)
19
+ diff-lcs (~> 1.1.2)
20
+ rspec-mocks (2.3.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bio (>= 1.4.1)
27
+ bundler (~> 1.0.0)
28
+ jeweler (~> 1.6.4)
29
+ rcov
30
+ rspec (~> 2.3.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Hiroyuki Mishima
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ = bio-dbsnp
2
+
3
+ A library to decode "bitfield" information in dbSNP. In VCF format, bitfiled is contained in the "VP" field in the INFO column.
4
+
5
+ Further details of the format is shown in ftp://ftp.ncbi.nlm.nih.gov/snp/specs/dbSNP_BitField_latest.pdf
6
+
7
+ = how to install
8
+ gem install bio-dbsnp
9
+
10
+ = how to use
11
+ require 'bio-dbsnp'
12
+
13
+ vp = "050000000000000000000200"
14
+ bf = Bio::NCBI::Dbsnp::Bitfield.parse vp
15
+ bf.version #=> 5
16
+ bf.variation_class #=> :dips
17
+
18
+ See lib/bio/ncbi/dbsnp/bitfield.rb for implementation. spec/bio-dbsnp_spec.rb also describes a usage.
19
+
20
+ == Copyright
21
+
22
+ Copyright (c) 2011 Hiroyuki Mishima (missy at be.to, @mishimahryk at Twitter).
23
+ See LICENSE.txt (the MIT Licence) for further details.
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification...
17
+ # see http://docs.rubygems.org/read/chapter/20 for more options
18
+ gem.name = "bio-dbsnp"
19
+ gem.homepage = "http://github.com/misshie/bioruby-dbsnp"
20
+ gem.license = "MIT"
21
+ gem.summary = %Q{decoding the dbSNP bitfield}
22
+ gem.description = %Q{decoding the dbSNP bitfield containg detaild information}
23
+ gem.email = "missy@be.to"
24
+ gem.authors = ["Hiroyuki Mishima"]
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "bio-dbsnp #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{bio-dbsnp}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Hiroyuki Mishima}]
12
+ s.date = %q{2011-11-03}
13
+ s.description = %q{decoding the dbSNP bitfield containg detaild information}
14
+ s.email = %q{missy@be.to}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bio-dbsnp.gemspec",
29
+ "lib/bio-dbsnp.rb",
30
+ "lib/bio/ncbi/dbsnp.rb",
31
+ "lib/bio/ncbi/dbsnp/bitfield.rb",
32
+ "spec/bio-dbsnp_spec.rb",
33
+ "spec/spec_helper.rb"
34
+ ]
35
+ s.homepage = %q{http://github.com/misshie/bioruby-dbsnp}
36
+ s.licenses = [%q{MIT}]
37
+ s.require_paths = [%q{lib}]
38
+ s.rubygems_version = %q{1.8.6}
39
+ s.summary = %q{decoding the dbSNP bitfield}
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
48
+ s.add_development_dependency(%q<rcov>, [">= 0"])
49
+ s.add_development_dependency(%q<bio>, [">= 1.4.1"])
50
+ else
51
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
52
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
54
+ s.add_dependency(%q<rcov>, [">= 0"])
55
+ s.add_dependency(%q<bio>, [">= 1.4.1"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
61
+ s.add_dependency(%q<rcov>, [">= 0"])
62
+ s.add_dependency(%q<bio>, [">= 1.4.1"])
63
+ end
64
+ end
65
+
@@ -0,0 +1,12 @@
1
+ # Please require your code below, respecting the bioruby directory tree.
2
+ # For instance, perhaps the only uncommented line in this file might
3
+ # be something like this:
4
+ #
5
+ # require 'bio/sequence/awesome_sequence_plugin_thingy'
6
+ #
7
+ # and then create the ruby file 'lib/bio/sequence/awesome_sequence_thingy.rb'
8
+ # and put your plugin's code there. It is bad practice to write other code
9
+ # directly into this file, because doing so causes confusion if this biogem
10
+ # was ever to get merged into the main bioruby tree.
11
+
12
+ require 'bio/ncbi/dbsnp'
@@ -0,0 +1 @@
1
+ require 'bio/ncbi/dbsnp/bitfield'
@@ -0,0 +1,198 @@
1
+ module Bio
2
+ module NCBI
3
+ module Dbsnp
4
+
5
+ class Bitfield
6
+ def initialize(byte_stream)
7
+ @byte_stream = byte_stream
8
+ ver = version
9
+ raise "Unsupported bitfield version (ver.#{ver})" unless ver == 5
10
+ end
11
+
12
+ attr_reader :byte_stream
13
+
14
+ def self.parse(bitfield_str)
15
+ byte_stream = Array.new
16
+ bitfield_str.tr("_","").chars.each_slice(2) do |byte_str|
17
+ byte_stream << Integer("0x#{byte_str.join("")}")
18
+ end
19
+ self.new(byte_stream)
20
+ end
21
+
22
+ def field(fnum)
23
+ case fnum
24
+ when 0
25
+ byte_stream[0]
26
+ when 1
27
+ (byte_stream[2] << 8) + byte_stream[1]
28
+ when 2
29
+ (byte_stream[4] << 8) + byte_stream[3]
30
+ else
31
+ byte_stream[fnum + 2]
32
+ end
33
+ end
34
+
35
+ # field F0
36
+ def version
37
+ field(0) & 0b0000_1111
38
+ end
39
+
40
+ # field F1
41
+ def resource_link
42
+ fld = field(1)
43
+ res = Array.new
44
+ res << :clinical if bit? fld, 0b100_0000_0000_0000
45
+ res << :precious if bit? fld, 0b010_0000_0000_0000
46
+ res << :provisional_tpa if bit? fld, 0b001_0000_0000_0000
47
+ res << :pubmed_central_article if bit? fld, 0b000_1000_0000_0000
48
+ res << :short_read_archive if bit? fld, 0b000_0100_0000_0000
49
+ res << :organism_dblink if bit? fld, 0b000_0010_0000_0000
50
+ res << :mgc_clone if bit? fld, 0b000_0001_0000_0000
51
+ res << :trace_archive if bit? fld, 0b000_0000_1000_0000
52
+ res << :assemby_archive if bit? fld, 0b000_0000_0100_0000
53
+ res << :entrez_geo if bit? fld, 0b000_0000_0010_0000
54
+ res << :peobe_db if bit? fld, 0b000_0000_0001_0000
55
+ res << :entrez_gene if bit? fld, 0b000_0000_0000_1000
56
+ res << :entrez_sts if bit? fld, 0b000_0000_0000_0100
57
+ res << :threed_structure if bit? fld, 0b000_0000_0000_0010
58
+ res << :submitter_link_out if bit? fld, 0b000_0000_0000_0001
59
+ res
60
+ end
61
+
62
+ # field F2
63
+ def gene_function
64
+ fld = field(2)
65
+ res = Array.new
66
+ res << :stop_loss if bit? fld, 0b10_0000_0000_0000
67
+ res << :non_synonymous_frameshift if bit? fld, 0b01_0000_0000_0000
68
+ res << :non_synonymous_missense if bit? fld, 0b00_1000_0000_0000
69
+ res << :stop_gain if bit? fld, 0b00_0100_0000_0000
70
+ res << :reference if bit? fld, 0b00_0010_0000_0000
71
+ res << :synonymous if bit? fld, 0b00_0001_0000_0000
72
+ res << :utr_3p if bit? fld, 0b00_0000_1000_0000
73
+ res << :utr_5p if bit? fld, 0b00_0000_0100_0000
74
+ res << :acceptor_splice_site if bit? fld, 0b00_0000_0010_0000
75
+ res << :donor_splice_site if bit? fld, 0b00_0000_0001_0000
76
+ res << :intron if bit? fld, 0b00_0000_0000_1000
77
+ res << :gene_region_3p if bit? fld, 0b00_0000_0000_0100
78
+ res << :gene_region_5p if bit? fld, 0b00_0000_0000_0010
79
+ res << :gene_segment if bit? fld, 0b00_0000_0000_0001
80
+ res
81
+ end
82
+
83
+ # field F3
84
+ def mapping
85
+ fld = field(3)
86
+ res = Array.new
87
+ res << :other_snp if bit? fld, 0b1_0000
88
+ res << :assembly_conflict if bit? fld, 0b0_1000
89
+ res << :assembly_specific if bit? fld, 0b0_0100
90
+ res << :weight3 if bit? fld, 0b0_0011
91
+ res << :weight2 if bit? fld, 0b0_0010
92
+ res << :weight1 if bit? fld, 0b0_0001
93
+ res << :unmapped if (fld & 0b0000_0011) == 0
94
+ res
95
+ end
96
+
97
+ # field F4
98
+ def allele_frequency
99
+ fld = field(4)
100
+ res = Array.new
101
+ res << :mutation if bit? fld, 0b1000
102
+ res << :validated if bit? fld, 0b0100
103
+ res << :maf_gt5_each_and_all_populations if bit? fld, 0b0010
104
+ res << :maf_gt5_in_1plus_populations if bit? fld, 0b0001
105
+ res
106
+ end
107
+
108
+ # field F5
109
+ def genotype
110
+ fld = field(5)
111
+ res = Array.new
112
+ res << :high_density if bit? fld, 0b0100
113
+ res << :haplotype_tagging_set if bit? fld, 0b0010
114
+ res << :available if bit? fld, 0b0001
115
+ res
116
+ end
117
+
118
+ # field F6
119
+ def validation
120
+ fld = field(6)
121
+ res = Array.new
122
+ res << :tgp_2010_production if bit? fld, 0b100_0000
123
+ res << :tgp_validated if bit? fld, 0b010_0000
124
+ res << :tgp_2010_pilot if bit? fld, 0b001_0000
125
+ res << :tgp_2009_phase1 if bit? fld, 0b000_1000
126
+ res << :phase_3_genotyped if bit? fld, 0b000_0100
127
+ res << :phase_2_genotyped if bit? fld, 0b000_0010
128
+ res << :phase_1_genotyped if bit? fld, 0b000_0001
129
+ res
130
+ end
131
+
132
+ # field F7
133
+ def phenotype
134
+ fld = field(7)
135
+ res = Array.new
136
+ res << :mesh_disease if bit? fld, 0b1000_0000
137
+ res << :clinical_diagnosis if bit? fld, 0b0100_0000
138
+ res << :transciption_factor if bit? fld, 0b0010_0000
139
+ res << :locus_specific_database if bit? fld, 0b0001_0000
140
+ res << :dbgap_p_valued if bit? fld, 0b0000_1000
141
+ res << :dbgap_lod if bit? fld, 0b0000_0100
142
+ res << :tpa_gwas_page if bit? fld, 0b0000_0010
143
+ res << :omim_omia if bit? fld, 0b0000_0001
144
+ res
145
+ end
146
+
147
+ # field F8
148
+ def variation_class
149
+ case (field(8) & 0b0000_1111)
150
+ when 0b0001
151
+ :snp
152
+ when 0b0010
153
+ :dips
154
+ when 0b0011
155
+ :heterozygous
156
+ when 0b0100
157
+ :microsatellite
158
+ when 0b0101
159
+ :named_variation
160
+ when 0b0110
161
+ :novariation
162
+ when 0b0111
163
+ :mixed_class
164
+ when 0b1000
165
+ :multibase_polymorphism
166
+ else
167
+ raise "Should not happen! Check bitfield verison."
168
+ end
169
+ end
170
+
171
+ # field F9
172
+ def quality_check
173
+ fld = field(9)
174
+ res = Array.new
175
+ res << :suspect if bit? fld, 0b00_0000_0100_0000
176
+ res << :somatic if bit? fld, 0b00_0000_0010_0000
177
+ res << :reference_allele_missing if bit? fld, 0b00_0000_0001_0000
178
+ res << :withdrawn_by_submitter if bit? fld, 0b00_0000_0000_1000
179
+ res << :no_allele_overlap if bit? fld, 0b00_0000_0000_0100
180
+ res << :strain_specific_fiexed_defference if bit? fld, 0b00_0000_0000_0010
181
+ res << :genotype_conflict if bit? fld, 0b00_0000_0000_0001
182
+ res
183
+ end
184
+
185
+ private
186
+
187
+ def bit?(subj, bit)
188
+ if (subj & bit) == bit
189
+ true
190
+ else
191
+ false
192
+ end
193
+ end
194
+ end # class Bitfield
195
+
196
+ end # module Dbsnp
197
+ end # module NCBI
198
+ end #module Bio
@@ -0,0 +1,156 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Dbsnp" do
4
+ describe "Bitfield" do
5
+
6
+ describe ".parse" do
7
+ context "given a string '050000000009000110000100'" do
8
+ it "returns a new instance of Bio::NCBI::Dbsnp" do
9
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050000000009000110000100')
10
+ obj.should be_an_instance_of(Bio::NCBI::Dbsnp::Bitfield)
11
+ end
12
+ end
13
+
14
+ context "given a string '010000000009000110000100' for .parse" do
15
+ it "raises RuntimeError" do
16
+ str = '010000000009000110000100'
17
+ expect { Bio::NCBI::Dbsnp::Bitfield.parse(str) }.to raise_error(RuntimeError)
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ describe "#byte_stream" do
24
+ context "given a string '050000000009000110000100' for .parse" do
25
+ it "returns an array ary[0] == 5" do
26
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050000000009000110000100')
27
+ obj.byte_stream[0].should == 5
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "#field" do
33
+ context "given (1) with a string '050102030405060708090A0B' for .parse" do
34
+ it "returns 0x0201" do
35
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050102030405060708090A0B')
36
+ obj.field(1).should == 0x0201
37
+ end
38
+ end
39
+ end
40
+
41
+ describe "#bit? (private method)" do
42
+ context "given (0b0010, 0b0010)" do
43
+ it "returns true" do
44
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050000000000000000000200')
45
+ obj.__send__(:bit?, 0b0010, 0b0010).should be_true
46
+ end
47
+ end
48
+
49
+ context "given (0b0010, 0b0111)" do
50
+ it "returns false" do
51
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050000000000000000000200')
52
+ obj.__send__(:bit?, 0b0010, 0b0111).should be_false
53
+ end
54
+ end
55
+
56
+ context "given (0b1111, 0b0111)" do
57
+ it "returns true" do
58
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050000000000000000000200')
59
+ obj.__send__(:bit?, 0b1111, 0b0111).should be_true
60
+ end
61
+ end
62
+ end
63
+
64
+ describe "[F0] #version" do
65
+ context "given a string '050000000009000110000100' for .parse" do
66
+ it "returns 5" do
67
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050000000009000110000100')
68
+ obj.version.should == 5
69
+ end
70
+ end
71
+ end
72
+
73
+ describe "[F1] #resource_link" do
74
+ context "given a string '050300000301040400000100' of rs55874132 for .parse" do
75
+ it "returns an array containing :threed_structure and :submitter_link_out" do
76
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050300000301040400000100')
77
+ obj.resource_link.should include(:threed_structure, :submitter_link_out)
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "[F2] #gene_function" do
83
+ context "given a string '050300000301040400000100' of rs55874132 for .parse" do
84
+ it "returns an array containing :reference, :synonymous" do
85
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('050300000301040400000100')
86
+ obj.gene_function.should include(:reference, :synonymous)
87
+ end
88
+ end
89
+ end
90
+
91
+ describe "[F3] #mapping" do
92
+ context "given a string '05_0300_0003_01_04_04_00_00_01_00' of rs55874132 for .parse" do
93
+ it "returns an array containing :weight1" do
94
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0300_0003_01_04_04_00_00_01_00')
95
+ obj.mapping.should include(:weight1)
96
+ end
97
+ end
98
+ end
99
+
100
+ describe "[F4] #allele_frequency" do
101
+ context "given a string '05_0300_0003_01_04_04_00_00_01_00' of rs55874132 for .parse" do
102
+ it "returns an array containing :validated" do
103
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0300_0003_01_04_04_00_00_01_00')
104
+ obj.allele_frequency.should include(:validated)
105
+ end
106
+ end
107
+ end
108
+
109
+ describe "[F5] #genotype" do
110
+ context "given a string '05_0300_0003_01_04_04_00_00_01_00' of rs55874132 for .parse" do
111
+ it "returns an array containing :high_density" do
112
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0300_0003_01_04_04_00_00_01_00')
113
+ obj.genotype.should include(:high_density)
114
+ end
115
+ end
116
+ end
117
+
118
+ describe "[F6] #validation" do
119
+ context "given a string '05_0000_0000_05_03_00_10_00_01_00' of rs117577454 for .parse" do
120
+ it "returns an array containing :tgp_2010_pilot" do
121
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0000_0000_05_03_00_10_00_01_00')
122
+ obj.validation.should include(:tgp_2010_pilot)
123
+ end
124
+ end
125
+ end
126
+
127
+ describe "[F7] #phenotype" do
128
+ context "given a string '05_0128_0000_01_03_05_12_02_01_00' of rs3934834 for .parse" do
129
+ it "returns an array containing :tpa_gwas_page" do
130
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0128_0000_01_03_05_12_02_01_00')
131
+ obj.phenotype.should include(:tpa_gwas_page)
132
+ end
133
+ end
134
+ end
135
+
136
+ describe "[F8] #variation_class" do
137
+ context "given a string '05_0000_0000_00_00_00_00_00_02_00' for .parse" do
138
+ it "returns ':indel'" do
139
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0000_0000_00_00_00_00_00_02_00')
140
+ obj.variation_class.should == :dips
141
+ end
142
+ end
143
+ end
144
+
145
+ describe "[F9] #quality_check" do
146
+ context "given a string '05_0000_0000_01_00_00_10_00_01_40' of rs62637813 for .parse" do
147
+ it "returns an array containing ':suspect'" do
148
+ obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0000_0000_01_00_00_10_00_01_40')
149
+ # 0x40 = 0b0100_0000
150
+ obj.quality_check.should include(:suspect)
151
+ end
152
+ end
153
+ end
154
+
155
+ end
156
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'bio-dbsnp'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-dbsnp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Hiroyuki Mishima
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &96529700 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.3.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *96529700
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &96529100 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *96529100
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &96528600 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.4
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *96528600
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &96528080 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *96528080
58
+ - !ruby/object:Gem::Dependency
59
+ name: bio
60
+ requirement: &96527500 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 1.4.1
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *96527500
69
+ description: decoding the dbSNP bitfield containg detaild information
70
+ email: missy@be.to
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files:
74
+ - LICENSE.txt
75
+ - README.rdoc
76
+ files:
77
+ - .document
78
+ - .rspec
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.rdoc
83
+ - Rakefile
84
+ - VERSION
85
+ - bio-dbsnp.gemspec
86
+ - lib/bio-dbsnp.rb
87
+ - lib/bio/ncbi/dbsnp.rb
88
+ - lib/bio/ncbi/dbsnp/bitfield.rb
89
+ - spec/bio-dbsnp_spec.rb
90
+ - spec/spec_helper.rb
91
+ homepage: http://github.com/misshie/bioruby-dbsnp
92
+ licenses:
93
+ - MIT
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ segments:
105
+ - 0
106
+ hash: 3024424425824902007
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 1.8.6
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: decoding the dbSNP bitfield
119
+ test_files: []