summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2015-10-29 18:20:39 +0000
committergebele <gebele@in-silico.ch>2015-10-29 18:20:39 +0000
commitefd241beab11fbfc200f0c32ffb9e198ed406c83 (patch)
tree71537f1341066f44ef2bbb6f65211e825bade68d /views
parent95236e48e8a1da009e6b5ab1789f0de37dde36f5 (diff)
added mg/kg_bw/day
Diffstat (limited to 'views')
-rw-r--r--views/batch.haml5
-rw-r--r--views/neighbors.haml6
-rw-r--r--views/prediction.haml6
3 files changed, 10 insertions, 7 deletions
diff --git a/views/batch.haml b/views/batch.haml
index ec987c4..f593188 100644
--- a/views/batch.haml
+++ b/views/batch.haml
@@ -18,6 +18,7 @@
/ key = compound, values = array of arrays with model, prediction
- @batch.each do |key, values|
- compound = key
+ - mw = compound.molecular_weight
%tr
%td{:style=>"vertical-align:top;"}
%p= compound.svg
@@ -34,7 +35,7 @@
%p
/ TODO fix scientific notation from database
%b Measured activity:
- = prediction[:value].numeric? ? "#{prediction[:value].round(3)} (#{model.unit})" : prediction[:value]
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
%p Compound is part of the training dataset
- elsif prediction[:neighbors].size > 0
%p
@@ -44,7 +45,7 @@
%br
%b Prediction:
/ TODO scientific notation
- = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit})" : prediction[:value]
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
%br
/ TODO probability
%b Confidence:
diff --git a/views/neighbors.haml b/views/neighbors.haml
index a741b45..4a1f3ea 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -65,9 +65,11 @@
/%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor[0].to_s)}/details"), :id=>"link#{j+1}#{count}"}}
%p= Compound.find(neighbor[0]).svg
%p= Compound.find(neighbor[0]).smiles
+ - c = Compound.find(neighbor[0])
+ - mw = c.molecular_weight
/ Measured Activity
- %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"}
- = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join("</br>") : neighbor[2].join(", ")
+ %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"}
+ = (type == "Regression") ? neighbor[2].collect{|n| weight = c.mmol_to_mg(n, mw); '%.2e' % n + " (#{@models[j].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("</br>") : neighbor[2].join(", ")
/ Similarity
%td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"}
/ TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset?
diff --git a/views/prediction.haml b/views/prediction.haml
index ef0c5db..11d542e 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -18,6 +18,7 @@
%td{:id=>"compound", :style=>"vertical-align:top;"}
%p= @compound.svg
%p= @compound.smiles
+ - mw = @compound.molecular_weight
- @model_types = {}
- @dbhit = {}
- @predictions.each_with_index do |prediction,i|
@@ -32,7 +33,7 @@
%p
/ TODO fix scientific notation from database
%b Measured activity:
- = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit})" : prediction[:value]
+ = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
%p Compound is part of the training dataset
- elsif prediction[:neighbors].size > 0
%p
@@ -41,8 +42,7 @@
= type
%br
%b Prediction:
- / TODO scientific notation
- = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit})" : prediction[:value]
+ = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (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."}}
%br