From 43b257c759ae3b83ae68b0448e2e4cff67f951be Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 24 Apr 2018 10:58:01 +0000 Subject: always show sa prediction in batch mode --- application.rb | 11 +++++++++-- helper.rb | 13 +++++++++++-- 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("
")} - 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("
")} 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 -- cgit v1.2.3