diff options
author | Christoph Helma <helma@in-silico.de> | 2009-08-15 18:36:49 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.de> | 2009-08-15 18:36:49 +0200 |
commit | bb2614a3cb7720f906c9d853e0dc1f3713058005 (patch) | |
tree | da9a854d492190ce7ae0f83a1cbb8c51b5fae44a | |
parent | 82f7a9b1a639a8693c0b1267b6b280ee121d8f9a (diff) |
XML support removed, YAML expected for object serialization.
-rw-r--r-- | Rakefile | 1 | ||||
-rw-r--r-- | lib/opentox-ruby-api-wrapper.rb | 19 |
2 files changed, 10 insertions, 10 deletions
@@ -11,7 +11,6 @@ begin gem.homepage = "http://github.com/helma/opentox-ruby-api-wrapper" gem.authors = ["Christoph Helma"] gem.add_dependency "rest-client" - gem.add_dependency "crack" gem.add_development_dependency "thoughtbot-shoulda" # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end diff --git a/lib/opentox-ruby-api-wrapper.rb b/lib/opentox-ruby-api-wrapper.rb index 8e4e28e..81a7292 100644 --- a/lib/opentox-ruby-api-wrapper.rb +++ b/lib/opentox-ruby-api-wrapper.rb @@ -1,4 +1,6 @@ -[ 'rest_client', 'crack/xml', 'spork', 'helper' ].each do |lib| + +#['rubygems', 'rest_client', 'spork', 'helper' ].each do |lib| +['rubygems', 'rest_client', 'spork' ].each do |lib| require lib end @@ -102,12 +104,7 @@ module OpenTox # Get all compounds and features from a dataset, returns a hash with compound_uris as keys and arrays of features as values def all_compounds_and_features - compounds = {} - Crack::XML.parse(RestClient.get @uri + '/compounds/features')['dataset']['compound'].each do |c| - features = c['feature_uri'].collect{ |f| Feature.new :uri => f } - compounds[c['uri']] = features - end - compounds + YAML.load(RestClient.get(@uri + '/compounds/features')) end # Get all features from a dataset @@ -143,8 +140,12 @@ module OpenTox 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 + def initialize(params) + if params[:uri] + @uri = params[:uri] + elsif params[:dataset_ur] + @uri = RestClient.post ENV['OPENTOX_LAZAR'] + 'models/' , :dataset_uri => training_dataset.uri + end end # Predict a compound |