summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2018-04-24 10:58:01 +0000
committergebele <gebele@in-silico.ch>2018-04-24 10:58:01 +0000
commit43b257c759ae3b83ae68b0448e2e4cff67f951be (patch)
tree48fbfc8b48bda415214e48ee9e959fffe4fd547d
parent8a940a694366214164bcdb853388bc41ccbf4522 (diff)
always show sa prediction in batch mode
-rw-r--r--application.rb11
-rw-r--r--helper.rb13
2 files changed, 20 insertions, 4 deletions
diff --git a/application.rb b/application.rb
index edff1c9..ca1f2ee 100644
--- a/application.rb
+++ b/application.rb
@@ -100,7 +100,14 @@ get '/task/?' do
sorter << {"Lazar mutagenicity (Salmonella typhimurium)" => ""}
sorter << {"Prediction" => prediction[:value]}
sorter << {"Probability" => prediction[:probabilities].collect{|k,v| "#{k}: #{v.signif(3)}"}.join("</br>")}
- else
+ elsif !prediction[:value] && type == "Classification"
+ sorter << {"Consensus prediction" => prediction["Consensus prediction"]}
+ sorter << {"Consensus confidence" => prediction["Consensus confidence"]}
+ sorter << {"Structural alerts for mutagenicity" => prediction["Structural alerts for mutagenicity"]}
+ sorter << {"Lazar mutagenicity (Salmonella typhimurium)" => ""}
+ sorter << {"Prediction" => ""}
+ sorter << {"Probability" => ""}
+ #else
sorter << {"Warnings" => prediction[:warnings].join("</br>")}
end
sorter.each_with_index do |hash,idx|
@@ -337,7 +344,7 @@ post '/predict/?' do
end
prediction["Consensus prediction"] = sa_prediction[:prediction] == false ? "non-mutagenic" : "mutagenic"
prediction["Consensus confidence"] = confidence.signif(3)
- prediction["Structural alerts for mutagenicity"] = sa_prediction[:matches].blank? ? "none" : sa_prediction[:matches].collect{|a| a.first}.join("; ")
+ prediction["Structural alerts for mutagenicity"] = sa_prediction[:matches].blank? ? "none" : sa_prediction[:matches].collect{|a| a.first}.join("; ").gsub(/,/," ")
end
# add additionally fields for html representation
unless prediction[:value].blank? || type == "Classification"
diff --git a/helper.rb b/helper.rb
index ca20def..06b1517 100644
--- a/helper.rb
+++ b/helper.rb
@@ -109,8 +109,17 @@ helpers do
line += "#{output['model_name']},#{compound.smiles},#{prediction[:info] ? prediction[:info] : "no"},"\
"#{prediction[:measurements].collect{|m| m.delog10.signif(3)}.join("; ") if prediction[:info]},,,,,,,"+ [inApp,note].join(",")+"\n"
else
- line += "Consensus mutagenicity,#{compound.smiles},#{prediction[:info] ? prediction[:info] : "no"},"\
- "#{prediction[:measurements].join("; ") if prediction[:info]},,,,,,,"+ [inApp,note].join(",")+"\n"
+ #line += "Consensus mutagenicity,#{compound.smiles},#{prediction[:info] ? prediction[:info] : "no"},"\
+ # "#{prediction[:measurements].join("; ") if prediction[:info]},,,,,,,"+ [inApp,note].join(",")+"\n"
+ line += "Consensus mutagenicity,#{compound.smiles},"\
+ "\"#{prediction[:info] ? prediction[:info] : "no"}\",\"#{output['measurements'].join("; ") if prediction[:info]}\","\
+ "#{prediction['Consensus prediction']},"\
+ "#{prediction['Consensus confidence']},"\
+ "#{prediction['Structural alerts for mutagenicity']},"\
+ "#{output['prediction_value']},"\
+ "#{!prediction[:probabilities].blank? ? output['probabilities'].first : ""},"\
+ "#{!prediction[:probabilities].blank? ? output['probabilities'].last : ""},"\
+ "#{inApp},#{note.nil? ? "" : note}\n"
end
end