From 3935e9bee66fbfff4f35365eb9cff8c79f5fadd8 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 29 Oct 2015 10:09:13 +0000 Subject: patch merge --- application.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 9c9cabb..d77842d 100644 --- a/application.rb +++ b/application.rb @@ -259,12 +259,14 @@ post '/predict/?' do # validate identifier input # transfered input if !params[:identifier].blank? - @identifier = params[:identifier] - begin - # get compound from SMILES - @compound = Compound.from_smiles @identifier - rescue - @error_report = "Attention, '#{params[:identifier]}' is not a valid SMILES string." + # remove whitespaces they terminate a SMILES string + # can result in wrong conversion for compound object + @identifier = params[:identifier].gsub(/\s+/, "") + $logger.debug "input:#{@identifier}" + # get compound from SMILES + @compound = Compound.from_smiles @identifier + if @compound.blank? + @error_report = "Attention, '#{@identifier}' is not a valid SMILES string." return haml :error end -- cgit v1.2.3