summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2017-12-12 13:57:28 +0000
committergebele <gebele@in-silico.ch>2017-12-12 13:57:28 +0000
commitf5a0d4ab14e55a72c4cb182ce0e81f599e4857ed (patch)
treea20c2f2cbb0a0f7581fbae014ad571dbdb92ee47 /application.rb
parent332c68dc1bc59538a8a749ef592d5700ba316357 (diff)
prediction object adjusted for single predictions
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/application.rb b/application.rb
index 223b81a..04b5aa3 100644
--- a/application.rb
+++ b/application.rb
@@ -354,7 +354,8 @@ post '/predict/?' do
if model.model.name =~ /kazius/
sa_prediction = KaziusAlerts.predict(@compound.smiles)
- lazar_mutagenicity = model.predict(@compound)
+ prediction = model.predict(@compound)
+ lazar_mutagenicity = prediction
confidence = 0
lazar_mutagenicity_val = (lazar_mutagenicity[:value] == "non-mutagenic" ? false : true)
if sa_prediction[:prediction] == false && lazar_mutagenicity_val == false
@@ -366,9 +367,11 @@ post '/predict/?' do
elsif sa_prediction[:prediction] == true && lazar_mutagenicity_val == false
confidence = ( 1 - sa_prediction[:error_product] ) - 0.57
end
- prediction << [lazar_mutagenicity, {:prediction => sa_prediction, :confidence => confidence}]
+ 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("; ")
else
- prediction << model.predict(@compound)
+ prediction = model.predict(@compound)
end
prediction_object[:compound] = @compound.id
prediction_object[:model] = model.id