summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2015-10-29 09:54:15 +0000
committergebele <gebele@in-silico.ch>2015-10-29 09:54:15 +0000
commitb452a81e9c0a470bf9aa51f0192378f5fba5177a (patch)
treea88bd8a134c2b84c5291e1d25fcbbe93755feb9c /application.rb
parentd2d8db1e59e830b1a24e9b8d270a3b393d746b6c (diff)
trim and log SMILES input
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb14
1 files changed, 8 insertions, 6 deletions
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