summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2017-11-07 10:16:33 +0000
committergebele <gebele@in-silico.ch>2017-11-07 10:16:33 +0000
commit745103c970b9883808ce95399a8d0a32e5c57342 (patch)
tree8faf2984cc207bcc8a7808bfd1d8a6b40bf15c05
parent668e485e63715d0dfa4e6e2f70323fd1ecb95ee6 (diff)
reordered to store sa prediction
-rw-r--r--application.rb36
-rw-r--r--views/layout.haml3
2 files changed, 19 insertions, 20 deletions
diff --git a/application.rb b/application.rb
index c2c4fa7..13de7ab 100644
--- a/application.rb
+++ b/application.rb
@@ -211,27 +211,27 @@ post '/predict/?' do
prediction_object = Prediction.new
prediction_object[:compound] = compound.id
prediction_object[:model] = m.id
+ if type == "Classification"# consensus mutagenicity
+ sa_prediction = KaziusAlerts.predict(compound.smiles)
+ lazar_mutagenicity = prediction
+ confidence = 0
+ lazar_mutagenicity_val = (lazar_mutagenicity[:value] == "non-mutagenic" ? false : true)
+ if sa_prediction[:prediction] == false && lazar_mutagenicity_val == false
+ confidence = 0.85
+ elsif sa_prediction[:prediction] == true && lazar_mutagenicity_val == true
+ confidence = 0.85 * ( 1 - sa_prediction[:error_product] )
+ elsif sa_prediction[:prediction] == false && lazar_mutagenicity_val == true
+ confidence = 0.11
+ elsif sa_prediction[:prediction] == true && lazar_mutagenicity_val == false
+ confidence = ( 1 - sa_prediction[:error_product] ) - 0.57
+ 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("; ")
+ end
prediction_object[:prediction] = prediction
prediction_object.save
end
- if type == "Classification"# consensus mutagenicity
- sa_prediction = KaziusAlerts.predict(compound.smiles)
- lazar_mutagenicity = prediction
- confidence = 0
- lazar_mutagenicity_val = (lazar_mutagenicity[:value] == "non-mutagenic" ? false : true)
- if sa_prediction[:prediction] == false && lazar_mutagenicity_val == false
- confidence = 0.85
- elsif sa_prediction[:prediction] == true && lazar_mutagenicity_val == true
- confidence = 0.85 * ( 1 - sa_prediction[:error_product] )
- elsif sa_prediction[:prediction] == false && lazar_mutagenicity_val == true
- confidence = 0.11
- elsif sa_prediction[:prediction] == true && lazar_mutagenicity_val == false
- confidence = ( 1 - sa_prediction[:error_product] ) - 0.57
- 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("; ")
- end
# regression
unless prediction[:value].blank?
if type == "Regression"
diff --git a/views/layout.haml b/views/layout.haml
index 9d73848..bac662a 100644
--- a/views/layout.haml
+++ b/views/layout.haml
@@ -25,8 +25,7 @@
%header.page-header
%div.row
%div.col-md-2
- %a{:href=> to("/predict")}
- %img.media-object{:src=>"/images/IST_logo_s.png", :alt=>"logo", :width=>"150px", :heigth=>"150px", :style=>"margin:0 3em 0 2em;"}
+ %img.media-object{:src=>"/images/IST_logo_s.png", :alt=>"logo", :width=>"150px", :heigth=>"150px", :style=>"margin:0 3em 0 2em;"}
%div.col-md-8
%h1.media-heading
lazar toxicity predictions