diff options
-rw-r--r-- | application.rb | 10 |
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 |