idclight 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/convert.rb +2 -2
- data/bin/ensembl_to_entrez.rb +32 -0
- data/bin/ensembl_to_hugo.rb +32 -0
- data/bin/hugo_to_ensembl.rb +32 -0
- data/bin/hugo_to_entrez.rb +1 -1
- data/idclight.gemspec +6 -3
- data/lib/idclight.rb +52 -11
- metadata +9 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/bin/convert.rb
CHANGED
@@ -19,12 +19,12 @@ if ARGV.length >= 2 and ARGV.length <= 3
|
|
19
19
|
id_type = ARGV[0]
|
20
20
|
id = ARGV[1]
|
21
21
|
org = ARGV[2] unless ARGV[2].nil?
|
22
|
-
r =
|
22
|
+
r = search(id_type, id, org)
|
23
23
|
if r.nil?
|
24
24
|
puts "No result. Bad input, perhaps? :/"
|
25
25
|
code = 1
|
26
26
|
else
|
27
|
-
puts
|
27
|
+
puts r
|
28
28
|
end
|
29
29
|
else
|
30
30
|
puts "\n\tUsage: #{__FILE__} <id_type> <id> [organism (defaults to human)]"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
current_dir = File.dirname(File.expand_path(__FILE__))
|
4
|
+
lib_path = File.join(current_dir, '..', 'lib')
|
5
|
+
$LOAD_PATH.unshift lib_path
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
|
9
|
+
require 'idclight'
|
10
|
+
|
11
|
+
include IDConverter::Light
|
12
|
+
|
13
|
+
|
14
|
+
code = 0
|
15
|
+
puts "\n"
|
16
|
+
puts "IDCLight (IDConverter Light) command-line converter utility, by Preston Lee. (Screen scapes http://idclight.bioinfo.cnio.es for data.)"
|
17
|
+
if ARGV.length == 1
|
18
|
+
id = ARGV[0]
|
19
|
+
r = ensembl_id_to_entrez_id(id)
|
20
|
+
if r.nil?
|
21
|
+
puts "No result. Bad input, perhaps? :("
|
22
|
+
code = 1
|
23
|
+
else
|
24
|
+
puts "\n#{r}"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
puts "\n\tUsage: #{__FILE__} <id>"
|
28
|
+
end
|
29
|
+
puts "\n"
|
30
|
+
|
31
|
+
exit(code)
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
current_dir = File.dirname(File.expand_path(__FILE__))
|
4
|
+
lib_path = File.join(current_dir, '..', 'lib')
|
5
|
+
$LOAD_PATH.unshift lib_path
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
|
9
|
+
require 'idclight'
|
10
|
+
|
11
|
+
include IDConverter::Light
|
12
|
+
|
13
|
+
|
14
|
+
code = 0
|
15
|
+
puts "\n"
|
16
|
+
puts "IDCLight (IDConverter Light) command-line converter utility, by Preston Lee. (Screen scapes http://idclight.bioinfo.cnio.es for data.)"
|
17
|
+
if ARGV.length == 1
|
18
|
+
id = ARGV[0]
|
19
|
+
r = ensembl_id_to_hugo_id(id)
|
20
|
+
if r.nil?
|
21
|
+
puts "No result. Bad input, perhaps? :("
|
22
|
+
code = 1
|
23
|
+
else
|
24
|
+
puts "\n#{r}"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
puts "\n\tUsage: #{__FILE__} <id>"
|
28
|
+
end
|
29
|
+
puts "\n"
|
30
|
+
|
31
|
+
exit(code)
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
current_dir = File.dirname(File.expand_path(__FILE__))
|
4
|
+
lib_path = File.join(current_dir, '..', 'lib')
|
5
|
+
$LOAD_PATH.unshift lib_path
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
|
9
|
+
require 'idclight'
|
10
|
+
|
11
|
+
include IDConverter::Light
|
12
|
+
|
13
|
+
|
14
|
+
code = 0
|
15
|
+
puts "\n"
|
16
|
+
puts "IDCLight (IDConverter Light) command-line converter utility, by Preston Lee. (Screen scapes http://idclight.bioinfo.cnio.es for data.)"
|
17
|
+
if ARGV.length == 1
|
18
|
+
id = ARGV[0]
|
19
|
+
r = hugo_id_to_ensembl_id(id)
|
20
|
+
if r.nil?
|
21
|
+
puts "No result. Bad input, perhaps? :("
|
22
|
+
code = 1
|
23
|
+
else
|
24
|
+
puts "\n#{r}"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
puts "\n\tUsage: #{__FILE__} <id>"
|
28
|
+
end
|
29
|
+
puts "\n"
|
30
|
+
|
31
|
+
exit(code)
|
32
|
+
|
data/bin/hugo_to_entrez.rb
CHANGED
data/idclight.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{idclight}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Preston Lee"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-11}
|
13
13
|
s.description = %q{A Ruby gem for accessing the freely available IDClight (IDConverter Light) web service, which convert between different types of gene IDs such as Hugo and Entrez. Queries are screen scraped from http://idclight.bioinfo.cnio.es.}
|
14
14
|
s.email = %q{conmotto@gmail.com}
|
15
|
-
s.executables = ["convert.rb", "hugo_to_entrez.rb"]
|
15
|
+
s.executables = ["convert.rb", "ensembl_to_entrez.rb", "ensembl_to_hugo.rb", "hugo_to_ensembl.rb", "hugo_to_entrez.rb"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
18
|
"README.rdoc"
|
@@ -26,6 +26,9 @@ Gem::Specification.new do |s|
|
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"bin/convert.rb",
|
29
|
+
"bin/ensembl_to_entrez.rb",
|
30
|
+
"bin/ensembl_to_hugo.rb",
|
31
|
+
"bin/hugo_to_ensembl.rb",
|
29
32
|
"bin/hugo_to_entrez.rb",
|
30
33
|
"idclight.gemspec",
|
31
34
|
"lib/idclight.rb",
|
data/lib/idclight.rb
CHANGED
@@ -15,7 +15,7 @@ module IDConverter
|
|
15
15
|
# ID type constants.
|
16
16
|
@@UNIGENE = 'ug'
|
17
17
|
@@ENTREZ = 'entrez'
|
18
|
-
@@ENSEMBL = '
|
18
|
+
@@ENSEMBL = 'ensembl'
|
19
19
|
@@HUGO = 'hugo'
|
20
20
|
@@GENBANK = 'acc'
|
21
21
|
@@CLONE = 'clone'
|
@@ -68,17 +68,58 @@ module IDConverter
|
|
68
68
|
|
69
69
|
def hugo_id_to_entrez_id(id, organism = @@HUMAN)
|
70
70
|
data = search(@@HUGO, id, organism)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
71
|
+
extract_entrez_id(data)
|
72
|
+
end
|
73
|
+
|
74
|
+
def hugo_id_to_ensembl_id(id, organism = @@HUMAN)
|
75
|
+
data = search(@@HUGO, id, organism)
|
76
|
+
extract_ensembl_id(data)
|
77
|
+
end
|
78
|
+
|
79
|
+
def ensembl_id_to_entrez_id(id, organism = @@HUMAN)
|
80
|
+
data = search(@@ENSEMBL, id, organism)
|
81
|
+
extract_entrez_id(data)
|
82
|
+
end
|
83
|
+
|
84
|
+
def ensembl_id_to_hugo_id(id, organism = @@HUMAN)
|
85
|
+
data = search(@@ENSEMBL, id, organism)
|
86
|
+
extract_hugo_id(data)
|
81
87
|
end
|
88
|
+
|
89
|
+
def extract_entrez_id(data)
|
90
|
+
ent = data['Entrez Gene']
|
91
|
+
id = nil
|
92
|
+
if ent
|
93
|
+
doc = Hpricot(ent)
|
94
|
+
doc.search('//a').each do |e|
|
95
|
+
tmp = e.inner_html.to_i
|
96
|
+
id = tmp if tmp != 0
|
97
|
+
end
|
98
|
+
end
|
99
|
+
id
|
100
|
+
end
|
101
|
+
|
102
|
+
def extract_hugo_id(data)
|
103
|
+
ent = data['HUGO']
|
104
|
+
extract_last_link_text(ent)
|
105
|
+
end
|
106
|
+
|
107
|
+
def extract_ensembl_id(data)
|
108
|
+
ent = data['Ensembl']
|
109
|
+
extract_last_link_text(ent)
|
110
|
+
end
|
111
|
+
|
112
|
+
def extract_last_link_text(ent)
|
113
|
+
id = nil
|
114
|
+
if ent
|
115
|
+
doc = Hpricot(ent)
|
116
|
+
doc.search('//a').each do |e|
|
117
|
+
tmp = e.inner_html
|
118
|
+
id = tmp if !tmp.nil? && tmp != ''
|
119
|
+
end
|
120
|
+
end
|
121
|
+
id
|
122
|
+
end
|
82
123
|
|
83
124
|
end
|
84
125
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Preston Lee
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-11 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -46,6 +46,9 @@ description: A Ruby gem for accessing the freely available IDClight (IDConverter
|
|
46
46
|
email: conmotto@gmail.com
|
47
47
|
executables:
|
48
48
|
- convert.rb
|
49
|
+
- ensembl_to_entrez.rb
|
50
|
+
- ensembl_to_hugo.rb
|
51
|
+
- hugo_to_ensembl.rb
|
49
52
|
- hugo_to_entrez.rb
|
50
53
|
extensions: []
|
51
54
|
|
@@ -61,6 +64,9 @@ files:
|
|
61
64
|
- Rakefile
|
62
65
|
- VERSION
|
63
66
|
- bin/convert.rb
|
67
|
+
- bin/ensembl_to_entrez.rb
|
68
|
+
- bin/ensembl_to_hugo.rb
|
69
|
+
- bin/hugo_to_ensembl.rb
|
64
70
|
- bin/hugo_to_entrez.rb
|
65
71
|
- idclight.gemspec
|
66
72
|
- lib/idclight.rb
|