intermine 1.02.00 → 1.03.00
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/intermine/query.rb +4 -0
- data/lib/intermine/results.rb +26 -0
- data/lib/intermine/service.rb +1 -0
- data/lib/intermine/version.rb +2 -1
- data/test/live_results.rb +9 -0
- metadata +167 -112
data/lib/intermine/query.rb
CHANGED
@@ -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
|
data/lib/intermine/results.rb
CHANGED
@@ -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
|
data/lib/intermine/service.rb
CHANGED
@@ -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"
|
data/lib/intermine/version.rb
CHANGED
@@ -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.
|
24
|
+
VERSION = "1.03.00"
|
24
25
|
end
|
data/test/live_results.rb
CHANGED
@@ -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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
|
68
|
-
|
69
|
-
- lib/intermine/
|
70
|
-
- lib/intermine/
|
71
|
-
- lib/intermine/
|
72
|
-
- lib/intermine/
|
73
|
-
- lib/intermine/
|
74
|
-
-
|
75
|
-
- test/data/
|
76
|
-
- test/data/
|
77
|
-
- test/data/
|
78
|
-
- test/data/
|
79
|
-
- test/data/
|
80
|
-
- test/
|
81
|
-
- test/
|
82
|
-
- test/
|
83
|
-
- test/
|
84
|
-
- test/
|
85
|
-
- test/
|
86
|
-
- test/
|
87
|
-
- test/
|
88
|
-
- test/
|
89
|
-
- test/
|
90
|
-
- test/
|
91
|
-
- test/
|
92
|
-
- test/
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
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
|
-
|
116
|
-
|
117
|
-
|
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
|
-
|
122
|
-
|
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.
|
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
|