summaryrefslogtreecommitdiff
path: root/views/prediction.haml
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2016-11-24 16:31:26 +0000
committergebele <gebele@in-silico.ch>2016-11-24 16:31:26 +0000
commitbfd31ed2c9d0cde8a53238c7368eb3d49c580b7d (patch)
tree91c3a2865302e1017db0dffb6015dfa3eb6c476f /views/prediction.haml
parentf0588c7e072ea3e22f26916d669e9baaa8fa3197 (diff)
parentf86c084311282036ffa7b4588c0fa0d5b59af95b (diff)
fixed merge
Diffstat (limited to 'views/prediction.haml')
-rw-r--r--views/prediction.haml50
1 files changed, 35 insertions, 15 deletions
diff --git a/views/prediction.haml b/views/prediction.haml
index 8d7e3d0..2454aca 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -12,7 +12,7 @@
/ displays all prediction result in first table
%h3 Prediction Results:
%div.table-responsive
- %table.table.table-bordered{:id=>"overview", :style=>"background-color:white;"}
+ %table.table.table-bordered{:id=>"overview"}
%tbody
%tr
%td{:id=>"compound", :style=>"vertical-align:top;"}
@@ -24,21 +24,25 @@
- @predictions.each_with_index do |prediction,i|
- type = @models[i].model.class.to_s.match("Classification") ? "Classification" : "Regression"
- @model_types[i] = type
+ - unit = @models[i].unit
%td{:style=>"vertical-align:top;white-space:nowrap;"}
%b{:class => "title"}
= "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})"
%p
- - if prediction[:confidence] == "measured"
+ - if prediction[:warning] =~ /\b(identical)\b/i
- @dbhit[i] = true
%p
+ /TODO combine with regular view, if prediction value is present
%b Measured activity:
- - p prediction[:value]
+ - p prediction[:value]
- if prediction[:value].is_a?(Array)
- = (type == "Regression") ? prediction[:value].collect{|v| weight = Compound.from_smiles(@compound.smiles).mmol_to_mg(v); '%.2e' % v + " (#{@models[i].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("</br>") : prediction[:value].join(", ")
+ = (type == "Regression") ? prediction[:value].collect{|value| "#{value} (#{unit}) , #{@compound.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("</br>") : prediction[:value].join(", ")
- else
- = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} (mg/kg_bw/day)" : prediction[:value]
- %p
+ = (type == "Regression") ? "#{prediction[:value]} (#{unit}), #{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value]
+ %p
%b Compound is part of the training dataset
+ / warning popover
+ %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Warnings", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"#{prediction[:warning]}"}}
- elsif prediction[:neighbors].size > 0
%p
/ model type (classification|regression)
@@ -46,22 +50,38 @@
= type
%br
%b Prediction:
- = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} (mg/kg_bw/day)" : prediction[:value]
- / TODO update description
- / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", data: {toggle:"popover", placement:"left", html:"true", content:"LAZAR calculates searches the training dataset for similar compounds (neighbors) and calculates the prediction from their measured activities. LAZAR calculates predictions using <ul><li>a majority vote (weighted by compound similarity) for<br /><b>classification</b> (<a href='http://www.frontiersin.org/Journal/10.3389/fphar.2013.00038/abstract', target='_blank'>original publication</a>) </li><li>a local QSAR model based on neighbors for<br /><b>regression</b> (<a href='http://www.frontiersin.org/Journal/10.3389/fphar.2013.00038/abstract', target='_blank'</h>original publication</a>) </li></ul>Please keep in mind that predictions are based on the measured activities of neighbors."}}
+ / prediction popover
+ %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"<p>lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.<p><b>Classification:</b></br>Majority vote of neighbor activities weighted by similarity.<p><b>Regression:</b></br>Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.<p><a href=\"http://www.frontiersin.org/Journal/10.3389/fphar.2013.00038/abstract\", target=\"_blank\"> Original publication</a>."}}
+ %br
+ = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})</br>#{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value]
+ / tabindex=0 seems the best fix for FF|S browsers on OSX better than trigger="click focus" which ends up in double click for FF.
%br
- / TODO probability
- %b Confidence:
- = prediction[:confidence].round(2)
- / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", data: {toggle:"popover", placement:"left", html:"true", content:"Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}}
+ - if type == "Regression"
+ %b 95% Prediction interval:
+ - interval = (prediction[:prediction_interval].nil? ? ["- -","- -"] : prediction[:prediction_interval])
+ / prediction intervall popover
+ %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}}
+ %br
+ = "#{interval[0].delog10} - #{interval[1].delog10} (#{unit})"
+ %br
+ = "#{@compound.mmol_to_mg(interval[0].delog10)} - #{@compound.mmol_to_mg(interval[1].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil?
+ - else
+ %b Probability:
+ - unless prediction[:probabilities].nil?
+ %br
+ = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}"
+ %br
+ = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1]}"
+ / probability popover
+ -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}}
%p
/TODO add tooltip for significant ftagments and descriptors
/ - if @model_type[i] =~ /classification/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0)
/ Significant fragments:
- / %a.btn.btn-default.btn-sm{:id=>"linkSigFragments", :href => "#detailsTop", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[i]}/#{CGI.escape(@compound.uri)}/fingerprints")}} Significant fragments
+ / %a.btn.btn-default.btn-sm{:id=>"linkSigFragments", :href => "#detailsTop", :tabindex=>"0", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[i]}/#{CGI.escape(@compound.uri)}/fingerprints")}} Significant fragments
/ - if @model_type[i] =~ /regression/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0)
/ Descriptors
- / %a.btn.btn-default.btn-sm{:id=>"linkDescriptors", :href => "#detailsTop", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[i]}/#{CGI.escape(@compound.uri)}/fingerprints")}} Descriptors
+ / %a.btn.btn-default.btn-sm{:id=>"linkDescriptors", :href => "#detailsTop", :tabindex=>"0", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[i]}/#{CGI.escape(@compound.uri)}/fingerprints")}} Descriptors
/ %p
%p
- else