summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2015-10-29 10:09:13 +0000
committergebele <gebele@in-silico.ch>2015-10-29 10:09:13 +0000
commit3935e9bee66fbfff4f35365eb9cff8c79f5fadd8 (patch)
tree1a56d321d909e0daf2efcd161e099fdc726d5292
parent228425ae1229ea0b80d7010e7c7d5732858e3252 (diff)
patch merge
-rw-r--r--application.rb14
-rw-r--r--views/batch.haml3
-rw-r--r--views/neighbors.haml4
-rw-r--r--views/predict.haml2
4 files changed, 12 insertions, 11 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
diff --git a/views/batch.haml b/views/batch.haml
index 8389651..ec987c4 100644
--- a/views/batch.haml
+++ b/views/batch.haml
@@ -44,7 +44,7 @@
%br
%b Prediction:
/ TODO scientific notation
- = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} #{model.unit}" : prediction[:value]
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit})" : prediction[:value]
%br
/ TODO probability
%b Confidence:
@@ -53,4 +53,3 @@
- else
%p
= "Not enough similar compounds </br>in training dataset."
- %p
diff --git a/views/neighbors.haml b/views/neighbors.haml
index 21b4b35..a741b45 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -58,7 +58,7 @@
/ %td
%tbody
- type = @model_types[j]
- - prediction[:neighbors].each_with_index do |neighbor,count|
+ - prediction[:neighbors].uniq.each_with_index do |neighbor,count|
%tr
/ Compound
%td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"}
@@ -67,7 +67,7 @@
%p= Compound.find(neighbor[0]).smiles
/ Measured Activity
%td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"}
- = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join(", ") : neighbor[2].join(", ")
+ = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join("</br>") : neighbor[2].join(", ")
/ Similarity
%td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"}
/ TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset?
diff --git a/views/predict.haml b/views/predict.haml
index 9863cd9..8ab9ee0 100644
--- a/views/predict.haml
+++ b/views/predict.haml
@@ -24,7 +24,7 @@
});
function getInput(){
- identifier = document.getElementById("identifier").value;
+ identifier = document.getElementById("identifier").value.trim();
fileselect = document.getElementById("fileselect").value;
if (fileselect != ""){
return 1;