summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2016-03-14 17:28:13 +0100
committerrautenberg <rautenberg@in-silico.ch>2016-03-14 17:28:13 +0100
commit6be5e8eb593f802a173309a510326e0334bcfc9c (patch)
tree483e92924d7c6d31a65ac1808d839bb5547366c9
parent647e9a00b97259de3fbe89aba3ebfd5b1f489fe4 (diff)
change output of prediction
-rw-r--r--application.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/application.rb b/application.rb
index c60d4fc..87fd40a 100644
--- a/application.rb
+++ b/application.rb
@@ -64,14 +64,18 @@ post "/model/:id/?" do
identifier = params[:identifier].split(",")
begin
# get compound from SMILES
- compound = identifier.collect{ |i| Compound.from_smiles i.strip }
+ compounds = identifier.collect{ |i| Compound.from_smiles i.strip }
rescue
@error_report = "Attention, '#{params[:identifier]}' is not a valid SMILES string."
return @error_report
end
model = OpenTox::Model::Lazar.find params[:id]
- prediction = model.predict(compound)
- return prediction.to_json
+ batch = {}
+ compounds.each do |compound|
+ prediction = model.predict(compound)
+ batch[compound] = {:id => compound.id, :inchi => compound.inchi, :smiles => compound.smiles, :model => model, :prediction => prediction}
+ end
+ return batch.to_json
end
# Get a list of a single or all descriptors