diff options
author | Christoph Helma <helma@in-silico.de> | 2009-08-15 13:45:32 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.de> | 2009-08-15 13:45:32 +0200 |
commit | 5bf99a0df4e24aef86681814951a9a8c08f5a1e6 (patch) | |
tree | f255c26fc0f962030bb21ae951048ae95a79d69f /lib/opentox-ruby-api-wrapper.rb | |
parent | 75d79c2f6556b466898e40049058199fabfe6dd2 (diff) |
authentification helper added, lazar object added
Diffstat (limited to 'lib/opentox-ruby-api-wrapper.rb')
-rw-r--r-- | lib/opentox-ruby-api-wrapper.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/opentox-ruby-api-wrapper.rb b/lib/opentox-ruby-api-wrapper.rb index 70a4580..8e4e28e 100644 --- a/lib/opentox-ruby-api-wrapper.rb +++ b/lib/opentox-ruby-api-wrapper.rb @@ -1,11 +1,12 @@ -require 'rest_client' -require 'crack/xml' -require 'spork' +[ 'rest_client', 'crack/xml', 'spork', 'helper' ].each do |lib| + require lib +end ENV['OPENTOX_COMPOUND'] = 'http://webservices.in-silico.ch/compound/v0/' unless ENV['OPENTOX_COMPOUND'] ENV['OPENTOX_FEATURE'] = 'http://webservices.in-silico.ch/feature/v0/' unless ENV['OPENTOX_FEATURE'] ENV['OPENTOX_DATASET'] = 'http://webservices.in-silico.ch/dataset/v0/' unless ENV['OPENTOX_DATASET'] ENV['OPENTOX_FMINER'] = 'http://webservices.in-silico.ch/fminer/v0/' unless ENV['OPENTOX_FMINER'] +ENV['OPENTOX_LAZAR'] = 'http://webservices.in-silico.ch/lazar/v0/' unless ENV['OPENTOX_LAZAR'] module OpenTox @@ -86,7 +87,6 @@ module OpenTox @uri = params[:uri].to_s elsif params[:name] @uri = RestClient.post ENV['OPENTOX_DATASET'], :name => params[:name] - RestClient.delete @uri + '/associations' end end @@ -140,4 +140,18 @@ module OpenTox end + class Lazar < OpenTox + + # Create a new prediction model from a dataset + def initialize(training_dataset) + @uri = RestClient.post ENV['OPENTOX_LAZAR'] + 'models/' , :dataset_uri => training_dataset.uri + end + + # Predict a compound + def predict(compound) + RestClient.post @uri, :compound_uri => compound.uri + end + + end + end |