eutils 0.1.0 → 0.1.1
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.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/eutils.gemspec +5 -5
- data/lib/eutils.rb +5 -5
- data/test/test_eutils.rb +10 -9
- metadata +8 -5
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/seouri/eutils"
|
12
12
|
gem.authors = ["Joon Lee"]
|
13
13
|
gem.add_development_dependency "shoulda", ">= 0"
|
14
|
-
gem.add_dependency "
|
14
|
+
gem.add_dependency "activesupport", ">= 3.0.0.rc2"
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/eutils.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{eutils}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joon Lee"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-26}
|
13
13
|
s.description = %q{This gem only provides API for NCBI Eutils. If you need full access to other NCBI databases, try BioRuby (bio gem) instead.}
|
14
14
|
s.email = %q{seouri@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -43,14 +43,14 @@ Gem::Specification.new do |s|
|
|
43
43
|
|
44
44
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
45
45
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
46
|
-
s.add_runtime_dependency(%q<
|
46
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.rc2"])
|
47
47
|
else
|
48
48
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
49
|
-
s.add_dependency(%q<
|
49
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0.rc2"])
|
50
50
|
end
|
51
51
|
else
|
52
52
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
53
|
-
s.add_dependency(%q<
|
53
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0.rc2"])
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
data/lib/eutils.rb
CHANGED
@@ -30,7 +30,7 @@ class Eutils
|
|
30
30
|
if db.nil? || db.empty?
|
31
31
|
return response.scan(/<DbName>(\w+)<\/DbName>/).flatten
|
32
32
|
else
|
33
|
-
return Hash.from_xml(response)
|
33
|
+
return Hash.from_xml(response)["eInfoResult"]
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -44,7 +44,7 @@ class Eutils
|
|
44
44
|
params["usehistory"] ||= "y"
|
45
45
|
server = EUTILS_HOST + "esearch.fcgi"
|
46
46
|
response = post_eutils(server, params)
|
47
|
-
return Hash.from_xml(response)
|
47
|
+
return Hash.from_xml(response)["eSearchResult"]
|
48
48
|
end
|
49
49
|
|
50
50
|
# EPost: Posts a file containing a list of primary IDs for future use in the user's environment to use with subsequent search strategies.
|
@@ -68,12 +68,12 @@ class Eutils
|
|
68
68
|
params["db"] = db
|
69
69
|
server = EUTILS_HOST + "esummary.fcgi"
|
70
70
|
response = post_eutils(server, params)
|
71
|
-
return Hash.from_xml(response)
|
71
|
+
return Hash.from_xml(response)["eSummaryResult"]
|
72
72
|
end
|
73
73
|
|
74
74
|
# EFetch: Retrieves records in the requested format from a list of one or more primary IDs or from the user's environment.
|
75
75
|
# See also: http://eutils.ncbi.nlm.nih.gov/corehtml/query/static/efetch_help.html
|
76
|
-
def efetch(db, webenv, query_key, params = {})
|
76
|
+
def efetch(db, webenv, query_key = 1, params = {})
|
77
77
|
params["db"] = db
|
78
78
|
params["WebEnv"] = webenv
|
79
79
|
params["query_key"] = query_key
|
@@ -102,7 +102,7 @@ class Eutils
|
|
102
102
|
server = EUTILS_HOST + "egquery.fcgi"
|
103
103
|
params = {"term" => term}
|
104
104
|
response = post_eutils(server, params)
|
105
|
-
return Hash.from_xml(response)
|
105
|
+
return Hash.from_xml(response)["Result"]
|
106
106
|
end
|
107
107
|
|
108
108
|
# ESpell: Retrieves spelling suggestions.
|
data/test/test_eutils.rb
CHANGED
@@ -35,15 +35,15 @@ class TestEutils < Test::Unit::TestCase
|
|
35
35
|
should "get a hash from EInfo with db parameter" do
|
36
36
|
i = eutils.einfo("pubmed")
|
37
37
|
assert_equal Hash, i.class
|
38
|
-
assert_equal "
|
39
|
-
assert_equal "pubmed", i['
|
38
|
+
assert_equal "DbInfo", i.keys.first
|
39
|
+
assert_equal "pubmed", i['DbInfo']['DbName']
|
40
40
|
end
|
41
41
|
|
42
42
|
should "get a hash from ESearch for a term" do
|
43
43
|
r = eutils.esearch("cancer")
|
44
44
|
assert_equal Hash, r.class
|
45
|
-
assert_equal "cancer", r["
|
46
|
-
assert_equal Array, r["
|
45
|
+
assert_equal "cancer", r["TranslationSet"]["Translation"]["From"]
|
46
|
+
assert_equal Array, r["IdList"]["Id"].class
|
47
47
|
end
|
48
48
|
|
49
49
|
should "get webenv and querykey from EPost for posted ids" do
|
@@ -60,13 +60,13 @@ class TestEutils < Test::Unit::TestCase
|
|
60
60
|
ids = [11850928, 11482001]
|
61
61
|
i = eutils.esummary(ids)
|
62
62
|
assert_equal Hash, i.class
|
63
|
-
assert_equal ids[0], i['
|
63
|
+
assert_equal ids[0], i['DocSum'][0]['Id'].to_i
|
64
64
|
end
|
65
65
|
|
66
66
|
should "get a hash from EFetch for ESearch result" do
|
67
67
|
s = eutils.esearch("cancer")
|
68
|
-
webenv = s["
|
69
|
-
query_key = s["
|
68
|
+
webenv = s["WebEnv"]
|
69
|
+
query_key = s["QueryKey"]
|
70
70
|
r = eutils.efetch("pubmed", webenv, query_key)
|
71
71
|
assert_equal Hash, r.class
|
72
72
|
assert_equal "PubmedArticleSet", r.keys.first
|
@@ -81,7 +81,8 @@ class TestEutils < Test::Unit::TestCase
|
|
81
81
|
should "get hash from EGQuery" do
|
82
82
|
i = eutils.egquery("autism")
|
83
83
|
assert_equal Hash, i.class
|
84
|
-
assert_equal "
|
85
|
-
assert_equal "
|
84
|
+
assert_equal "Term", i.keys.sort.first
|
85
|
+
assert_equal "eGQueryResult", i.keys.sort.last
|
86
|
+
assert_equal "autism", i["Term"]
|
86
87
|
end
|
87
88
|
end
|
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
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joon Lee
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-26 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -30,15 +30,18 @@ dependencies:
|
|
30
30
|
type: :development
|
31
31
|
version_requirements: *id001
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
|
-
name:
|
33
|
+
name: activesupport
|
34
34
|
prerelease: false
|
35
35
|
requirement: &id002 !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
segments:
|
40
|
+
- 3
|
40
41
|
- 0
|
41
|
-
|
42
|
+
- 0
|
43
|
+
- rc2
|
44
|
+
version: 3.0.0.rc2
|
42
45
|
type: :runtime
|
43
46
|
version_requirements: *id002
|
44
47
|
description: This gem only provides API for NCBI Eutils. If you need full access to other NCBI databases, try BioRuby (bio gem) instead.
|