summaryrefslogtreecommitdiff
path: root/lib/algorithm.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/algorithm.rb')
-rw-r--r--lib/algorithm.rb35
1 files changed, 35 insertions, 0 deletions
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