bio-ucsc-api 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -3
- data/Gemfile.lock +12 -12
- data/README.rdoc +44 -8
- data/VERSION +1 -1
- data/bio-ucsc-api.gemspec +12 -11
- data/lib/bio-ucsc-api.rb +1 -1
- data/lib/bio-ucsc.rb +5 -1
- data/lib/bio-ucsc/table_class_detector.rb +16 -22
- data/samples/snp2genes.rb +111 -0
- metadata +27 -26
data/Gemfile
CHANGED
@@ -2,9 +2,9 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
|
-
gem "activerecord", "
|
6
|
-
gem "activesupport", "
|
7
|
-
gem "mysql", "
|
5
|
+
gem "activerecord", "~> 3.0.7"
|
6
|
+
gem "activesupport", "~> 3.0.7"
|
7
|
+
gem "mysql", "~> 2.8.1"
|
8
8
|
gem "bio-genomic-interval", ">= 0.1.2"
|
9
9
|
|
10
10
|
# Add dependencies to develop your gem here.
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.0.
|
5
|
-
activesupport (= 3.0.
|
4
|
+
activemodel (3.0.10)
|
5
|
+
activesupport (= 3.0.10)
|
6
6
|
builder (~> 2.1.2)
|
7
7
|
i18n (~> 0.5.0)
|
8
|
-
activerecord (3.0.
|
9
|
-
activemodel (= 3.0.
|
10
|
-
activesupport (= 3.0.
|
8
|
+
activerecord (3.0.10)
|
9
|
+
activemodel (= 3.0.10)
|
10
|
+
activesupport (= 3.0.10)
|
11
11
|
arel (~> 2.0.10)
|
12
12
|
tzinfo (~> 0.3.23)
|
13
|
-
activesupport (3.0.
|
13
|
+
activesupport (3.0.10)
|
14
14
|
arel (2.0.10)
|
15
|
-
bio (1.4.
|
15
|
+
bio (1.4.2)
|
16
16
|
bio-genomic-interval (0.1.2)
|
17
17
|
builder (2.1.2)
|
18
|
-
diff-lcs (1.1.
|
18
|
+
diff-lcs (1.1.3)
|
19
19
|
git (1.2.5)
|
20
20
|
i18n (0.5.0)
|
21
21
|
jeweler (1.5.2)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
mysql (2.8.1)
|
26
26
|
rake (0.9.2)
|
27
27
|
rcov (0.9.10)
|
28
|
-
rdoc (3.9.
|
28
|
+
rdoc (3.9.4)
|
29
29
|
rspec (2.5.0)
|
30
30
|
rspec-core (~> 2.5.0)
|
31
31
|
rspec-expectations (~> 2.5.0)
|
@@ -40,13 +40,13 @@ PLATFORMS
|
|
40
40
|
ruby
|
41
41
|
|
42
42
|
DEPENDENCIES
|
43
|
-
activerecord (
|
44
|
-
activesupport (
|
43
|
+
activerecord (~> 3.0.7)
|
44
|
+
activesupport (~> 3.0.7)
|
45
45
|
bio (>= 1.4.1)
|
46
46
|
bio-genomic-interval (>= 0.1.2)
|
47
47
|
bundler (~> 1.0.0)
|
48
48
|
jeweler (~> 1.5.2)
|
49
|
-
mysql (
|
49
|
+
mysql (~> 2.8.1)
|
50
50
|
rcov
|
51
51
|
rdoc (>= 3.9.1)
|
52
52
|
rspec (~> 2.5.0)
|
data/README.rdoc
CHANGED
@@ -6,6 +6,12 @@ Your comments, suggestions and requests are welcome. Documentation and
|
|
6
6
|
feedback are available at the UserEcho site at
|
7
7
|
http://rubyucscapi.userecho.com/.
|
8
8
|
|
9
|
+
== Install
|
10
|
+
|
11
|
+
$ gem install bio-ucsc-api --no-ri --no-rdoc
|
12
|
+
|
13
|
+
You may need to be root or use "sudo". "--no-ri" and "--no-rdoc" options are recommended because generation of ri/rdoc files takes considerable time.
|
14
|
+
|
9
15
|
== Features
|
10
16
|
|
11
17
|
* Supporting all organisms in the UCSC genome database.
|
@@ -44,7 +50,7 @@ Supported Ruby interpreter implementations:
|
|
44
50
|
|
45
51
|
Major dependent gems:
|
46
52
|
|
47
|
-
* active_record - http://api.rubyonrails.org/classes/ActiveRecord/Base.html
|
53
|
+
* active_record (version ~> 3.0.7. version 3.1 is not supported yet.) - http://api.rubyonrails.org/classes/ActiveRecord/Base.html
|
48
54
|
* bioruby-genomic-interval - https://github.com/misshie/bioruby-genomic-interval
|
49
55
|
* mysql (MySQL/Ruby MySQL API module) - http://www.tmtm.org/mysql/ruby/README.html
|
50
56
|
|
@@ -54,6 +60,9 @@ See also:
|
|
54
60
|
* UCSCBin library - https://github.com/misshie/UCSCBin
|
55
61
|
|
56
62
|
== Change Log
|
63
|
+
* *BUG* (v.0.3.1): Does not work with ActiveRecord version 3.1.0. Data retrieval methods occur the error, "(Object doesn't support #inspect)". The author is working on this bug. So far, please use version 3.0 seriese. Gemfile for gem dependencies is updated. Thanks for bug reports from Diego Pereira.
|
64
|
+
* *BUG-FIX* (v.0.3.1): "func" fields in tables did not work. The bug was fixed.
|
65
|
+
* *BUG-FIX* (v.0.3.1): PredGene-type tables without the bin index did not work. The bug was fixed.
|
57
66
|
* *NEW* (v.0.3.0): Now genomic interval queries are expressed using the named scope "with_interval". Table#find_(all_)by_interval is now deprecated. Sorry for an inconstant API. However, this change enable combination queries using genomic intervals and any fields.
|
58
67
|
* *NEW* (v.0.3.0): Bio::GenomicInterval#bin_all and Bio::GenomicInterval#bin return the bin index for the given interval.
|
59
68
|
* *NEW* (v.0.3.0): Supporting JRuby 1.6.3 or later. Appropiate Java heap size may have to be specified to invoke JRuby, especially when you use Bio::Ucsc::Reference. Try "jruby -J-Xmx3g your_script.rb" to keep 3G byte heap.
|
@@ -71,12 +80,6 @@ See also:
|
|
71
80
|
* *MODIFIED* (v0.0.3): For the "TABLE" class and the "column" column, TABLE.find_by_column retrieves a first record, and TABLE.find_all_by_column retrieves all the records as an Array.
|
72
81
|
* *NEW* (v0.0.3-0.0.4): Supporting tables divided into each chromosome, such as "*_RmsK" and "*_gold". Actual names of them are like "chr1_Rmsk", "chr2_Rmsk"... They can be accessed without chromosome names; but with just like "Rmsk" and "Gold".
|
73
82
|
|
74
|
-
== Install
|
75
|
-
|
76
|
-
$ gem install bio-ucsc-api --no-ri --no-rdoc
|
77
|
-
|
78
|
-
You may need to be root or use "sudo". "--no-ri" and "--no-rdoc" options are recommended because generation of ri/rdoc files takes considerable time.
|
79
|
-
|
80
83
|
== How to Use
|
81
84
|
=== Basics
|
82
85
|
* A database of a genome assembly is represented as a module in the Bio::Ucsc module. For example, human hg19 database is referred by "Bio::Ucsc::Hg19".
|
@@ -142,6 +145,7 @@ And see also sample scripts in the samples directory.
|
|
142
145
|
* symbol2summary.rb - getting summary descriptions using gene symbol
|
143
146
|
* hg19-2bit-retrieve - outputting reference sequence in FASTA format
|
144
147
|
* bed2refseq - getting unique gene symbols in the genomic intervals in a BED file.
|
148
|
+
* snp2gene - sample for retrieving fields from associated tables
|
145
149
|
|
146
150
|
=== Notes of Exceptions in Table Support
|
147
151
|
* Table names starting with a number: Because Ruby class names cannot start with number, use the table class name starting with "T" (T for Table). Thus, the "2micron_est" table is supported by the "T2micron_est" class.
|
@@ -150,7 +154,7 @@ And see also sample scripts in the samples directory.
|
|
150
154
|
* For honey bee ApiMel2 database, Group*_chainDm2 and Group*_chainDm2Link tables are accessible using find(_all)_by_interval class methods of the ChainDm2 and ChainDm2Link classes.
|
151
155
|
* Special field (column) names: Field names such as 'attribute', 'valid', 'validate', 'class', 'method', 'methods', and 'type' cannot be accessed using instance methods. This restriction is because of the collision of method names that are internally used by ActiveRecord. Instead, use hash to access the field like "result[:type]".
|
152
156
|
|
153
|
-
===
|
157
|
+
=== Details in "with_interval"
|
154
158
|
* When a table class is referred first time, the API prefetches the table to get a list of fields and dynamically defines a class using following algorithm.
|
155
159
|
* If chrom/chromStart/chromEnd fields exist (BED table), the API uses them for interval queries.
|
156
160
|
* When tName/tStart/tEnd fields exist (PSL table), the API uses them for interval queries.
|
@@ -158,6 +162,38 @@ And see also sample scripts in the samples directory.
|
|
158
162
|
* When genoName/genoStart/genoEnd fields exist (RMSK table), the API uses them for interval queries.
|
159
163
|
* If the table has the "bin" column, the API calculate bin index to build a query.
|
160
164
|
* Otherwise, the API does not support interval queries but support only ActiveRecord's standard methods such as "find_(all_)by_[field name]".
|
165
|
+
=== Table Associations
|
166
|
+
See samples/snp2gene.rb. Association definition using "has_one/has_many/belongs_to" methods is shown below. class_eval is used not to replace but to add definition.
|
167
|
+
|
168
|
+
Bio::Ucsc::Hg19::KnownGene.class_eval %!
|
169
|
+
has_one :knownToEnsembl, {:primary_key => :name, :foreign_key => :name}
|
170
|
+
!
|
171
|
+
Bio::Ucsc::Hg19::KnownToEnsembl.class_eval %!
|
172
|
+
belongs_to :knownGene
|
173
|
+
has_one :ensGtp, {:primary_key => :value, :foreign_key => :transcript}
|
174
|
+
has_one :kgXref, {:primary_key => :name, :foreign_key => :kgID}
|
175
|
+
!
|
176
|
+
Bio::Ucsc::Hg19::EnsGtp.class_eval %!
|
177
|
+
belongs_to :knownToEnsembl
|
178
|
+
!
|
179
|
+
Bio::Ucsc::Hg19::KgXref.class_eval %!
|
180
|
+
belongs_to :knownToEnsembl
|
181
|
+
has_one :refLink, {:primary_key => :mRNA, :foreign_key => :mrnaAcc}
|
182
|
+
!
|
183
|
+
Bio::Ucsc::Hg19::RefLink.class_eval %!
|
184
|
+
belongs_to :kgXref
|
185
|
+
!
|
186
|
+
|
187
|
+
ActiveRecord::Base#find can be used with the :include option to perform "eager fetching".
|
188
|
+
kg = Bio::Ucsc::Hg19::KnownGene.with_interval(gi).
|
189
|
+
find(:first,
|
190
|
+
:include => [:knownToEnsembl => :ensGtp,
|
191
|
+
:knownToEnsembl => {:kgXref => :refLink}])
|
192
|
+
|
193
|
+
And fields can be referred like the followings:
|
194
|
+
kg.knownToEnsembl.ensGtp.gene
|
195
|
+
kg.knownToEnsembl.kgXref.geneSymbol
|
196
|
+
kg.knownToEnsembl.kgXref.refLink.mrnaAcc
|
161
197
|
|
162
198
|
== Copyright
|
163
199
|
Copyright:: (c) 2011 MISHIMA, Hiroyuki (missy at be.to / hmishima at nagasaki-u.ac.jp / @mishimahryk in Twitter)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/bio-ucsc-api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bio-ucsc-api}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Hiroyuki Mishima}, %q{Jan Aerts}]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-06}
|
13
13
|
s.description = %q{Ruby UCSC API: accessing the UCSC Genome Database using Ruby}
|
14
14
|
s.email = %q{missy@be.to}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -524,6 +524,7 @@ Gem::Specification.new do |s|
|
|
524
524
|
"samples/hg19-2bit-retrieve.rb",
|
525
525
|
"samples/hg19-sample.rb",
|
526
526
|
"samples/num-gene-exon.rb",
|
527
|
+
"samples/snp2genes.rb",
|
527
528
|
"samples/symbol2summary.rb"
|
528
529
|
]
|
529
530
|
s.homepage = %q{http://github.com/misshie/bioruby-ucsc-api}
|
@@ -5481,9 +5482,9 @@ Gem::Specification.new do |s|
|
|
5481
5482
|
s.specification_version = 3
|
5482
5483
|
|
5483
5484
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
5484
|
-
s.add_runtime_dependency(%q<activerecord>, ["
|
5485
|
-
s.add_runtime_dependency(%q<activesupport>, ["
|
5486
|
-
s.add_runtime_dependency(%q<mysql>, ["
|
5485
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.7"])
|
5486
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.7"])
|
5487
|
+
s.add_runtime_dependency(%q<mysql>, ["~> 2.8.1"])
|
5487
5488
|
s.add_runtime_dependency(%q<bio-genomic-interval>, [">= 0.1.2"])
|
5488
5489
|
s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
|
5489
5490
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -5492,9 +5493,9 @@ Gem::Specification.new do |s|
|
|
5492
5493
|
s.add_development_dependency(%q<bio>, [">= 1.4.1"])
|
5493
5494
|
s.add_development_dependency(%q<rdoc>, [">= 3.9.1"])
|
5494
5495
|
else
|
5495
|
-
s.add_dependency(%q<activerecord>, ["
|
5496
|
-
s.add_dependency(%q<activesupport>, ["
|
5497
|
-
s.add_dependency(%q<mysql>, ["
|
5496
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.7"])
|
5497
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.7"])
|
5498
|
+
s.add_dependency(%q<mysql>, ["~> 2.8.1"])
|
5498
5499
|
s.add_dependency(%q<bio-genomic-interval>, [">= 0.1.2"])
|
5499
5500
|
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
|
5500
5501
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -5504,9 +5505,9 @@ Gem::Specification.new do |s|
|
|
5504
5505
|
s.add_dependency(%q<rdoc>, [">= 3.9.1"])
|
5505
5506
|
end
|
5506
5507
|
else
|
5507
|
-
s.add_dependency(%q<activerecord>, ["
|
5508
|
-
s.add_dependency(%q<activesupport>, ["
|
5509
|
-
s.add_dependency(%q<mysql>, ["
|
5508
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.7"])
|
5509
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.7"])
|
5510
|
+
s.add_dependency(%q<mysql>, ["~> 2.8.1"])
|
5510
5511
|
s.add_dependency(%q<bio-genomic-interval>, [">= 0.1.2"])
|
5511
5512
|
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
|
5512
5513
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
data/lib/bio-ucsc-api.rb
CHANGED
data/lib/bio-ucsc.rb
CHANGED
@@ -5,12 +5,16 @@
|
|
5
5
|
# License:: Ruby licence (Ryby's / GPLv2 dual)
|
6
6
|
|
7
7
|
base = "#{File.dirname(__FILE__)}/bio-ucsc"
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
gem 'activerecord', "~>3.0.7"
|
11
|
+
require "active_record"
|
8
12
|
require "#{base}/ucsc_bin"
|
9
13
|
require "#{base}/genomic-interval-bin"
|
10
14
|
|
11
15
|
module Bio
|
12
16
|
module Ucsc
|
13
|
-
VERSION = "0.3.
|
17
|
+
VERSION = "0.3.1"
|
14
18
|
base = "#{File.dirname(__FILE__)}/bio-ucsc"
|
15
19
|
|
16
20
|
# mammmals #####################################
|
@@ -10,16 +10,16 @@
|
|
10
10
|
# psl :tableName, :bin => true
|
11
11
|
# bed :tableName, :bin => true
|
12
12
|
# genepred :tableName, :bin=> true
|
13
|
-
#
|
13
|
+
# rmsk :tableName, :bin=> true
|
14
|
+
# generic :tableName
|
14
15
|
#
|
15
|
-
# rmsk :tableName
|
16
16
|
|
17
17
|
module Bio
|
18
18
|
module Ucsc
|
19
19
|
module TableClassDetector
|
20
20
|
|
21
21
|
RESERVED_METHODS =
|
22
|
-
['attribute', 'valid', 'validate', 'class', 'method', 'methods', 'type']
|
22
|
+
['func', 'attribute', 'valid', 'validate', 'class', 'method', 'methods', 'type']
|
23
23
|
UPPERCASED_TABLE_PREFIX =
|
24
24
|
['HInv', 'NIAGene']
|
25
25
|
COMMON_CLASS_METHODS = %!
|
@@ -405,31 +405,25 @@ AND (txEnd BETWEEN :zstart AND :zend))
|
|
405
405
|
#{delete_reserved_methods}
|
406
406
|
#{COMMON_CLASS_METHODS}
|
407
407
|
|
408
|
-
|
409
|
-
if opt[:partial] == true
|
410
|
-
where = <<-SQL
|
408
|
+
where = <<-SQL
|
411
409
|
chrom = :chrom
|
412
410
|
AND ((txStart BETWEEN :zstart AND :zend)
|
413
411
|
OR (txEnd BETWEEN :zstart AND :zend)
|
414
412
|
OR (txStart <= :zstart AND txEnd >= :zend))
|
415
|
-
|
416
|
-
|
417
|
-
|
413
|
+
SQL
|
414
|
+
scope(:with_interval,
|
415
|
+
Proc.new{|gi|{:conditions => [where, {:chrom => gi.chrom,
|
416
|
+
:zstart => gi.zero_start,
|
417
|
+
:zend => gi.zero_end}]}})
|
418
|
+
where = <<-SQL
|
418
419
|
chrom = :chrom
|
419
420
|
AND ((txStart BETWEEN :zstart AND :zend)
|
420
421
|
AND (txEnd BETWEEN :zstart AND :zend))
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
:zend => gi.zero_end,
|
427
|
-
}
|
428
|
-
|
429
|
-
with_scope(:find => {:conditions => [where, values]}) do
|
430
|
-
yield
|
431
|
-
end
|
432
|
-
end # def self.with_interval
|
422
|
+
SQL
|
423
|
+
scope(:with_interval_excl,
|
424
|
+
Proc.new{|gi|{:conditions => [where, {:chrom => gi.chrom,
|
425
|
+
:zstart => gi.zero_start,
|
426
|
+
:zend => gi.zero_end}]}})
|
433
427
|
|
434
428
|
def self.find_first_or_all_by_interval(interval, first_all, opt)
|
435
429
|
zstart = interval.zero_start
|
@@ -455,7 +449,7 @@ AND ((txStart BETWEEN :zstart AND :zend)
|
|
455
449
|
}
|
456
450
|
self.find(first_all,
|
457
451
|
{ :select => "*",
|
458
|
-
:conditions => [where, cond], })
|
452
|
+
:conditions => [where, cond], })-u
|
459
453
|
end
|
460
454
|
end
|
461
455
|
!
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/local/bin/ruby-1.9
|
2
|
+
#
|
3
|
+
# Usage:: snp2genes.rb rs_id (default is "rs100")
|
4
|
+
#
|
5
|
+
# This example is an answer of a question at BioStar
|
6
|
+
# http://biostar.stackexchange.com/questions/9737/mapping-snps-to-genes-and-pathways-go-etc
|
7
|
+
#
|
8
|
+
# Copyright::
|
9
|
+
# Copyright (C) 2011 MISHIMA, Hiroyuki
|
10
|
+
# <missy at be.to / hmishima at ngit agasaki-u.ac.jp>
|
11
|
+
# License:: The Ruby licence (Ryby's / GPLv2 dual)
|
12
|
+
#
|
13
|
+
|
14
|
+
PADDING = 60_000
|
15
|
+
|
16
|
+
# require 'bio-ucsc'
|
17
|
+
require File.dirname(__FILE__) + '/../lib/bio-ucsc'
|
18
|
+
|
19
|
+
# require 'active_record'
|
20
|
+
# require 'logger'
|
21
|
+
# ActiveRecord::Base.logger = Logger.new("sql.log")
|
22
|
+
# ActiveRecord::Base.logger.level = 0
|
23
|
+
|
24
|
+
include Bio
|
25
|
+
|
26
|
+
class Snp2gene
|
27
|
+
def define_association
|
28
|
+
Ucsc::Hg19::KnownGene.class_eval %!
|
29
|
+
has_one :knownToEnsembl, {:primary_key => :name, :foreign_key => :name}
|
30
|
+
!
|
31
|
+
Ucsc::Hg19::KnownToEnsembl.class_eval %!
|
32
|
+
belongs_to :knownGene
|
33
|
+
has_one :ensGtp, {:primary_key => :value, :foreign_key => :transcript}
|
34
|
+
has_one :kgXref, {:primary_key => :name, :foreign_key => :kgID}
|
35
|
+
!
|
36
|
+
Ucsc::Hg19::EnsGtp.class_eval %!
|
37
|
+
belongs_to :knownToEnsembl
|
38
|
+
!
|
39
|
+
Ucsc::Hg19::KgXref.class_eval %!
|
40
|
+
belongs_to :knownToEnsembl
|
41
|
+
has_one :refLink, {:primary_key => :mRNA, :foreign_key => :mrnaAcc}
|
42
|
+
!
|
43
|
+
Ucsc::Hg19::RefLink.class_eval %!
|
44
|
+
belongs_to :kgXref
|
45
|
+
!
|
46
|
+
end
|
47
|
+
|
48
|
+
def run(rs_id)
|
49
|
+
Ucsc::Hg19::DBConnection.connect
|
50
|
+
define_association
|
51
|
+
|
52
|
+
snps = Ucsc::Hg19::Snp132.
|
53
|
+
select([:name, :avHet, :chrom, :chromStart, :chromEnd, :func]).
|
54
|
+
find_all_by_name(rs_id)
|
55
|
+
|
56
|
+
snps.each do |snp|
|
57
|
+
puts "====="
|
58
|
+
gi = GenomicInterval.new("chr1",
|
59
|
+
snp.chromStart - PADDING,
|
60
|
+
snp.chromEnd + PADDING)
|
61
|
+
snp_pos = GenomicInterval.zero_based(snp.chrom, snp.chromStart, snp.chromEnd)
|
62
|
+
|
63
|
+
knowngenes =
|
64
|
+
Ucsc::Hg19::KnownGene.
|
65
|
+
with_interval(gi).
|
66
|
+
find(:all,
|
67
|
+
:include => [:knownToEnsembl => :ensGtp,
|
68
|
+
:knownToEnsembl => {:kgXref => :refLink}])
|
69
|
+
|
70
|
+
if knowngenes.empty?
|
71
|
+
puts "proteinID: NO HIT"
|
72
|
+
puts "name: #{snp.name}"
|
73
|
+
puts "avHet: #{snp.avHet}"
|
74
|
+
puts "chrom: #{snp.chrom}"
|
75
|
+
puts "chromStart: #{snp_pos.chr_start}"
|
76
|
+
puts "func: #{snp.func}"
|
77
|
+
puts
|
78
|
+
next
|
79
|
+
end
|
80
|
+
|
81
|
+
knowngenes.each do |kg|
|
82
|
+
puts "proteinID: #{kg.proteinID}"
|
83
|
+
k2e_gtp = kg.knownToEnsembl.ensGtp
|
84
|
+
puts "ensGtp: gene=#{k2e_gtp.gene}, transcript=#{k2e_gtp.transcript}, protein=#{k2e_gtp.protein}"
|
85
|
+
puts "name: #{snp.name}"
|
86
|
+
puts "avHet: #{snp.avHet}"
|
87
|
+
puts "chrom: #{snp.chrom}"
|
88
|
+
puts "chromStart: #{snp_pos.chr_start}"
|
89
|
+
puts "func: #{snp.func}"
|
90
|
+
puts "txStart: #{kg.txStart}"
|
91
|
+
puts "txEnd: #{kg.txEnd}"
|
92
|
+
puts "kgXref-geneSymbol: #{kg.knownToEnsembl.kgXref.geneSymbol}"
|
93
|
+
puts "kgXref-description: #{kg.knownToEnsembl.kgXref.description}"
|
94
|
+
reflink = kg.knownToEnsembl.kgXref.refLink
|
95
|
+
if reflink
|
96
|
+
mrnaacc = reflink.mrnaAcc
|
97
|
+
else
|
98
|
+
mrnaacc = "NO HIT"
|
99
|
+
end
|
100
|
+
puts "refLink-mrnaAcc: #{mrnaacc}"
|
101
|
+
puts
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if $0 == __FILE__
|
108
|
+
rs_id = ARGV[0]
|
109
|
+
rs_id ||= "rs100"
|
110
|
+
Snp2gene.new.run(rs_id)
|
111
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-ucsc-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,44 +10,44 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-09-06 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
17
|
-
requirement: &
|
17
|
+
requirement: &156765300 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.0.7
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *156765300
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &156764820 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.0.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *156764820
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: mysql
|
39
|
-
requirement: &
|
39
|
+
requirement: &156764340 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: 2.8.1
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *156764340
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: bio-genomic-interval
|
50
|
-
requirement: &
|
50
|
+
requirement: &156763840 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.1.2
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *156763840
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rspec
|
61
|
-
requirement: &
|
61
|
+
requirement: &156763360 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 2.5.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *156763360
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bundler
|
72
|
-
requirement: &
|
72
|
+
requirement: &156762880 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 1.0.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *156762880
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: jeweler
|
83
|
-
requirement: &
|
83
|
+
requirement: &156762400 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.5.2
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *156762400
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: rcov
|
94
|
-
requirement: &
|
94
|
+
requirement: &156761920 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *156761920
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: bio
|
105
|
-
requirement: &
|
105
|
+
requirement: &156761440 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: 1.4.1
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *156761440
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: rdoc
|
116
|
-
requirement: &
|
116
|
+
requirement: &156760960 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version: 3.9.1
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *156760960
|
125
125
|
description: ! 'Ruby UCSC API: accessing the UCSC Genome Database using Ruby'
|
126
126
|
email: missy@be.to
|
127
127
|
executables: []
|
@@ -637,6 +637,7 @@ files:
|
|
637
637
|
- samples/hg19-2bit-retrieve.rb
|
638
638
|
- samples/hg19-sample.rb
|
639
639
|
- samples/num-gene-exon.rb
|
640
|
+
- samples/snp2genes.rb
|
640
641
|
- samples/symbol2summary.rb
|
641
642
|
- spec/ailmel1_spec.rb
|
642
643
|
- spec/anocar2_spec.rb
|
@@ -5596,7 +5597,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
5596
5597
|
version: '0'
|
5597
5598
|
segments:
|
5598
5599
|
- 0
|
5599
|
-
hash:
|
5600
|
+
hash: 1643967241848508000
|
5600
5601
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
5601
5602
|
none: false
|
5602
5603
|
requirements:
|