summaryrefslogtreecommitdiff
path: root/lib/algorithm.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2009-09-10 15:21:09 +0200
committerChristoph Helma <helma@in-silico.de>2009-09-10 15:21:09 +0200
commit59249a0febc2f90cd1643ddb7e3baa68e3f49065 (patch)
treeb9395e815c677e7af59f4a27c596521aee215354 /lib/algorithm.rb
parent285daeaafa3bdff027bc068be9a13232fca3e35d (diff)
initial wrapper for new webservices
Diffstat (limited to 'lib/algorithm.rb')
-rw-r--r--lib/algorithm.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb
index 912e14d..33731af 100644
--- a/lib/algorithm.rb
+++ b/lib/algorithm.rb
@@ -3,23 +3,19 @@ module OpenTox
class Fminer < OpenTox
# Create a new dataset with BBRC features
- def initialize(training_dataset)
- @uri = RestClient.post @@config[:services]["opentox-fminer"], :dataset_uri => training_dataset.uri
+ def self.create(training_dataset_uri)
+ RestClient.post @@config[:services]["opentox-fminer"], :dataset_uri => training_dataset_uri
end
end
class Similarity < OpenTox
- def initialize
- @uri = @@config[:services]["opentox-similarity"]
+ def self.tanimoto(dataset1,compound1,dataset2,compound2)
+ RestClient.get File.join(@@config[:services]["opentox-dataset"], 'algorithm/tanimoto/dataset',dataset1.name,compound1.inchi,'dataset',dataset2.name,compound2.inchi)
end
- def self.tanimoto(dataset,compounds)
- RestClient.post @uri + 'tanimoto', :dataset_uri => dataset.uri, :compound_uris => compounds.collect{ |c| c.uri }
- end
-
- def self.weighted_tanimoto(dataset,compounds)
- RestClient.post @uri + 'weighted_tanimoto', :dataset_uri => dataset.uri, :compound_uris => compounds.collect{ |c| c.uri }
+ def self.weighted_tanimoto(dataset1,compound1,dataset2,compound2)
+ RestClient.get URI.encode(File.join(@@config[:services]["opentox-dataset"], 'algorithm/weighted_tanimoto/dataset',dataset1.name,'compound',compound1.inchi,'dataset',dataset2.name,'compound',compound2.inchi))
end
end