From 5a743cbe5fb69dcb86bf16f7a9437a188fc975d3 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 7 May 2010 15:36:40 +0200 Subject: Initial changes from Martin merged --- lazar.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lazar.rb b/lazar.rb index fd0067c..5d3eea6 100644 --- a/lazar.rb +++ b/lazar.rb @@ -136,9 +136,9 @@ get '/:id/algorithm/?' do YAML.load(Lazar.get(params[:id]).yaml).algorithm end -get '/:id/training_dataset/?' do +get '/:id/trainingDataset/?' do response['Content-Type'] = 'text/plain' - YAML.load(Lazar.get(params[:id]).yaml).activity_dataset_uri + YAML.load(Lazar.get(params[:id]).yaml).trainingDataset end get '/:id/feature_dataset/?' do -- cgit v1.2.3 From b45adee3aaf134dd240d19cf5b19cf3348030107 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 12 May 2010 12:31:40 +0200 Subject: Modification for new RestClient: body instead of to_s --- lazar.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lazar.rb b/lazar.rb index 5d3eea6..ef786f0 100644 --- a/lazar.rb +++ b/lazar.rb @@ -57,16 +57,17 @@ class Lazar < Model lazar = YAML.load self.yaml db_activities = lazar.activities[compound_uri] if db_activities - prediction.source = lazar.trainingDataset + prediction.creator = lazar.trainingDataset feature_uri = lazar.dependentVariables prediction.compounds << compound_uri prediction.features << feature_uri prediction.data[compound_uri] = [] unless prediction.data[compound_uri] db_activities.each do |act| - tuple = { - :classification => act, - :confidence => 1} - prediction.data[compound_uri] << {feature_uri => tuple} + prediction.data[compound_uri] << {feature_uri => act} + #tuple = { + # :classification => act} + #:confidence => "experimental"} + #prediction.data[compound_uri] << {feature_uri => tuple} end true else @@ -76,8 +77,8 @@ class Lazar < Model def to_owl data = YAML.load(yaml) - activity_dataset = YAML.load(RestClient.get(data.trainingDataset, :accept => 'application/x-yaml').to_s) - feature_dataset = YAML.load(RestClient.get(data.feature_dataset_uri, :accept => 'application/x-yaml').to_s) + activity_dataset = YAML.load(RestClient.get(data.trainingDataset, :accept => 'application/x-yaml').body) + feature_dataset = YAML.load(RestClient.get(data.feature_dataset_uri, :accept => 'application/x-yaml').body) owl = OpenTox::Owl.create 'Model', uri owl.set("creator","http://github.com/helma/opentox-model") owl.set("title","#{URI.decode(activity_dataset.title)} lazar classification") -- cgit v1.2.3 From 76cb29b67d51d907ee3c0e5cbc7ad1b8209bccc1 Mon Sep 17 00:00:00 2001 From: ch Date: Wed, 12 May 2010 14:12:23 +0200 Subject: opentox-api-wrapper version updated --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 2552c52..992fa17 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.4.0' +gem 'opentox-ruby-api-wrapper', '= 1.5.0' require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 00c47eb47d6c8f357063c2bb0d972f91e312e2f6 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 18 May 2010 11:52:26 +0200 Subject: api-wrapper version 1.5.1 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 992fa17..c3b9921 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.0' +gem 'opentox-ruby-api-wrapper', '= 1.5.1' require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 4ae511a34ac028d0ee7db0ed8960c1937280db02 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 20 May 2010 10:33:31 +0200 Subject: opentox-ruby-api-wrapper bumped to 1.5.2 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index c3b9921..f01a410 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.1' +gem 'opentox-ruby-api-wrapper', '= 1.5.2' require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 88ddb178b3ab23e9bde86a97b3161df8fb881092 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 12:42:09 +0200 Subject: opentox-ruby-api-wrapper bumped to 1.5.3 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index f01a410..f0de0d7 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.2' +gem 'opentox-ruby-api-wrapper', '= 1.5.3' require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 0d98db2228c85d5ae170df490e79c5d7ca048e23 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 15:58:32 +0200 Subject: READMEs updated --- README | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index c4d3375..81c96e4 100644 --- a/README +++ b/README @@ -21,22 +21,22 @@ Supported MIME formats (http://chemical-mime.sourceforge.net/): Examples: List all lazar models - curl http://webservices.in-silico.ch/test/model + curl http://webservices.in-silico.ch/model Get the representation of a lazar model - curl -H "Accept:application/rdf+xml" http://webservices.in-silico.ch/test/model/{id} + curl -H "Accept:application/rdf+xml" http://webservices.in-silico.ch/model/{id} Predict a compound - curl -X POST -d compound_uri={compound_uri} http://webservices.in-silico.ch/test/model/{id} + curl -X POST -d compound_uri={compound_uri} http://webservices.in-silico.ch/model/{id} Predict a compound and get the result as YAML - curl -X POST -H "Accept:application/x-yaml" -d compound_uri={compound_uri} http://webservices.in-silico.ch/test/model/{id} + curl -X POST -H "Accept:application/x-yaml" -d compound_uri={compound_uri} http://webservices.in-silico.ch/model/{id} Predict a dataset - curl -X POST -d dataset_uri={dataset_uri} http://webservices.in-silico.ch/test/model/{id} + curl -X POST -d dataset_uri={dataset_uri} http://webservices.in-silico.ch/model/{id} Delete a model - curl -X DELETE http://webservices.in-silico.ch/test/model/{id} + curl -X DELETE http://webservices.in-silico.ch/model/{id} More documentation: Source code (application.rb, lazar.rb) -- cgit v1.2.3 From 20a553ccf452d772f4a289239f9ef5b939c3915b Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 16:47:50 +0200 Subject: opentox-api-wrapper bumped to 1.5.4 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index f0de0d7..6d7e5bf 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.3' +gem 'opentox-ruby-api-wrapper', '= 1.5.4' require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 437a755afc8750781962d24aa5e19637b0585138 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 18:46:23 +0200 Subject: opentox-api-wrapper bumped to 1.5.5 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 6d7e5bf..483a9c4 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.4' +gem "opentox-ruby-api-wrapper", "= 1.5.4" require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From c9c48a20e31f3ae71948a30347db6eaa0ff76b3d Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 18:48:47 +0200 Subject: opentox-api-wrapper bumped to --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 483a9c4..995739e 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem "opentox-ruby-api-wrapper", "= 1.5.4" +gem "opentox-ruby-api-wrapper", "= " require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From ffb03b361fda0dff45148fab75fec766fce0d453 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 18:57:53 +0200 Subject: opentox-api-wrapper bumped to 1.5.5 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 995739e..e4fc666 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem "opentox-ruby-api-wrapper", "= " +gem "opentox-ruby-api-wrapper", "= 1.5.5" require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From a08dde8b599b26506492c4f20117d11cf667ae57 Mon Sep 17 00:00:00 2001 From: ch Date: Fri, 21 May 2010 22:24:57 +0200 Subject: -am --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 6d7e5bf..7b96bec 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.4' +gem 'opentox-ruby-api-wrapper', '= 1.5.5' require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 246b58b92fe28c2c7d001d0fd2f1d2f66dd7ecea Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 25 May 2010 19:06:31 +0200 Subject: fix for rdf/xml serialisation (commented, to be tested) --- lazar.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lazar.rb b/lazar.rb index ef786f0..5ab9402 100644 --- a/lazar.rb +++ b/lazar.rb @@ -46,6 +46,11 @@ class Lazar < Model :confidence => conf, :similarities => similarities, :features => compound_matches + # uncomment to enable owl-dl serialisation of predictions + # url_for("/lazar#classification") => classification, + # url_for("/lazar#confidence") => conf, + # url_for("/lazar#similarities") => similarities, + # url_for("/lazar#features") => compound_matches } prediction.data[compound_uri] << {feature_uri => tuple} end -- cgit v1.2.3 From 013dd9ea96501a12f28c7d52d8f47ad9febfbf9b Mon Sep 17 00:00:00 2001 From: ch Date: Fri, 28 May 2010 12:24:12 +0200 Subject: catching error during saving prediction dataset --- lazar.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lazar.rb b/lazar.rb index 5ab9402..9dad1c4 100644 --- a/lazar.rb +++ b/lazar.rb @@ -3,8 +3,6 @@ class Lazar < Model attr_accessor :prediction_dataset def classify(compound_uri,prediction) - - prediction.title += " lazar classification" lazar = YAML.load self.yaml compound = OpenTox::Compound.new(:uri => compound_uri) @@ -171,6 +169,7 @@ post '/:id/?' do # create prediction prediction = OpenTox::Dataset.new prediction.creator = lazar.uri prediction.title = URI.decode YAML.load(lazar.yaml).dependentVariables.split(/#/).last + prediction.title += " lazar classification" if compound_uri lazar.classify(compound_uri,prediction) unless lazar.database_activity?(compound_uri,prediction) @@ -191,7 +190,11 @@ elsif dataset_uri input_dataset.compounds.each do |compound_uri| lazar.classify(compound_uri,prediction) unless lazar.database_activity?(compound_uri,prediction) end - uri = prediction.save.chomp + begin + uri = prediction.save.chomp + rescue + halt 500, "Could not save prediction dataset" + end end halt 202,task_uri end -- cgit v1.2.3 From 9024f45ae39b9621c4bce05c1b6bffc383f20864 Mon Sep 17 00:00:00 2001 From: ch Date: Sun, 30 May 2010 11:49:36 +0200 Subject: robots.txt added --- public/robots.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 public/robots.txt diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / -- cgit v1.2.3 From 351f6b0ee64259f1254635704c0edfa5a54b34a8 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 15 Jun 2010 17:17:51 +0200 Subject: updated for new datamapper release --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application.rb b/application.rb index e4fc666..e111673 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem "opentox-ruby-api-wrapper", "= 1.5.5" +gem "opentox-ruby-api-wrapper", "= 1.5.6" require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3