From 6a2c3f2100d030c30b7d8ac8c95dcece7edb040c Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 8 Sep 2009 16:04:23 +0200 Subject: api separated into individual components, adapted for new webservice versions --- lib/algorithm.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/algorithm.rb (limited to 'lib/algorithm.rb') diff --git a/lib/algorithm.rb b/lib/algorithm.rb new file mode 100644 index 0000000..912e14d --- /dev/null +++ b/lib/algorithm.rb @@ -0,0 +1,35 @@ +module OpenTox + module Algorithm + + 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 + end + end + + class Similarity < OpenTox + + def initialize + @uri = @@config[:services]["opentox-similarity"] + 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 } + end + + end + + class Lazar < OpenTox + # Create a new prediction model from a dataset + def initialize(params) + @uri = RestClient.post @@config[:services]["opentox-lazar"] + 'models' , :dataset_uri => params[:dataset_uri] + end + end + + end +end -- cgit v1.2.3