goruby 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/go.rb +8 -5
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/go.rb
CHANGED
@@ -7,7 +7,6 @@ module Bio
|
|
7
7
|
def initialize
|
8
8
|
@r = RSRuby.instance
|
9
9
|
@r.library('GO.db')
|
10
|
-
# @r.print('initing') #debug to test if this is being loaded twice
|
11
10
|
end
|
12
11
|
|
13
12
|
# Return an array of GO identifiers that are the offspring (all the descendents)
|
@@ -70,13 +69,17 @@ module Bio
|
|
70
69
|
#Synonym: ThTPase activity
|
71
70
|
#Synonym: GO:0048253
|
72
71
|
#Secondary: GO:0048253
|
72
|
+
|
73
|
+
# A performance note:
|
74
|
+
# According to some tests that I ran, finding GOID by searching GOTERM
|
75
|
+
# is much faster than by GOSYNONYM. A
|
73
76
|
|
74
77
|
begin
|
75
|
-
#
|
76
|
-
return @r.eval_R("GOID(get('#{go_id_or_synonym_id}', GOSYNONYM))")
|
77
|
-
rescue RException
|
78
|
-
# if no synonym is found, try to find the primary ID. raise RException if none is found
|
78
|
+
# Assume it is a primary ID, as it likely will be most of the time.
|
79
79
|
return @r.eval_R("GOID(get('#{go_id_or_synonym_id}', GOTERM))")
|
80
|
+
rescue RException
|
81
|
+
# if no primary is found, try to finding it by synonym. raise RException if none is found
|
82
|
+
return @r.eval_R("GOID(get('#{go_id_or_synonym_id}', GOSYNONYM))")
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|