entrez 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,6 +64,7 @@ class Entrez
64
64
  # #=> 'low coverage[WORD]+AND+inprogress[SEQS]'
65
65
  def convert_search_term_hash(hash)
66
66
  hash.map do |field, value|
67
+ value = value.join(',') if value.is_a?(Array)
67
68
  "#{value}[#{field}]"
68
69
  end.join('+AND+')
69
70
  end
@@ -1,3 +1,3 @@
1
1
  module Entrez
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
@@ -17,35 +17,44 @@ describe Entrez do
17
17
  response.body.should include('Hapmap')
18
18
  end
19
19
 
20
- it '#ESearch retrieves results' do
21
- response = Entrez.ESearch('genomeprj', {WORD: 'hapmap', SEQS: 'inprogress'}, retmode: :xml)
22
- response.body.should include('28911')
23
- end
24
-
25
20
  it '#EInfo retrieves results' do
26
21
  response = Entrez.EInfo('snp', retmode: :xml)
27
22
  response.body.should include('<Name>RS</Name>')
28
23
  end
29
24
 
30
- it '#ESearch response returns IDs for convenience' do
31
- response = Entrez.ESearch('genomeprj', {WORD: 'hapmap', SEQS: 'inprogress'}, retmode: :xml)
32
- response.ids.should == [60153, 29429, 28911, 48101, 59851, 59849, 59847, 59845, 59839, 59835, 59833, 59831, 51895, 59829, 59827, 60835, 59811, 60831, 60819, 33895]
33
- end
25
+ context '#ESearch' do
34
26
 
35
- it '#ESearch returns empty array if nothing found' do
36
- response = Entrez.ESearch('genomeprj', {NON_EXISTENT_SEARCH_FIELD: 'does not exist even in oompaloompa land'}, retmode: :xml)
37
- response.ids.should be_empty
38
- end
27
+ it 'retrieves results' do
28
+ response = Entrez.ESearch('genomeprj', {WORD: 'hapmap', SEQS: 'inprogress'}, retmode: :xml)
29
+ response.body.should include('28911')
30
+ end
39
31
 
40
- it '#ESearch returns array even if only 1 id found' do
41
- id = 60153
42
- response = Entrez.ESearch('genomeprj', {uid: id}, retmode: :xml)
43
- response.ids.should == [id]
44
- end
32
+ it 'response returns IDs for convenience' do
33
+ response = Entrez.ESearch('genomeprj', {WORD: 'hapmap', SEQS: 'inprogress'}, retmode: :xml)
34
+ response.ids.should == [60153, 29429, 28911, 48101, 59851, 59849, 59847, 59845, 59839, 59835, 59833, 59831, 51895, 59829, 59827, 60835, 59811, 60831, 60819, 33895]
35
+ end
36
+
37
+ it 'returns empty array if nothing found' do
38
+ response = Entrez.ESearch('genomeprj', {NON_EXISTENT_SEARCH_FIELD: 'does not exist even in oompaloompa land'}, retmode: :xml)
39
+ response.ids.should be_empty
40
+ end
41
+
42
+ it 'returns array even if only 1 id found' do
43
+ id = 60153
44
+ response = Entrez.ESearch('genomeprj', {uid: id}, retmode: :xml)
45
+ response.ids.should == [id]
46
+ end
47
+
48
+ it 'accepts string as search_terms parameter' do
49
+ response = Entrez.ESearch('genomeprj', 'hapmap[WORD]', retmode: :xml)
50
+ response.ids.should include(60153)
51
+ end
52
+
53
+ it 'can handle array of uids' do
54
+ response = Entrez.ESearch('gene', {UID: [1, 2, 3]})
55
+ response.ids.should =~ [1, 2, 3]
56
+ end
45
57
 
46
- it '#ESearch accepts string as search_terms parameter' do
47
- response = Entrez.ESearch('genomeprj', 'hapmap[WORD]', retmode: :xml)
48
- response.ids.should include(60153)
49
58
  end
50
59
 
51
60
  it 'should respect query limit' do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: entrez
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.4
5
+ version: 0.5.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jared Ning
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-29 00:00:00 -05:00
13
+ date: 2011-05-31 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency