opentox-ruby 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -3
- data/VERSION +1 -1
- data/lib/algorithm.rb +18 -10
- data/lib/authorization.rb +20 -9
- data/lib/dataset.rb +28 -15
- data/lib/environment.rb +1 -1
- data/lib/error.rb +2 -2
- data/lib/feature.rb +11 -14
- data/lib/helper.rb +32 -35
- data/lib/model.rb +9 -9
- data/lib/{ontology_service.rb → ontology.rb} +20 -8
- data/lib/opentox-ruby.rb +1 -1
- data/lib/opentox.rb +8 -1
- data/lib/overwrite.rb +10 -5
- data/lib/parser.rb +38 -15
- data/lib/rest_client_wrapper.rb +2 -0
- data/lib/serializer.rb +16 -4
- data/lib/task.rb +2 -0
- data/lib/validation.rb +72 -2
- metadata +141 -14
- data/lib/templates/config.yaml +0 -86
data/Rakefile
CHANGED
@@ -28,8 +28,17 @@ begin
|
|
28
28
|
"tmail",
|
29
29
|
"rinruby",
|
30
30
|
"ohm",
|
31
|
+
"ohm-contrib",
|
31
32
|
"SystemTimer",
|
32
|
-
"rjb"
|
33
|
+
"rjb",
|
34
|
+
#valiation-gems
|
35
|
+
"dm-core",
|
36
|
+
"dm-serializer",
|
37
|
+
"dm-timestamps",
|
38
|
+
"dm-types",
|
39
|
+
"dm-migrations",
|
40
|
+
"dm-validations",
|
41
|
+
"dm-sqlite-adapter"
|
33
42
|
].each { |dep| gem.add_dependency dep }
|
34
43
|
=begin
|
35
44
|
[ "dm-core",
|
@@ -41,11 +50,12 @@ begin
|
|
41
50
|
"dm-validations",
|
42
51
|
].each {|dep| gem.add_dependency dep, ">= 1" }
|
43
52
|
=end
|
53
|
+
#valiation-gem
|
44
54
|
gem.add_dependency "haml", ">=3"
|
55
|
+
# validation-gems
|
56
|
+
gem.add_dependency "ruby-plot", "~>0.4.0"
|
45
57
|
['jeweler'].each { |dep| gem.add_development_dependency dep }
|
46
58
|
gem.files = FileList["[A-Z]*", "{bin,generators,lib,test}/**/*", 'lib/jeweler/templates/.gitignore']
|
47
|
-
#gem.files.include %w(lib/environment.rb, lib/algorithm.rb, lib/compound.rb, lib/dataset.rb, lib/model.rb, lib/validation.rb, lib/templates/*)
|
48
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
49
59
|
end
|
50
60
|
Jeweler::GemcutterTasks.new
|
51
61
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/lib/algorithm.rb
CHANGED
@@ -52,9 +52,9 @@ module OpenTox
|
|
52
52
|
class BBRC
|
53
53
|
include Fminer
|
54
54
|
# Initialize bbrc algorithm
|
55
|
-
def initialize
|
55
|
+
def initialize(subjectid=nil)
|
56
56
|
super File.join(CONFIG[:services]["opentox-algorithm"], "fminer/bbrc")
|
57
|
-
load_metadata
|
57
|
+
load_metadata(subjectid)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -62,9 +62,9 @@ module OpenTox
|
|
62
62
|
class LAST
|
63
63
|
include Fminer
|
64
64
|
# Initialize last algorithm
|
65
|
-
def initialize
|
65
|
+
def initialize(subjectid=nil)
|
66
66
|
super File.join(CONFIG[:services]["opentox-algorithm"], "fminer/last")
|
67
|
-
load_metadata
|
67
|
+
load_metadata(subjectid)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -74,9 +74,9 @@ module OpenTox
|
|
74
74
|
class Lazar
|
75
75
|
include Algorithm
|
76
76
|
# Initialize lazar algorithm
|
77
|
-
def initialize
|
77
|
+
def initialize(subjectid=nil)
|
78
78
|
super File.join(CONFIG[:services]["opentox-algorithm"], "lazar")
|
79
|
-
load_metadata
|
79
|
+
load_metadata(subjectid)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -165,11 +165,19 @@ module OpenTox
|
|
165
165
|
# @param [Hash] params Keys `:similarity_algorithm,:p_values` are required
|
166
166
|
# @return [Hash] Hash with keys `:prediction, :confidence`
|
167
167
|
def self.local_svm_regression(neighbors,params )
|
168
|
-
sims = neighbors.collect{ |n| n[:similarity] } # similarity values between query and neighbors
|
168
|
+
sims = neighbors.collect{ |n| Algorithm.gauss(n[:similarity]) } # similarity values between query and neighbors
|
169
169
|
conf = sims.inject{|sum,x| sum + x }
|
170
|
+
|
171
|
+
# AM: Control log taking
|
172
|
+
take_logs=true
|
173
|
+
neighbors.each do |n|
|
174
|
+
if (! n[:activity].nil?) && (n[:activity].to_f < 0.0)
|
175
|
+
take_logs = false
|
176
|
+
end
|
177
|
+
end
|
170
178
|
acts = neighbors.collect do |n|
|
171
179
|
act = n[:activity]
|
172
|
-
Math.log10(act.to_f)
|
180
|
+
take_logs ? Math.log10(act.to_f) : act.to_f
|
173
181
|
end # activities of neighbors for supervised learning
|
174
182
|
|
175
183
|
neighbor_matches = neighbors.collect{ |n| n[:features] } # as in classification: URIs of matches
|
@@ -214,8 +222,8 @@ module OpenTox
|
|
214
222
|
@r.eval "sims<-as.kernelMatrix(matrix(sims,1))"
|
215
223
|
LOGGER.debug "Predicting ..."
|
216
224
|
@r.eval "p<-predict(model,sims)[1,1]"
|
217
|
-
prediction = 10**(@r.p.to_f)
|
218
|
-
LOGGER.debug "Prediction is: '" +
|
225
|
+
prediction = 10**(@r.p.to_f) if take_logs
|
226
|
+
LOGGER.debug "Prediction is: '" + prediction.to_s + "'."
|
219
227
|
@r.quit # free R
|
220
228
|
end
|
221
229
|
confidence = conf/neighbors.size if neighbors.size > 0
|
data/lib/authorization.rb
CHANGED
@@ -137,16 +137,23 @@ module OpenTox
|
|
137
137
|
# Lists policies alongside with affected uris
|
138
138
|
# @param [String] subjectid
|
139
139
|
# @return [Hash] keys: all policies of the subjectid owner, values: uris affected by those policies
|
140
|
-
def self.
|
140
|
+
def self.list_policies_uris( subjectid )
|
141
141
|
names = list_policies(subjectid)
|
142
142
|
policies = {}
|
143
143
|
names.each do |n|
|
144
|
-
|
145
|
-
p.load_xml( list_policy(n, subjectid) )
|
146
|
-
policies[n] = p.uris
|
144
|
+
policies[n] = list_policy_uris( n, subjectid )
|
147
145
|
end
|
148
146
|
policies
|
149
147
|
end
|
148
|
+
|
149
|
+
# Lists policies alongside with affected uris
|
150
|
+
# @param [String] subjectid
|
151
|
+
# @return [Hash] keys: all policies of the subjectid owner, values: uris affected by those policies
|
152
|
+
def self.list_policy_uris( policy, subjectid )
|
153
|
+
p = OpenTox::Policies.new
|
154
|
+
p.load_xml( list_policy(policy, subjectid) )
|
155
|
+
p.uris
|
156
|
+
end
|
150
157
|
|
151
158
|
#Returns the owner (who created the first policy) of an URI
|
152
159
|
# @param [String, String]uri,subjectid
|
@@ -220,7 +227,9 @@ module OpenTox
|
|
220
227
|
begin
|
221
228
|
resource = RestClient::Resource.new("#{AA_SERVER}/opensso/identity/search")
|
222
229
|
grps = resource.post(:admin => subjectid, :attributes_names => "objecttype", :attributes_values_objecttype => "group")
|
223
|
-
grps.split("\n").collect{|x| x.sub("string=","")}
|
230
|
+
grps = grps.split("\n").collect{|x| x.sub("string=","")}
|
231
|
+
grps.delete_if{|g|g=="MemberManagement"||g=="Webmasters"}
|
232
|
+
grps
|
224
233
|
rescue
|
225
234
|
[]
|
226
235
|
end
|
@@ -279,10 +288,12 @@ module OpenTox
|
|
279
288
|
# @return [Boolean]
|
280
289
|
def self.delete_policies_from_uri(uri, subjectid)
|
281
290
|
policies = list_uri_policies(uri, subjectid)
|
282
|
-
policies
|
283
|
-
|
284
|
-
|
285
|
-
|
291
|
+
if policies
|
292
|
+
policies.each do |policy|
|
293
|
+
ret = delete_policy(policy, subjectid)
|
294
|
+
LOGGER.debug "OpenTox::Authorization delete policy: #{policy} - with result: #{ret}"
|
295
|
+
end
|
296
|
+
end
|
286
297
|
return true
|
287
298
|
end
|
288
299
|
|
data/lib/dataset.rb
CHANGED
@@ -74,7 +74,7 @@ module OpenTox
|
|
74
74
|
# @param [optional,String] uri URI of the dataset service, defaults to service specified in configuration
|
75
75
|
# @return [Array] Array of dataset object without data (use one of the load_* methods to pull data from the server)
|
76
76
|
def self.all(uri=CONFIG[:services]["opentox-dataset"], subjectid=nil)
|
77
|
-
RestClientWrapper.get(uri,{:accept => "text/uri-list",:subjectid => subjectid}).to_s.each_line.collect{|u| Dataset.new(u, subjectid)}
|
77
|
+
RestClientWrapper.get(uri,{:accept => "text/uri-list",:subjectid => subjectid}).to_s.each_line.collect{|u| Dataset.new(u.chomp, subjectid)}
|
78
78
|
end
|
79
79
|
|
80
80
|
# Load YAML representation into the dataset
|
@@ -158,29 +158,42 @@ module OpenTox
|
|
158
158
|
# Load and return only features from the dataset service
|
159
159
|
# @return [Hash] Features of the dataset
|
160
160
|
def load_features(subjectid=nil)
|
161
|
-
|
162
|
-
|
161
|
+
if (CONFIG[:yaml_hosts].include?(URI.parse(@uri).host))
|
162
|
+
@features = YAML.load(RestClientWrapper.get(File.join(@uri,"features"), {:accept => "application/x-yaml", :subjectid => subjectid}))
|
163
|
+
else
|
164
|
+
parser = Parser::Owl::Dataset.new(@uri, subjectid)
|
165
|
+
@features = parser.load_features(subjectid)
|
166
|
+
end
|
163
167
|
@features
|
164
168
|
end
|
165
169
|
|
170
|
+
def feature_classes(feature, subjectid=nil)
|
171
|
+
if Feature.find(feature, subjectid).feature_type == "classification"
|
172
|
+
classes = []
|
173
|
+
@data_entries.each do |c,e|
|
174
|
+
e[feature].each { |v| classes << v.to_s }
|
175
|
+
end
|
176
|
+
classes.uniq.sort
|
177
|
+
else
|
178
|
+
nil
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
=begin
|
166
183
|
# Detect feature type(s) in the dataset
|
167
184
|
# @return [String] `classification", "regression", "mixed" or unknown`
|
168
185
|
def feature_type(subjectid=nil)
|
169
186
|
load_features(subjectid)
|
170
|
-
feature_types = @features.collect{|f,metadata| metadata[
|
171
|
-
if feature_types.
|
172
|
-
"
|
187
|
+
feature_types = @features.collect{|f,metadata| metadata[RDF.type]}.flatten.uniq
|
188
|
+
if feature_types.include?(OT.NominalFeature)
|
189
|
+
"classification"
|
190
|
+
elsif feature_types.include?(OT.NumericFeature)
|
191
|
+
"regression"
|
173
192
|
else
|
174
|
-
|
175
|
-
when /NominalFeature/
|
176
|
-
"classification"
|
177
|
-
when /NumericFeature/
|
178
|
-
"regression"
|
179
|
-
else
|
180
|
-
"unknown"
|
181
|
-
end
|
193
|
+
"unknown"
|
182
194
|
end
|
183
195
|
end
|
196
|
+
=end
|
184
197
|
|
185
198
|
# Get Spreadsheet representation
|
186
199
|
# @return [Spreadsheet::Workbook] Workbook which can be written with the spreadsheet gem (data_entries only, metadata will will be discarded))
|
@@ -284,7 +297,7 @@ module OpenTox
|
|
284
297
|
else
|
285
298
|
compounds.each do |c|
|
286
299
|
features.each do |f|
|
287
|
-
|
300
|
+
if @data_entries[c]==nil or @data_entries[c][f]==nil
|
288
301
|
dataset.add(c,f,nil)
|
289
302
|
else
|
290
303
|
@data_entries[c][f].each do |v|
|
data/lib/environment.rb
CHANGED
@@ -23,7 +23,7 @@ else
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# database
|
26
|
-
|
26
|
+
#`redis-server /opt/redis/redis.conf` unless File.exists? "/var/run/redis.pid" # removed by AM
|
27
27
|
Ohm.connect :thread_safe => true
|
28
28
|
|
29
29
|
# load mail settings for error messages
|
data/lib/error.rb
CHANGED
@@ -69,7 +69,7 @@ module OpenTox
|
|
69
69
|
|
70
70
|
def rdf_content()
|
71
71
|
c = {
|
72
|
-
RDF.type => OT.ErrorReport,
|
72
|
+
RDF.type => [OT.ErrorReport],
|
73
73
|
OT.statusCode => @http_code,
|
74
74
|
OT.message => @message,
|
75
75
|
OT.actor => @actor,
|
@@ -96,4 +96,4 @@ class Array
|
|
96
96
|
end
|
97
97
|
short.join("\n")
|
98
98
|
end
|
99
|
-
end
|
99
|
+
end
|
data/lib/feature.rb
CHANGED
@@ -16,23 +16,19 @@ module OpenTox
|
|
16
16
|
feature
|
17
17
|
end
|
18
18
|
|
19
|
-
# provides domain (possible target values) of classification feature
|
20
|
-
# @return [Array] list with possible target values
|
21
|
-
def domain
|
22
|
-
if metadata[OT.acceptValue]
|
23
|
-
raise "accept value found, remove hack and implement correctly"
|
24
|
-
else
|
25
|
-
if @uri=~/feature\/26221/ || @uri=~/feature\/221726/
|
26
|
-
return ["mutagen" , "nonmutagen"]
|
27
|
-
end
|
28
|
-
return [true, false]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
19
|
# provides feature type, possible types are "regression" or "classification"
|
33
20
|
# @return [String] feature type, unknown if OT.isA property is unknown/ not set
|
34
21
|
def feature_type
|
35
|
-
|
22
|
+
if metadata[RDF.type].flatten.include?(OT.NominalFeature)
|
23
|
+
"classification"
|
24
|
+
elsif metadata[RDF.type].flatten.include?(OT.NumericFeature)
|
25
|
+
"regression"
|
26
|
+
else
|
27
|
+
#"unknown"
|
28
|
+
metadata[RDF.type].inspect
|
29
|
+
end
|
30
|
+
=begin
|
31
|
+
case metadata[RDF.type]
|
36
32
|
when /NominalFeature/
|
37
33
|
"classification"
|
38
34
|
when /NumericFeature/
|
@@ -40,6 +36,7 @@ module OpenTox
|
|
40
36
|
else
|
41
37
|
"unknown"
|
42
38
|
end
|
39
|
+
=end
|
43
40
|
end
|
44
41
|
|
45
42
|
end
|
data/lib/helper.rb
CHANGED
@@ -44,21 +44,12 @@ helpers do
|
|
44
44
|
|
45
45
|
def uri_available?(urlStr)
|
46
46
|
url = URI.parse(urlStr)
|
47
|
-
|
48
|
-
|
49
|
-
return http.head(url.request_uri).code == "200"
|
50
|
-
end
|
51
|
-
else
|
52
|
-
Net::HTTP.start(url.host, url.port) do |http|
|
53
|
-
return http.post(url.request_uri, "subjectid=#{@subjectid}").code == "202"
|
54
|
-
end
|
47
|
+
Net::HTTP.start(url.host, url.port) do |http|
|
48
|
+
return http.head("#{url.request_uri}?subjectid=#{CGI.escape @subjectid}").code == "200"
|
55
49
|
end
|
56
50
|
end
|
57
51
|
|
58
|
-
|
59
|
-
|
60
|
-
before do
|
61
|
-
unless !AA_SERVER or login_requests or CONFIG[:authorization][:free_request].include?(env['REQUEST_METHOD'])
|
52
|
+
def get_subjectid
|
62
53
|
begin
|
63
54
|
subjectid = nil
|
64
55
|
subjectid = session[:subjectid] if session[:subjectid]
|
@@ -69,31 +60,37 @@ before do
|
|
69
60
|
subjectid = CGI.unescape(subjectid) if subjectid.include?("%23")
|
70
61
|
@subjectid = subjectid
|
71
62
|
rescue
|
72
|
-
|
73
|
-
subjectid = ""
|
63
|
+
subjectid = nil
|
74
64
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
extension = File.extname(request.path_info) # params[:id] is not yet available
|
65
|
+
end
|
66
|
+
def get_extension
|
67
|
+
extension = File.extname(request.path_info)
|
79
68
|
unless extension.empty?
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
69
|
+
case extension.gsub(".","")
|
70
|
+
when "html"
|
71
|
+
@accept = 'text/html'
|
72
|
+
when "yaml"
|
73
|
+
@accept = 'application/x-yaml'
|
74
|
+
when "csv"
|
75
|
+
@accept = 'text/csv'
|
76
|
+
when "rdfxml"
|
77
|
+
@accept = 'application/rdf+xml'
|
78
|
+
when "xls"
|
79
|
+
@accept = 'application/ms-excel'
|
80
|
+
when "css"
|
81
|
+
@accept = 'text/css'
|
82
|
+
else
|
83
|
+
# halt 404, "File format #{extension} not supported."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
before do
|
90
|
+
@subjectid = get_subjectid()
|
91
|
+
@accept = get_extension()
|
92
|
+
unless !AA_SERVER or login_requests or CONFIG[:authorization][:free_request].include?(env['REQUEST_METHOD'])
|
93
|
+
protected!(@subjectid)
|
97
94
|
end
|
98
95
|
end
|
99
96
|
|
data/lib/model.rb
CHANGED
@@ -44,11 +44,10 @@ module OpenTox
|
|
44
44
|
load_metadata(subjectid) if @metadata==nil or @metadata.size==0 or (@metadata.size==1 && @metadata.values[0]==@uri)
|
45
45
|
algorithm = OpenTox::Algorithm::Generic.find(@metadata[OT.algorithm], subjectid)
|
46
46
|
algorithm_title = algorithm ? algorithm.metadata[DC.title] : nil
|
47
|
-
algorithm_type = algorithm ? algorithm.metadata[
|
47
|
+
algorithm_type = algorithm ? algorithm.metadata[RDF.type] : nil
|
48
48
|
dependent_variable = OpenTox::Feature.find( @metadata[OT.dependentVariables],subjectid )
|
49
49
|
dependent_variable_type = dependent_variable ? dependent_variable.feature_type : nil
|
50
|
-
type_indicators = [dependent_variable_type, @metadata[
|
51
|
-
@uri, algorithm_type, algorithm_title]
|
50
|
+
type_indicators = [dependent_variable_type, @metadata[RDF.type], @metadata[DC.title], @uri, algorithm_type, algorithm_title].flatten
|
52
51
|
type_indicators.each do |type|
|
53
52
|
case type
|
54
53
|
when /(?i)classification/
|
@@ -113,9 +112,10 @@ module OpenTox
|
|
113
112
|
# @param [optional,Hash] params Parameters for the lazar algorithm (OpenTox::Algorithm::Lazar)
|
114
113
|
# @return [OpenTox::Model::Lazar] lazar model
|
115
114
|
def self.create(params)
|
115
|
+
subjectid = params[:subjectid]
|
116
116
|
lazar_algorithm = OpenTox::Algorithm::Generic.new File.join( CONFIG[:services]["opentox-algorithm"],"lazar")
|
117
117
|
model_uri = lazar_algorithm.run(params)
|
118
|
-
OpenTox::Model::Lazar.find(model_uri,
|
118
|
+
OpenTox::Model::Lazar.find(model_uri, subjectid)
|
119
119
|
end
|
120
120
|
|
121
121
|
# Get a parameter value
|
@@ -187,7 +187,7 @@ module OpenTox
|
|
187
187
|
|
188
188
|
if @neighbors.size == 0
|
189
189
|
@prediction_dataset.add_feature(prediction_feature_uri, {
|
190
|
-
|
190
|
+
RDF.type => [OT.MeasuredFeature],
|
191
191
|
OT.hasSource => @uri,
|
192
192
|
DC.creator => @uri,
|
193
193
|
DC.title => URI.decode(File.basename( @metadata[OT.dependentVariables] )),
|
@@ -198,7 +198,7 @@ module OpenTox
|
|
198
198
|
|
199
199
|
else
|
200
200
|
@prediction_dataset.add_feature(prediction_feature_uri, {
|
201
|
-
|
201
|
+
RDF.type => [OT.ModelPrediction],
|
202
202
|
OT.hasSource => @uri,
|
203
203
|
DC.creator => @uri,
|
204
204
|
DC.title => URI.decode(File.basename( @metadata[OT.dependentVariables] )),
|
@@ -215,7 +215,7 @@ module OpenTox
|
|
215
215
|
feature_uri = File.join( @prediction_dataset.uri, "feature", "descriptor", f.to_s)
|
216
216
|
features[feature] = feature_uri
|
217
217
|
@prediction_dataset.add_feature(feature_uri, {
|
218
|
-
|
218
|
+
RDF.type => [OT.Substructure],
|
219
219
|
OT.smarts => feature,
|
220
220
|
OT.pValue => @p_values[feature],
|
221
221
|
OT.effect => @effects[feature]
|
@@ -236,7 +236,7 @@ module OpenTox
|
|
236
236
|
OT.compound => neighbor[:compound],
|
237
237
|
OT.similarity => neighbor[:similarity],
|
238
238
|
OT.measuredActivity => neighbor[:activity],
|
239
|
-
|
239
|
+
RDF.type => [OT.Neighbor]
|
240
240
|
})
|
241
241
|
@prediction_dataset.add @compound.uri, neighbor_uri, true
|
242
242
|
f = 0 unless f
|
@@ -250,7 +250,7 @@ module OpenTox
|
|
250
250
|
unless features.has_key? feature
|
251
251
|
features[feature] = feature_uri
|
252
252
|
@prediction_dataset.add_feature(feature_uri, {
|
253
|
-
|
253
|
+
RDF.type => [OT.Substructure],
|
254
254
|
OT.smarts => feature,
|
255
255
|
OT.pValue => @p_values[feature],
|
256
256
|
OT.effect => @effects[feature]
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module OpenTox
|
2
|
-
module
|
3
|
-
module
|
2
|
+
module Ontology
|
3
|
+
module Echa
|
4
|
+
=begin
|
4
5
|
require 'sparql/client'
|
5
6
|
@sparql = SPARQL::Client.new("http://apps.ideaconsult.net:8080/ontology")
|
6
7
|
def self.qs(classname="Endpoints")
|
@@ -12,11 +13,11 @@ module OpenTox
|
|
12
13
|
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
13
14
|
PREFIX otee:<http://www.opentox.org/echaEndpoints.owl#>
|
14
15
|
PREFIX toxcast:<http://www.opentox.org/toxcast.owl#>
|
15
|
-
|
16
|
-
where {
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
select *
|
17
|
+
where {
|
18
|
+
?endpoint rdfs:subClassOf otee:#{classname}.
|
19
|
+
?endpoint dc:title ?title.
|
20
|
+
}"
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.make_option_list(endpoint="Endpoints", level=1)
|
@@ -38,6 +39,17 @@ module OpenTox
|
|
38
39
|
out += "</select>\n"
|
39
40
|
return out
|
40
41
|
end
|
42
|
+
=end
|
43
|
+
|
44
|
+
def self.endpoints
|
45
|
+
RestClientWrapper.get("http://apps.ideaconsult.net:8080/ambit2/query/ndatasets_endpoint",:accept => "text/csv").collect { |line| line.split(',').first if line.match(/^http/) }.compact
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.datasets(endpoint)
|
49
|
+
RestClientWrapper.get("http://apps.ideaconsult.net:8080/ambit2/dataset?feature_sameas=#{URI.encode endpoint}", :accept => "text/uri-list").split("\n")
|
50
|
+
end
|
51
|
+
|
41
52
|
end
|
53
|
+
|
42
54
|
end
|
43
|
-
end
|
55
|
+
end
|
data/lib/opentox-ruby.rb
CHANGED
@@ -9,6 +9,6 @@ rescue LoadError
|
|
9
9
|
end
|
10
10
|
|
11
11
|
['opentox', 'compound','dataset', 'parser','serializer', 'algorithm','model','task','validation','feature',
|
12
|
-
'rest_client_wrapper', 'authorization', 'policy', 'helper', 'to-html' ].each do |lib|
|
12
|
+
'rest_client_wrapper', 'authorization', 'policy', 'helper', 'to-html', 'ontology' ].each do |lib|
|
13
13
|
require lib
|
14
14
|
end
|
data/lib/opentox.rb
CHANGED
@@ -31,7 +31,14 @@ module OpenTox
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def add_metadata(metadata)
|
34
|
-
metadata.each
|
34
|
+
metadata.each do |k,v|
|
35
|
+
if v.is_a? Array
|
36
|
+
@metadata[k] = [] unless @metadata[k]
|
37
|
+
@metadata[k] << v
|
38
|
+
else
|
39
|
+
@metadata[k] = v
|
40
|
+
end
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
# Get OWL-DL representation in RDF/XML format
|
data/lib/overwrite.rb
CHANGED
@@ -8,6 +8,7 @@ before {
|
|
8
8
|
$url_provider = self
|
9
9
|
# stupid internet explorer does not ask for text/html, add this manually
|
10
10
|
request.env['HTTP_ACCEPT'] += ";text/html" if request.env["HTTP_USER_AGENT"]=~/MSIE/
|
11
|
+
request.env['HTTP_ACCEPT']=request.params["media"] if request.params["media"]
|
11
12
|
}
|
12
13
|
|
13
14
|
# Error handling
|
@@ -39,20 +40,24 @@ end
|
|
39
40
|
class Sinatra::Base
|
40
41
|
|
41
42
|
def return_task( task )
|
42
|
-
|
43
|
+
raise "http_code == nil" unless task.http_code!=nil
|
43
44
|
case request.env['HTTP_ACCEPT']
|
44
45
|
when /rdf/
|
45
46
|
response['Content-Type'] = "application/rdf+xml"
|
46
|
-
halt
|
47
|
+
halt task.http_code,task.to_rdfxml
|
47
48
|
when /yaml/
|
48
49
|
response['Content-Type'] = "application/x-yaml"
|
49
|
-
halt
|
50
|
+
halt task.http_code,task.to_yaml # PENDING differs from task-webservice
|
50
51
|
when /html/
|
51
52
|
response['Content-Type'] = "text/html"
|
52
|
-
halt
|
53
|
+
halt task.http_code,OpenTox.text_to_html(task.to_yaml, @subjectid)
|
53
54
|
else # default /uri-list/
|
54
55
|
response['Content-Type'] = "text/uri-list"
|
55
|
-
|
56
|
+
if task.completed?
|
57
|
+
halt task.http_code,task.resultURI+"\n"
|
58
|
+
else
|
59
|
+
halt task.http_code,task.uri+"\n"
|
60
|
+
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
end
|
data/lib/parser.rb
CHANGED
@@ -55,7 +55,14 @@ module OpenTox
|
|
55
55
|
parameter_ids = []
|
56
56
|
`rapper -i rdfxml -o ntriples #{file.path} 2>/dev/null`.each_line do |line|
|
57
57
|
triple = line.to_triple
|
58
|
-
|
58
|
+
if triple[0] == @uri
|
59
|
+
if triple[1] == RDF.type # allow multiple types
|
60
|
+
@metadata[triple[1]] = [] unless @metadata[triple[1]]
|
61
|
+
@metadata[triple[1]] << triple[2].split('^^').first
|
62
|
+
else
|
63
|
+
@metadata[triple[1]] = triple[2].split('^^').first
|
64
|
+
end
|
65
|
+
end
|
59
66
|
statements << triple
|
60
67
|
parameter_ids << triple[2] if triple[1] == OT.parameters
|
61
68
|
end
|
@@ -156,6 +163,7 @@ module OpenTox
|
|
156
163
|
data = {}
|
157
164
|
feature_values = {}
|
158
165
|
feature = {}
|
166
|
+
feature_accept_values = {}
|
159
167
|
other_statements = {}
|
160
168
|
`rapper -i rdfxml -o ntriples #{file.path} 2>/dev/null`.each_line do |line|
|
161
169
|
triple = line.chomp.split(' ',3)
|
@@ -175,6 +183,9 @@ module OpenTox
|
|
175
183
|
if triple[2]=~/#{OT.Compound}/i and !data[triple[0]]
|
176
184
|
data[triple[0]] = {:compound => triple[0], :values => []}
|
177
185
|
end
|
186
|
+
when /#{OT.acceptValue}/i # acceptValue in ambit datasets is only provided in dataset/<id> no in dataset/<id>/features
|
187
|
+
feature_accept_values[triple[0]] = [] unless feature_accept_values[triple[0]]
|
188
|
+
feature_accept_values[triple[0]] << triple[2]
|
178
189
|
else
|
179
190
|
end
|
180
191
|
end
|
@@ -185,20 +196,25 @@ module OpenTox
|
|
185
196
|
@dataset.add_compound(entry[:compound])
|
186
197
|
else
|
187
198
|
entry[:values].each do |value_id|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
199
|
+
if feature_values[value_id]
|
200
|
+
split = feature_values[value_id].split(/\^\^/)
|
201
|
+
case split[-1]
|
202
|
+
when XSD.double, XSD.float
|
203
|
+
value = split.first.to_f
|
204
|
+
when XSD.boolean
|
205
|
+
value = split.first=~/(?i)true/ ? true : false
|
206
|
+
else
|
207
|
+
value = split.first
|
208
|
+
end
|
196
209
|
end
|
197
210
|
@dataset.add entry[:compound],feature[value_id],value
|
198
211
|
end
|
199
212
|
end
|
200
213
|
end
|
201
214
|
load_features subjectid
|
215
|
+
feature_accept_values.each do |feature, values|
|
216
|
+
@dataset.features[feature][OT.acceptValue] = values
|
217
|
+
end
|
202
218
|
@dataset.metadata = load_metadata(subjectid)
|
203
219
|
@dataset
|
204
220
|
end
|
@@ -223,7 +239,7 @@ module OpenTox
|
|
223
239
|
`rapper -i rdfxml -o ntriples #{file.path} 2>/dev/null`.each_line do |line|
|
224
240
|
triple = line.chomp.split('> ').collect{|i| i.sub(/\s+.$/,'').gsub(/[<>"]/,'')}[0..2]
|
225
241
|
statements << triple
|
226
|
-
features << triple[0] if triple[1] == RDF
|
242
|
+
features << triple[0] if triple[1] == RDF.type and (triple[2] =~ /Feature|Substructure/)
|
227
243
|
end
|
228
244
|
File.delete(to_delete) if to_delete
|
229
245
|
statements.each do |triple|
|
@@ -289,7 +305,7 @@ module OpenTox
|
|
289
305
|
else
|
290
306
|
type = types.first
|
291
307
|
end
|
292
|
-
@dataset.add_feature_metadata(feature,{
|
308
|
+
@dataset.add_feature_metadata(feature,{RDF.type => [type]})
|
293
309
|
info += "\"#{@dataset.feature_name(feature)}\" detected as #{type.split('#').last}."
|
294
310
|
|
295
311
|
# TODO: rewrite feature values
|
@@ -341,16 +357,23 @@ module OpenTox
|
|
341
357
|
when OT.NominalFeature
|
342
358
|
case value.to_s
|
343
359
|
when TRUE_REGEXP
|
344
|
-
|
360
|
+
val = true
|
345
361
|
when FALSE_REGEXP
|
346
|
-
|
362
|
+
val = false
|
347
363
|
end
|
348
364
|
when OT.NumericFeature
|
349
|
-
|
365
|
+
val = value.to_f
|
350
366
|
when OT.StringFeature
|
351
|
-
|
367
|
+
val = value.to_s
|
352
368
|
@activity_errors << smiles+", "+row.join(", ")
|
353
369
|
end
|
370
|
+
if val!=nil
|
371
|
+
@dataset.add(compound.uri, feature, val)
|
372
|
+
if type!=OT.NumericFeature
|
373
|
+
@dataset.features[feature][OT.acceptValue] = [] unless @dataset.features[feature][OT.acceptValue]
|
374
|
+
@dataset.features[feature][OT.acceptValue] << val.to_s unless @dataset.features[feature][OT.acceptValue].include?(val.to_s)
|
375
|
+
end
|
376
|
+
end
|
354
377
|
end
|
355
378
|
end
|
356
379
|
|
data/lib/rest_client_wrapper.rb
CHANGED
@@ -98,6 +98,8 @@ module OpenTox
|
|
98
98
|
|
99
99
|
rescue RestClient::RequestTimeout => ex
|
100
100
|
received_error ex.message, 408, nil, {:rest_uri => uri, :headers => headers, :payload => payload}
|
101
|
+
rescue Errno::ETIMEDOUT => ex
|
102
|
+
received_error ex.message, 408, nil, {:rest_uri => uri, :headers => headers, :payload => payload}
|
101
103
|
rescue Errno::ECONNREFUSED => ex
|
102
104
|
received_error ex.message, 500, nil, {:rest_uri => uri, :headers => headers, :payload => payload}
|
103
105
|
rescue RestClient::ExceptionWithResponse => ex
|
data/lib/serializer.rb
CHANGED
@@ -26,6 +26,8 @@ module OpenTox
|
|
26
26
|
OT.Algorithm => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } ,
|
27
27
|
OT.Parameter => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } ,
|
28
28
|
OT.Task => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } ,
|
29
|
+
OTA.PatternMiningSupervised => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } ,
|
30
|
+
|
29
31
|
#classes for validation
|
30
32
|
OT.Validation => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } ,
|
31
33
|
OT.ClassificationStatistics => { RDF["type"] => [{ "type" => "uri", "value" => OWL['Class'] }] } ,
|
@@ -40,10 +42,10 @@ module OpenTox
|
|
40
42
|
OT.compound => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
41
43
|
OT.feature => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
42
44
|
OT.dataEntry => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
43
|
-
OT.acceptValue => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
44
45
|
OT.values => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
45
46
|
OT.algorithm => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
46
47
|
OT.parameters => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
48
|
+
|
47
49
|
#object props for validation#
|
48
50
|
OT.model => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
49
51
|
OT.trainingDataset => { RDF["type"] => [{ "type" => "uri", "value" => OWL.ObjectProperty }] } ,
|
@@ -67,12 +69,14 @@ module OpenTox
|
|
67
69
|
DC.creator => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
68
70
|
DC.description => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
69
71
|
DC.date => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
70
|
-
OT.isA => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
72
|
+
#OT.isA => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
71
73
|
OT.Warnings => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
72
74
|
XSD.anyURI => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
73
75
|
OT.hasStatus => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
74
76
|
OT.resultURI => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
75
77
|
OT.percentageCompleted => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
78
|
+
OT.acceptValue => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
79
|
+
|
76
80
|
# annotation props for validation
|
77
81
|
OT.numUnpredicted => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
78
82
|
OT.crossvalidationFold => { RDF["type"] => [{ "type" => "uri", "value" => OWL.AnnotationProperty }] } ,
|
@@ -256,7 +260,8 @@ module OpenTox
|
|
256
260
|
def add_metadata(uri,metadata)
|
257
261
|
id = 0
|
258
262
|
metadata.each do |u,v|
|
259
|
-
if v.is_a? Array and u == OT.parameters
|
263
|
+
#if v.is_a? Array and (u == OT.parameters or u == RDF.type)
|
264
|
+
if v.is_a? Array and u == OT.parameters#or u == RDF.type)
|
260
265
|
@object[uri][u] = [] unless @object[uri][u]
|
261
266
|
v.each do |value|
|
262
267
|
id+=1
|
@@ -267,7 +272,13 @@ module OpenTox
|
|
267
272
|
@object[genid][name] = [{"type" => type(entry), "value" => entry }]
|
268
273
|
end
|
269
274
|
end
|
270
|
-
|
275
|
+
elsif v.is_a? Array and u == RDF.type
|
276
|
+
@object[uri] = {} unless @object[uri]
|
277
|
+
v.each do |value|
|
278
|
+
@object[uri][u] = [] unless @object[uri][u]
|
279
|
+
@object[uri][u] << {"type" => type(value), "value" => value }
|
280
|
+
end
|
281
|
+
elsif v.is_a? String
|
271
282
|
@object[uri] = {} unless @object[uri]
|
272
283
|
@object[uri][u] = [{"type" => type(v), "value" => v }]
|
273
284
|
end
|
@@ -309,6 +320,7 @@ module OpenTox
|
|
309
320
|
OT.value => v
|
310
321
|
}
|
311
322
|
@object[feature][RDF["type"]] << { "type" => "uri", "value" => featuretype(value) }
|
323
|
+
#@object[feature][RDF["type"]] = { "type" => "uri", "value" => featuretype(value) }
|
312
324
|
end
|
313
325
|
|
314
326
|
# Serializers
|
data/lib/task.rb
CHANGED
@@ -8,6 +8,7 @@ module OpenTox
|
|
8
8
|
|
9
9
|
def initialize(uri=nil)
|
10
10
|
super uri
|
11
|
+
@http_code = 202
|
11
12
|
@metadata = {
|
12
13
|
DC.title => "",
|
13
14
|
DC.date => "",
|
@@ -154,6 +155,7 @@ module OpenTox
|
|
154
155
|
|
155
156
|
# not stored just for to_rdf
|
156
157
|
def add_error_report( error_report )
|
158
|
+
raise "not an error report: "+error_report.class.to_s unless error_report.is_a?(ErrorReport)
|
157
159
|
@error_report = error_report
|
158
160
|
end
|
159
161
|
|
data/lib/validation.rb
CHANGED
@@ -12,6 +12,40 @@ module OpenTox
|
|
12
12
|
val
|
13
13
|
end
|
14
14
|
|
15
|
+
# returns a filtered list of validation uris
|
16
|
+
# @param [Hash,optional] params, validation-params to filter the uris (could be model, training_dataset, ..)
|
17
|
+
# @return [Array]
|
18
|
+
def self.list( params={} )
|
19
|
+
filter_string = ""
|
20
|
+
params.each do |k,v|
|
21
|
+
filter_string = "?" if filter_string.length==0
|
22
|
+
filter_string += k.to_s+"="+v
|
23
|
+
end
|
24
|
+
(OpenTox::RestClientWrapper.get(CONFIG[:services]["opentox-validation"]+filter_string).split("\n"))
|
25
|
+
end
|
26
|
+
|
27
|
+
# creates a training test split validation, waits until it finishes, may take some time
|
28
|
+
# @param [Hash] params (required:algorithm_uri,dataset_uri,prediction_feature, optional:algorithm_params,split_ratio(0.67),random_seed(1))
|
29
|
+
# @param [String,optional] subjectid
|
30
|
+
# @param [OpenTox::Task,optional] waiting_task (can be a OpenTox::Subtask as well), progress is updated accordingly
|
31
|
+
# @return [OpenTox::Validation]
|
32
|
+
def self.create_training_test_split( params, subjectid=nil, waiting_task=nil )
|
33
|
+
params[:subjectid] = subjectid if subjectid
|
34
|
+
uri = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services]["opentox-validation"],"training_test_split"),
|
35
|
+
params,{:content_type => "text/uri-list"},waiting_task )
|
36
|
+
Validation.new(uri)
|
37
|
+
end
|
38
|
+
|
39
|
+
# looks for report for this validation, creates a report if no report is found
|
40
|
+
# @param [String,optional] subjectid
|
41
|
+
# @param [OpenTox::Task,optional] waiting_task (can be a OpenTox::Subtask as well), progress is updated accordingly
|
42
|
+
# @return [String] report uri
|
43
|
+
def find_or_create_report( subjectid=nil, waiting_task=nil )
|
44
|
+
@report = ValidationReport.find_for_validation(@uri, subjectid) unless @report
|
45
|
+
@report = ValidationReport.create(@uri, subjectid, waiting_task) unless @report
|
46
|
+
@report.uri
|
47
|
+
end
|
48
|
+
|
15
49
|
# creates a validation object from crossvaldiation statistics, raise error if not found
|
16
50
|
# (as crossvaldiation statistics are returned as an average valdidation over all folds)
|
17
51
|
# @param [String] crossvalidation uri
|
@@ -42,7 +76,7 @@ module OpenTox
|
|
42
76
|
res[:true_negatives] = s[OT.numTrueNegatives]
|
43
77
|
res[:false_negatives] = s[OT.numFalseNegatives]
|
44
78
|
res[:sensitivity] = s[OT.truePositiveRate]
|
45
|
-
res[:specificity] = s[OT.
|
79
|
+
res[:specificity] = s[OT.trueNegativeRate]
|
46
80
|
break
|
47
81
|
end
|
48
82
|
end
|
@@ -72,6 +106,18 @@ module OpenTox
|
|
72
106
|
cv.load_metadata( subjectid )
|
73
107
|
cv
|
74
108
|
end
|
109
|
+
|
110
|
+
# returns a filtered list of crossvalidation uris
|
111
|
+
# @param [Hash,optional] params, crossvalidation-params to filter the uris (could be algorithm, dataset, ..)
|
112
|
+
# @return [Array]
|
113
|
+
def self.list( params={} )
|
114
|
+
filter_string = ""
|
115
|
+
params.each do |k,v|
|
116
|
+
filter_string = "?" if filter_string.length==0
|
117
|
+
filter_string += k.to_s+"="+v
|
118
|
+
end
|
119
|
+
(OpenTox::RestClientWrapper.get(File.join(CONFIG[:services]["opentox-validation"],"crossvalidation")+filter_string).split("\n"))
|
120
|
+
end
|
75
121
|
|
76
122
|
# creates a crossvalidations, waits until it finishes, may take some time
|
77
123
|
# @param [Hash] params (required:algorithm_uri,dataset_uri,prediction_feature, optional:algorithm_params,num_folds(10),random_seed(1),stratified(false))
|
@@ -110,6 +156,17 @@ module OpenTox
|
|
110
156
|
class ValidationReport
|
111
157
|
include OpenTox
|
112
158
|
|
159
|
+
# finds ValidationReport via uri, raises error if not found
|
160
|
+
# @param [String] uri
|
161
|
+
# @param [String,optional] subjectid
|
162
|
+
# @return [OpenTox::ValidationReport]
|
163
|
+
def self.find( uri, subjectid=nil )
|
164
|
+
OpenTox::RestClientWrapper.get(uri,{:subjectid => subjectid})
|
165
|
+
rep = ValidationReport.new(uri)
|
166
|
+
rep.load_metadata( subjectid )
|
167
|
+
rep
|
168
|
+
end
|
169
|
+
|
113
170
|
# finds ValidationReport for a particular validation
|
114
171
|
# @param [String] crossvalidation uri
|
115
172
|
# @param [String,optional] subjectid
|
@@ -120,6 +177,17 @@ module OpenTox
|
|
120
177
|
uris.size==0 ? nil : ValidationReport.new(uris[-1])
|
121
178
|
end
|
122
179
|
|
180
|
+
# creates a validation report via validation
|
181
|
+
# @param [String] validation uri
|
182
|
+
# @param [String,optional] subjectid
|
183
|
+
# @param [OpenTox::Task,optional] waiting_task (can be a OpenTox::Subtask as well), progress is updated accordingly
|
184
|
+
# @return [OpenTox::ValidationReport]
|
185
|
+
def self.create( validation_uri, subjectid=nil, waiting_task=nil )
|
186
|
+
uri = RestClientWrapper.post(File.join(CONFIG[:services]["opentox-validation"],"/report/validation"),
|
187
|
+
{ :validation_uris => validation_uri, :subjectid => subjectid }, {}, waiting_task )
|
188
|
+
ValidationReport.new(uri)
|
189
|
+
end
|
190
|
+
|
123
191
|
end
|
124
192
|
|
125
193
|
class CrossvalidationReport
|
@@ -132,7 +200,9 @@ module OpenTox
|
|
132
200
|
def self.find( uri, subjectid=nil )
|
133
201
|
# PENDING load report data?
|
134
202
|
OpenTox::RestClientWrapper.get(uri,{:subjectid => subjectid})
|
135
|
-
CrossvalidationReport.new(uri)
|
203
|
+
rep = CrossvalidationReport.new(uri)
|
204
|
+
rep.load_metadata( subjectid )
|
205
|
+
rep
|
136
206
|
end
|
137
207
|
|
138
208
|
# finds CrossvalidationReport for a particular crossvalidation
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentox-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
7
|
- 2
|
10
|
-
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christoph Helma, Martin Guetlein, Andreas Maunz, Micha Rautenberg, David Vorgrimmler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-23 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -257,7 +257,7 @@ dependencies:
|
|
257
257
|
type: :runtime
|
258
258
|
version_requirements: *id017
|
259
259
|
- !ruby/object:Gem::Dependency
|
260
|
-
name:
|
260
|
+
name: ohm-contrib
|
261
261
|
prerelease: false
|
262
262
|
requirement: &id018 !ruby/object:Gem::Requirement
|
263
263
|
none: false
|
@@ -271,7 +271,7 @@ dependencies:
|
|
271
271
|
type: :runtime
|
272
272
|
version_requirements: *id018
|
273
273
|
- !ruby/object:Gem::Dependency
|
274
|
-
name:
|
274
|
+
name: SystemTimer
|
275
275
|
prerelease: false
|
276
276
|
requirement: &id019 !ruby/object:Gem::Requirement
|
277
277
|
none: false
|
@@ -285,9 +285,121 @@ dependencies:
|
|
285
285
|
type: :runtime
|
286
286
|
version_requirements: *id019
|
287
287
|
- !ruby/object:Gem::Dependency
|
288
|
-
name:
|
288
|
+
name: rjb
|
289
289
|
prerelease: false
|
290
290
|
requirement: &id020 !ruby/object:Gem::Requirement
|
291
|
+
none: false
|
292
|
+
requirements:
|
293
|
+
- - ">="
|
294
|
+
- !ruby/object:Gem::Version
|
295
|
+
hash: 3
|
296
|
+
segments:
|
297
|
+
- 0
|
298
|
+
version: "0"
|
299
|
+
type: :runtime
|
300
|
+
version_requirements: *id020
|
301
|
+
- !ruby/object:Gem::Dependency
|
302
|
+
name: dm-core
|
303
|
+
prerelease: false
|
304
|
+
requirement: &id021 !ruby/object:Gem::Requirement
|
305
|
+
none: false
|
306
|
+
requirements:
|
307
|
+
- - ">="
|
308
|
+
- !ruby/object:Gem::Version
|
309
|
+
hash: 3
|
310
|
+
segments:
|
311
|
+
- 0
|
312
|
+
version: "0"
|
313
|
+
type: :runtime
|
314
|
+
version_requirements: *id021
|
315
|
+
- !ruby/object:Gem::Dependency
|
316
|
+
name: dm-serializer
|
317
|
+
prerelease: false
|
318
|
+
requirement: &id022 !ruby/object:Gem::Requirement
|
319
|
+
none: false
|
320
|
+
requirements:
|
321
|
+
- - ">="
|
322
|
+
- !ruby/object:Gem::Version
|
323
|
+
hash: 3
|
324
|
+
segments:
|
325
|
+
- 0
|
326
|
+
version: "0"
|
327
|
+
type: :runtime
|
328
|
+
version_requirements: *id022
|
329
|
+
- !ruby/object:Gem::Dependency
|
330
|
+
name: dm-timestamps
|
331
|
+
prerelease: false
|
332
|
+
requirement: &id023 !ruby/object:Gem::Requirement
|
333
|
+
none: false
|
334
|
+
requirements:
|
335
|
+
- - ">="
|
336
|
+
- !ruby/object:Gem::Version
|
337
|
+
hash: 3
|
338
|
+
segments:
|
339
|
+
- 0
|
340
|
+
version: "0"
|
341
|
+
type: :runtime
|
342
|
+
version_requirements: *id023
|
343
|
+
- !ruby/object:Gem::Dependency
|
344
|
+
name: dm-types
|
345
|
+
prerelease: false
|
346
|
+
requirement: &id024 !ruby/object:Gem::Requirement
|
347
|
+
none: false
|
348
|
+
requirements:
|
349
|
+
- - ">="
|
350
|
+
- !ruby/object:Gem::Version
|
351
|
+
hash: 3
|
352
|
+
segments:
|
353
|
+
- 0
|
354
|
+
version: "0"
|
355
|
+
type: :runtime
|
356
|
+
version_requirements: *id024
|
357
|
+
- !ruby/object:Gem::Dependency
|
358
|
+
name: dm-migrations
|
359
|
+
prerelease: false
|
360
|
+
requirement: &id025 !ruby/object:Gem::Requirement
|
361
|
+
none: false
|
362
|
+
requirements:
|
363
|
+
- - ">="
|
364
|
+
- !ruby/object:Gem::Version
|
365
|
+
hash: 3
|
366
|
+
segments:
|
367
|
+
- 0
|
368
|
+
version: "0"
|
369
|
+
type: :runtime
|
370
|
+
version_requirements: *id025
|
371
|
+
- !ruby/object:Gem::Dependency
|
372
|
+
name: dm-validations
|
373
|
+
prerelease: false
|
374
|
+
requirement: &id026 !ruby/object:Gem::Requirement
|
375
|
+
none: false
|
376
|
+
requirements:
|
377
|
+
- - ">="
|
378
|
+
- !ruby/object:Gem::Version
|
379
|
+
hash: 3
|
380
|
+
segments:
|
381
|
+
- 0
|
382
|
+
version: "0"
|
383
|
+
type: :runtime
|
384
|
+
version_requirements: *id026
|
385
|
+
- !ruby/object:Gem::Dependency
|
386
|
+
name: dm-sqlite-adapter
|
387
|
+
prerelease: false
|
388
|
+
requirement: &id027 !ruby/object:Gem::Requirement
|
389
|
+
none: false
|
390
|
+
requirements:
|
391
|
+
- - ">="
|
392
|
+
- !ruby/object:Gem::Version
|
393
|
+
hash: 3
|
394
|
+
segments:
|
395
|
+
- 0
|
396
|
+
version: "0"
|
397
|
+
type: :runtime
|
398
|
+
version_requirements: *id027
|
399
|
+
- !ruby/object:Gem::Dependency
|
400
|
+
name: haml
|
401
|
+
prerelease: false
|
402
|
+
requirement: &id028 !ruby/object:Gem::Requirement
|
291
403
|
none: false
|
292
404
|
requirements:
|
293
405
|
- - ">="
|
@@ -297,11 +409,27 @@ dependencies:
|
|
297
409
|
- 3
|
298
410
|
version: "3"
|
299
411
|
type: :runtime
|
300
|
-
version_requirements: *
|
412
|
+
version_requirements: *id028
|
413
|
+
- !ruby/object:Gem::Dependency
|
414
|
+
name: ruby-plot
|
415
|
+
prerelease: false
|
416
|
+
requirement: &id029 !ruby/object:Gem::Requirement
|
417
|
+
none: false
|
418
|
+
requirements:
|
419
|
+
- - ~>
|
420
|
+
- !ruby/object:Gem::Version
|
421
|
+
hash: 15
|
422
|
+
segments:
|
423
|
+
- 0
|
424
|
+
- 4
|
425
|
+
- 0
|
426
|
+
version: 0.4.0
|
427
|
+
type: :runtime
|
428
|
+
version_requirements: *id029
|
301
429
|
- !ruby/object:Gem::Dependency
|
302
430
|
name: jeweler
|
303
431
|
prerelease: false
|
304
|
-
requirement: &
|
432
|
+
requirement: &id030 !ruby/object:Gem::Requirement
|
305
433
|
none: false
|
306
434
|
requirements:
|
307
435
|
- - ">="
|
@@ -311,7 +439,7 @@ dependencies:
|
|
311
439
|
- 0
|
312
440
|
version: "0"
|
313
441
|
type: :development
|
314
|
-
version_requirements: *
|
442
|
+
version_requirements: *id030
|
315
443
|
description: Ruby wrapper for the OpenTox REST API (http://www.opentox.org)
|
316
444
|
email: helma@in-silico.ch
|
317
445
|
executables:
|
@@ -339,7 +467,7 @@ files:
|
|
339
467
|
- lib/feature.rb
|
340
468
|
- lib/helper.rb
|
341
469
|
- lib/model.rb
|
342
|
-
- lib/
|
470
|
+
- lib/ontology.rb
|
343
471
|
- lib/opentox-ruby.rb
|
344
472
|
- lib/opentox.owl
|
345
473
|
- lib/opentox.rb
|
@@ -350,7 +478,6 @@ files:
|
|
350
478
|
- lib/serializer.rb
|
351
479
|
- lib/spork.rb
|
352
480
|
- lib/task.rb
|
353
|
-
- lib/templates/config.yaml
|
354
481
|
- lib/templates/default_guest_policy.xml
|
355
482
|
- lib/templates/default_policy.xml
|
356
483
|
- lib/to-html.rb
|
@@ -385,7 +512,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
385
512
|
requirements: []
|
386
513
|
|
387
514
|
rubyforge_project:
|
388
|
-
rubygems_version: 1.
|
515
|
+
rubygems_version: 1.5.2
|
389
516
|
signing_key:
|
390
517
|
specification_version: 3
|
391
518
|
summary: Ruby wrapper for the OpenTox REST API
|
data/lib/templates/config.yaml
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# Example configuration for OpenTox, please adjust to your settings
|
2
|
-
#
|
3
|
-
# Database setup:
|
4
|
-
#
|
5
|
-
# Example MySql:
|
6
|
-
#
|
7
|
-
:database:
|
8
|
-
:adapter: mysql
|
9
|
-
:database: production
|
10
|
-
:username: root
|
11
|
-
:password: opentox
|
12
|
-
:host: localhost
|
13
|
-
#
|
14
|
-
# Example 1: Using external test services
|
15
|
-
#
|
16
|
-
# :services:
|
17
|
-
# opentox-compound: "http://webservices.in-silico.ch/compound/"
|
18
|
-
# opentox-dataset: "http://webservices.in-silico.ch/dataset/"
|
19
|
-
# opentox-algorithm: "http://webservices.in-silico.ch/algorithm/"
|
20
|
-
# opentox-model: "http://webservices.in-silico.ch/model/"
|
21
|
-
# opentox-task: "http://webservices.in-silico.ch/task/"
|
22
|
-
# opentox-validation: "http://opentox.informatik.uni-freiburg.de/validation/"
|
23
|
-
#
|
24
|
-
# Example 2: Using local services
|
25
|
-
:base_dir: /home/ist/webservices
|
26
|
-
:webserver: passenger
|
27
|
-
:services:
|
28
|
-
opentox-compound: "http://localhost/compound/"
|
29
|
-
opentox-dataset: "http://localhost/dataset/"
|
30
|
-
opentox-algorithm: "http://localhost/algorithm/"
|
31
|
-
opentox-model: "http://localhost/model/"
|
32
|
-
opentox-task: "http://localhost/task/"
|
33
|
-
opentox-validation: "http://localhost/validation/"
|
34
|
-
#
|
35
|
-
# Yaml capable hosts (faster than OWL-DL)
|
36
|
-
#
|
37
|
-
:yaml_hosts:
|
38
|
-
- "localhost"
|
39
|
-
|
40
|
-
# Uncomment for verbose logging
|
41
|
-
# :logger: debug
|
42
|
-
# :backtrace: 1
|
43
|
-
|
44
|
-
|
45
|
-
# OpenSSO Authorization
|
46
|
-
# set ":server: " to disable A&A
|
47
|
-
:authorization:
|
48
|
-
:server: "https://opensso.in-silico.ch"
|
49
|
-
:free_request: #request-method not controlled by A&A
|
50
|
-
- "GET"
|
51
|
-
:authenticate_request: #only for authenticated user
|
52
|
-
- "POST"
|
53
|
-
:authorize_request: #only for authenticated and authorizeduser
|
54
|
-
- "DELETE"
|
55
|
-
- "PUT"
|
56
|
-
# Exceptions:
|
57
|
-
:free_uris: #request-method for uri not controlled by A&A
|
58
|
-
? - :GET
|
59
|
-
: - !ruby/regexp /localhost\/algorithm/
|
60
|
-
- "http://localhost/dataset"
|
61
|
-
- "http://localhost/model"
|
62
|
-
- "http://localhost/validation"
|
63
|
-
- "http://localhost/validation/crossvalidation"
|
64
|
-
- "http://localhost/validation/reach_report"
|
65
|
-
- "http://localhost/validation/reach_report/crossvalidation"
|
66
|
-
- "http://localhost/validation/report"
|
67
|
-
- "http://localhost/validation/report/crossvalidation"
|
68
|
-
- "http://localhost/validation/reach_report/qmrf"
|
69
|
-
? - :GET
|
70
|
-
- :POST
|
71
|
-
: - !ruby/regexp /localhost\/toxcreate/
|
72
|
-
- !ruby/regexp /localhost\/task/
|
73
|
-
- !ruby/regexp /localhost\/compound/
|
74
|
-
? - :PUT
|
75
|
-
: - !ruby/regexp /localhost\/task/
|
76
|
-
|
77
|
-
:authorize_exceptions: #request-method for uri only authenticated, no authorization
|
78
|
-
? - :POST
|
79
|
-
: - !ruby/regexp /localhost\/algorithm/
|
80
|
-
- "http://localhost/dataset"
|
81
|
-
- "http://localhost/model"
|
82
|
-
- "http://localhost/validation"
|
83
|
-
- !ruby/regexp /localhost\/validation\/[a-z,A-Z,\/,_\-]*$/
|
84
|
-
|
85
|
-
|
86
|
-
|