summaryrefslogtreecommitdiff
path: root/lib/algorithm.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2016-12-12 09:15:48 +0000
committergebele <gebele@in-silico.ch>2016-12-12 09:15:48 +0000
commitda086fad5b45c0d7b59feb40d0108ac620613933 (patch)
tree7e9cf8c9332e30552ab255ee9b30e04e904977b4 /lib/algorithm.rb
parent32a16d99b51642cac8e75f90c43753d8d05ab770 (diff)
parent4570f11444bc10da88d849e9a2812e95a8933c8a (diff)
merged development
Diffstat (limited to 'lib/algorithm.rb')
-rw-r--r--lib/algorithm.rb13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb
index 113f847..0e4b93a 100644
--- a/lib/algorithm.rb
+++ b/lib/algorithm.rb
@@ -2,18 +2,9 @@ module OpenTox
module Algorithm
- # Generic method to execute algorithms
- # Algorithms should:
- # - accept a Compound, an Array of Compounds or a Dataset as first argument
- # - optional parameters as second argument
- # - return an object corresponding to the input type as result (eg. Compound -> value, Array of Compounds -> Array of values, Dataset -> Dataset with values
- # @param [OpenTox::Compound,Array,OpenTox::Dataset] Input object
- # @param [Hash] Algorithm parameters
- # @return Algorithm result
- def self.run algorithm, object, parameters=nil
- bad_request_error "Cannot run '#{algorithm}' algorithm. Please provide an OpenTox::Algorithm." unless algorithm =~ /^OpenTox::Algorithm/
+ def self.run algorithm, parameters=nil
klass,method = algorithm.split('.')
- parameters.nil? ? Object.const_get(klass).send(method,object) : Object.const_get(klass).send(method,object, parameters)
+ Object.const_get(klass).send(method,parameters)
end
end