eutils 0.1.2 → 0.2.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{eutils}
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
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, aka seouri"]
12
- s.date = %q{2010-08-30}
12
+ s.date = %q{2011-04-27}
13
13
  s.description = %q{Lightweight Ruby API for NCBI Eutils. 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 = [
@@ -17,31 +17,29 @@ Gem::Specification.new do |s|
17
17
  ]
18
18
  s.files = [
19
19
  ".document",
20
- ".gitignore",
21
- "MIT-LICENSE",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "eutils.gemspec",
26
- "lib/eutils.rb",
27
- "test/helper.rb",
28
- "test/test_eutils.rb"
20
+ "MIT-LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "eutils.gemspec",
25
+ "lib/eutils.rb",
26
+ "test/helper.rb",
27
+ "test/test_eutils.rb"
29
28
  ]
30
29
  s.homepage = %q{http://github.com/seouri/eutils}
31
- s.rdoc_options = ["--charset=UTF-8"]
32
30
  s.require_paths = ["lib"]
33
- s.rubygems_version = %q{1.3.6}
31
+ s.rubygems_version = %q{1.3.7}
34
32
  s.summary = %q{Lightweight Ruby API for NCBI Eutils}
35
33
  s.test_files = [
36
34
  "test/helper.rb",
37
- "test/test_eutils.rb"
35
+ "test/test_eutils.rb"
38
36
  ]
39
37
 
40
38
  if s.respond_to? :specification_version then
41
39
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
40
  s.specification_version = 3
43
41
 
44
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
43
  s.add_development_dependency(%q<shoulda>, [">= 0"])
46
44
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
47
45
  else
@@ -91,16 +91,28 @@ class Eutils
91
91
 
92
92
  # ELink: Checks for the existence of an external or Related Articles link from a list of one or more primary IDs. Retrieves primary IDs and relevancy scores for links to Entrez databases or Related Articles; creates a hyperlink to the primary LinkOut provider for a specific ID and database, or lists LinkOut URLs and Attributes for multiple IDs.
93
93
  # See also: http://eutils.ncbi.nlm.nih.gov/corehtml/query/static/elink_help.html
94
- def elink
95
-
94
+ def elink(ids, params = {})
95
+ params["id"] = ids.join(",")
96
+ params["cmd"] ||= "neighbor"
97
+ params["dbfrom"] ||= "pubmed"
98
+ params["db"] ||= "pubmed"
99
+ params["retmode"] ||= "xml"
100
+ server = EUTILS_HOST + "elink.fcgi"
101
+ response = post_eutils(server, params)
102
+ if params["retmode"] == "xml"
103
+ return Hash.from_xml(response)["eLinkResult"]
104
+ else
105
+ return response
106
+ end
96
107
  end
97
108
 
98
109
  # EGQuery: Provides Entrez database counts in XML for a single search using Global Query.
99
110
  # See also: http://eutils.ncbi.nlm.nih.gov/corehtml/query/static/egquery_help.html
100
111
  def egquery(term)
101
112
  term.strip! if term.class == String
102
- server = EUTILS_HOST + "egquery.fcgi"
103
- params = {"term" => term}
113
+ #server = EUTILS_HOST + "egquery.fcgi"
114
+ server = "http://eutils.ncbi.nlm.nih.gov/gquery/"
115
+ params = {"term" => term, "retmode" => "xml"}
104
116
  response = post_eutils(server, params)
105
117
  return Hash.from_xml(response)["Result"]
106
118
  end
@@ -78,6 +78,12 @@ class TestEutils < Test::Unit::TestCase
78
78
  assert_equal "", eutils.espell(" ")
79
79
  end
80
80
 
81
+ should "get a hash from Elink" do
82
+ i = eutils.elink([9298984])
83
+ assert_equal Hash, i.class
84
+ assert_equal "9298984", i["LinkSet"]["IdList"]["Id"]
85
+ end
86
+
81
87
  should "get hash from EGQuery" do
82
88
  i = eutils.egquery("autism")
83
89
  assert_equal Hash, i.class
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
7
  - 2
9
- version: 0.1.2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joon Lee, aka seouri
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-30 00:00:00 -04:00
17
+ date: 2011-04-27 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: shoulda
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
@@ -33,6 +34,7 @@ dependencies:
33
34
  name: activesupport
34
35
  prerelease: false
35
36
  requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
36
38
  requirements:
37
39
  - - ">="
38
40
  - !ruby/object:Gem::Version
@@ -53,7 +55,6 @@ extra_rdoc_files:
53
55
  - README.rdoc
54
56
  files:
55
57
  - .document
56
- - .gitignore
57
58
  - MIT-LICENSE
58
59
  - README.rdoc
59
60
  - Rakefile
@@ -67,11 +68,12 @@ homepage: http://github.com/seouri/eutils
67
68
  licenses: []
68
69
 
69
70
  post_install_message:
70
- rdoc_options:
71
- - --charset=UTF-8
71
+ rdoc_options: []
72
+
72
73
  require_paths:
73
74
  - lib
74
75
  required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
75
77
  requirements:
76
78
  - - ">="
77
79
  - !ruby/object:Gem::Version
@@ -79,6 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
81
  - 0
80
82
  version: "0"
81
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
82
85
  requirements:
83
86
  - - ">="
84
87
  - !ruby/object:Gem::Version
@@ -88,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
91
  requirements: []
89
92
 
90
93
  rubyforge_project:
91
- rubygems_version: 1.3.6
94
+ rubygems_version: 1.3.7
92
95
  signing_key:
93
96
  specification_version: 3
94
97
  summary: Lightweight Ruby API for NCBI Eutils
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC