intermine 1.02.00 → 1.03.00

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.
@@ -543,6 +543,10 @@ module InterMine::PathQuery
543
543
  end
544
544
  end
545
545
 
546
+ def sequences(range)
547
+ return Results::SeqReader.new(@service.root, clone, range)
548
+ end
549
+
546
550
  # Return all result record objects returned by running this query.
547
551
  def all
548
552
  return self.results
@@ -390,6 +390,32 @@ module InterMine::Results
390
390
 
391
391
  end
392
392
 
393
+ class JsonReader < ResultsReader
394
+
395
+ include Enumerable
396
+
397
+ def each
398
+ processor = lambda { |line|
399
+ x = line.chomp.chomp(",")
400
+ x.empty? ? nil : JSON.parse(x)
401
+ }
402
+ read_result_set(params("json"), processor) { |x| yield x }
403
+ end
404
+ end
405
+
406
+ class SeqReader < JsonReader
407
+
408
+ def initialize(base, query, range = {})
409
+ super(base + Service::SEQUENCE_PATH, query, 0, nil)
410
+ @range = range
411
+ end
412
+
413
+ def params(format = "json")
414
+ @query.params.merge(@range)
415
+ end
416
+
417
+ end
418
+
393
419
  class SummaryReader < ResultsReader
394
420
 
395
421
  include Enumerable
@@ -95,6 +95,7 @@ module InterMine
95
95
  MODEL_PATH = "/model/json"
96
96
  TEMPLATES_PATH = "/templates"
97
97
  QUERY_RESULTS_PATH = "/query/results"
98
+ SEQUENCE_PATH = "/sequence"
98
99
  QUERY_TO_LIST_PATH = "/query/tolist/json"
99
100
  QUERY_APPEND_PATH = "/query/append/tolist/json"
100
101
  TEMPLATE_RESULTS_PATH = "/template/results"
@@ -3,6 +3,7 @@ module Intermine
3
3
  # Webservice Client Version number
4
4
  #
5
5
  # Changes:
6
+ # 1.03.00 - Add support for indexed sequence service
6
7
  # 1.02.00 - Allow the lazy fetching to be optional
7
8
  # 1.01.01 - Improved lazy reference fetching
8
9
  # 1.01.00 - Test compatibility with 1.8.7, 1.9.2, 2.0.0-rc1
@@ -20,5 +21,5 @@ module Intermine
20
21
  # 0.98.09 - Major changes to results - now with thorough-going Enumerable support
21
22
  # 0.98.08 - Added column summary support
22
23
  #
23
- VERSION = "1.02.00"
24
+ VERSION = "1.03.00"
24
25
  end
@@ -136,6 +136,15 @@ class LiveResultsTest < Test::Unit::TestCase
136
136
  trideps = @q.summaries("department.name", *@summary_args).select {|s| s["count"] == @dep_size}
137
137
  assert_equal(@exp_trideps, trideps.length)
138
138
  end
139
+
140
+ def testSubSequences
141
+ q = @service.query("Employee").select(:name).where(:name => "D*")
142
+ c = q.count
143
+ seqs = q.sequences(:start => 1, :end => 5).map {|s| s["seq"]}
144
+ assert_equal(c, seqs.size)
145
+ assert(seqs.all? {|s| s.size == 4})
146
+ end
147
+
139
148
  end
140
149
 
141
150
  class LiveTemplateResultsTest < LiveResultsTest
metadata CHANGED
@@ -1,130 +1,185 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: intermine
3
- version: !ruby/object:Gem::Version
4
- version: 1.02.00
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 1.03.00
6
6
  platform: ruby
7
- authors:
8
- - Alex Kalderimis
7
+ authors:
8
+ - Alex Kalderimis
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: json
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- description: ! "= Webservice Client Library for InterMine Data-Warehouses\n\nThis
31
- library provides an interface to the InterMine webservices\nAPI. It makes construction
32
- and execution of queries more \nstraightforward, safe and convenient, and allows
33
- for results\nto be used directly in Ruby code. As well as traditional row based\naccess,
34
- the library provides an object-orientated record result\nformat (similar to ActiveRecords),
35
- and allows for fast, memory \nefficient iteration of result sets.\n\n== Example\n\nGet
36
- all protein domains associated with a set of genes and print their names:\n\n require
37
- \"intermine/service\"\n\n Service.new(\"www.flymine.org/query\").\n new_query(\"Pathway\")\n
38
- \ select(:name).\n where(\"genes.symbol\" => [\"zen\", \"hox\", \"h\",
39
- \"bib\"]).\n each_row { |row| puts row[:name]}\n\n== Who is this for?\n\nInterMine
40
- data warehouses are typically constructed to hold\nBiological data, and as this
41
- library facilitates programmatic\naccess to these data, this install is primarily
42
- aimed at \nbioinformaticians. In particular, users of the following services\nmay
43
- find it especially useful:\n * FlyMine (http://www.flymine.org/query)\n * YeastMine
44
- (http://yeastmine.yeastgenome.org/yeastmine)\n * RatMine (http://ratmine.mcw.edu/ratmine)\n
45
- * modMine (http://intermine.modencode.org/release-23)\n * metabolicMine (http://www.metabolicmine.org/beta)\n\n==
46
- How to use this library:\n\nWe have tried to construct an interface to this library
47
- that\ndoes not require you to learn an entirely new set of concepts. \nAs such,
48
- as well as the underlying methods that are common\nto all libraries, there is an
49
- additional set of aliases and sugar\nmethods that emulate the DSL style of SQL:\n\n===
50
- SQL style\n\n service = Service.new(\"www.flymine.org/query\")\n service.model.\n
51
- \ table(\"Gene\").\n select(\"*\", \"pathways.*\").\n where(:symbol =>
52
- \"zen\").\n order_by(:symbol).\n outerjoin(:pathways).\n each_row do
53
- |r|\n puts r\n end\n\n=== Common InterMine interface\n\n service = Service.new(\"www.flymine.org/query\")\n
54
- \ query = service.new_query(\"Gene\")\n query.add_views(\"*\", \"pathways.*\")\n
55
- \ query.add_constraint(\"symbol\", \"=\", \"zen\")\n query.add_sort_order(:symbol)\n
56
- \ query.add_join(:pathways)\n query.each_row do |r|\n puts r\n end\n\nFor more
57
- details, see the accompanying documentation and the unit tests\nfor interface examples.
58
- Further documentation is available at www.intermine.org.\n\n== Support\n\nSupport
59
- is available on our development mailing list: dev@intermine.org\n\n== License\n\nThis
60
- code is Open Source under the LGPL. Source code for all InterMine code\ncan be checked
61
- out from svn://subversion.flymine.org/flymine\n"
62
- email:
63
- - dev@intermine.org
12
+
13
+ date: 2013-07-04 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ version_requirements: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ requirement: *id001
24
+ prerelease: false
25
+ type: :runtime
26
+ description: |
27
+ = Webservice Client Library for InterMine Data-Warehouses
28
+
29
+ This library provides an interface to the InterMine webservices
30
+ API. It makes construction and execution of queries more
31
+ straightforward, safe and convenient, and allows for results
32
+ to be used directly in Ruby code. As well as traditional row based
33
+ access, the library provides an object-orientated record result
34
+ format (similar to ActiveRecords), and allows for fast, memory
35
+ efficient iteration of result sets.
36
+
37
+ == Example
38
+
39
+ Get all protein domains associated with a set of genes and print their names:
40
+
41
+ require "intermine/service"
42
+
43
+ Service.new("www.flymine.org/query").
44
+ new_query("Pathway")
45
+ select(:name).
46
+ where("genes.symbol" => ["zen", "hox", "h", "bib"]).
47
+ each_row { |row| puts row[:name]}
48
+
49
+ == Who is this for?
50
+
51
+ InterMine data warehouses are typically constructed to hold
52
+ Biological data, and as this library facilitates programmatic
53
+ access to these data, this install is primarily aimed at
54
+ bioinformaticians. In particular, users of the following services
55
+ may find it especially useful:
56
+ * FlyMine (http://www.flymine.org/query)
57
+ * YeastMine (http://yeastmine.yeastgenome.org/yeastmine)
58
+ * RatMine (http://ratmine.mcw.edu/ratmine)
59
+ * modMine (http://intermine.modencode.org/release-23)
60
+ * metabolicMine (http://www.metabolicmine.org/beta)
61
+
62
+ == How to use this library:
63
+
64
+ We have tried to construct an interface to this library that
65
+ does not require you to learn an entirely new set of concepts.
66
+ As such, as well as the underlying methods that are common
67
+ to all libraries, there is an additional set of aliases and sugar
68
+ methods that emulate the DSL style of SQL:
69
+
70
+ === SQL style
71
+
72
+ service = Service.new("www.flymine.org/query")
73
+ service.model.
74
+ table("Gene").
75
+ select("*", "pathways.*").
76
+ where(:symbol => "zen").
77
+ order_by(:symbol).
78
+ outerjoin(:pathways).
79
+ each_row do |r|
80
+ puts r
81
+ end
82
+
83
+ === Common InterMine interface
84
+
85
+ service = Service.new("www.flymine.org/query")
86
+ query = service.new_query("Gene")
87
+ query.add_views("*", "pathways.*")
88
+ query.add_constraint("symbol", "=", "zen")
89
+ query.add_sort_order(:symbol)
90
+ query.add_join(:pathways)
91
+ query.each_row do |r|
92
+ puts r
93
+ end
94
+
95
+ For more details, see the accompanying documentation and the unit tests
96
+ for interface examples. Further documentation is available at www.intermine.org.
97
+
98
+ == Support
99
+
100
+ Support is available on our development mailing list: dev@intermine.org
101
+
102
+ == License
103
+
104
+ This code is Open Source under the LGPL. Source code for all InterMine code
105
+ can be checked out from svn://subversion.flymine.org/flymine
106
+
107
+ email:
108
+ - dev@intermine.org
64
109
  executables: []
110
+
65
111
  extensions: []
112
+
66
113
  extra_rdoc_files: []
67
- files:
68
- - lib/intermine/lists.rb
69
- - lib/intermine/model.rb
70
- - lib/intermine/query.rb
71
- - lib/intermine/results.rb
72
- - lib/intermine/service.rb
73
- - lib/intermine/version.rb
74
- - test/data/lists.json
75
- - test/data/model.json
76
- - test/data/resultobjs.json
77
- - test/data/resultrow.json
78
- - test/data/resultset.json
79
- - test/data/testmodel_model.xml
80
- - test/live_results.rb
81
- - test/live_summary_test.rb
82
- - test/live_test.rb
83
- - test/test.rb
84
- - test/test_helper.rb
85
- - test/test_lists.rb
86
- - test/test_model.rb
87
- - test/test_query.rb
88
- - test/test_result_row.rb
89
- - test/test_results.rb
90
- - test/test_service.rb
91
- - test/test_sugar.rb
92
- - test/unit_tests.rb
93
- - LICENCE
94
- - Gemfile
95
- - MANIFEST
96
- - README.rdoc
97
- - Rakefile
98
- - contact_header.rdoc
114
+
115
+ files:
116
+ - lib/intermine/lists.rb
117
+ - lib/intermine/model.rb
118
+ - lib/intermine/query.rb
119
+ - lib/intermine/results.rb
120
+ - lib/intermine/service.rb
121
+ - lib/intermine/version.rb
122
+ - test/data/lists.json
123
+ - test/data/model.json
124
+ - test/data/resultobjs.json
125
+ - test/data/resultrow.json
126
+ - test/data/resultset.json
127
+ - test/data/testmodel_model.xml
128
+ - test/live_results.rb
129
+ - test/live_summary_test.rb
130
+ - test/live_test.rb
131
+ - test/test.rb
132
+ - test/test_helper.rb
133
+ - test/test_lists.rb
134
+ - test/test_model.rb
135
+ - test/test_query.rb
136
+ - test/test_result_row.rb
137
+ - test/test_results.rb
138
+ - test/test_service.rb
139
+ - test/test_sugar.rb
140
+ - test/unit_tests.rb
141
+ - MANIFEST
142
+ - LICENCE
143
+ - Rakefile
144
+ - README.rdoc
145
+ - Gemfile
146
+ - contact_header.rdoc
99
147
  homepage: http://www.intermine.org
100
- licenses:
101
- - LGPL
148
+ licenses:
149
+ - LGPL
102
150
  post_install_message:
103
- rdoc_options:
104
- - --title
105
- - InterMine Webservice Client
106
- - --main
107
- - README.rdoc
108
- - --line-numbers
109
- require_paths:
110
- - lib
111
- required_ruby_version: !ruby/object:Gem::Requirement
151
+ rdoc_options:
152
+ - --title
153
+ - InterMine Webservice Client
154
+ - --main
155
+ - README.rdoc
156
+ - --line-numbers
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
112
160
  none: false
113
- requirements:
114
- - - ! '>='
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- required_rubygems_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ hash: 2
165
+ segments:
166
+ - 0
167
+ version: "0"
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
169
  none: false
119
- requirements:
120
- - - ! '>='
121
- - !ruby/object:Gem::Version
122
- version: '0'
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ hash: 2
174
+ segments:
175
+ - 0
176
+ version: "0"
123
177
  requirements: []
178
+
124
179
  rubyforge_project: intermine
125
- rubygems_version: 1.8.23
180
+ rubygems_version: 1.8.25
126
181
  signing_key:
127
182
  specification_version: 3
128
183
  summary: Webservice Client Library for InterMine Data-Warehouses
129
- test_files:
130
- - test/unit_tests.rb
184
+ test_files:
185
+ - test/unit_tests.rb