From f7680842ee830af78d860b3a0a09b654368df90a Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 14 Jan 2016 09:37:39 +0000 Subject: changed weight method for lazar v8-nestec release --- views/neighbors.haml | 4 ++-- views/prediction.haml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/views/neighbors.haml b/views/neighbors.haml index 4a1f3ea..a69f38b 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -66,10 +66,10 @@ %p= Compound.find(neighbor[0]).svg %p= Compound.find(neighbor[0]).smiles - c = Compound.find(neighbor[0]) - - mw = c.molecular_weight + //- mw = c.molecular_weight / Measured Activity %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("
") : neighbor[2].join(", ") + = (type == "Regression") ? neighbor[2].collect{|n| weight = c.mmol_to_mg(n); '%.2e' % n + " (#{@models[j].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : 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 a74b95a..8d7e3d0 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -18,7 +18,7 @@ %td{:id=>"compound", :style=>"vertical-align:top;"} %p= @compound.svg %p= @compound.smiles - - mw = @compound.molecular_weight + -#- mw = @compound.molecular_weight - @model_types = {} - @dbhit = {} - @predictions.each_with_index do |prediction,i| @@ -34,9 +34,9 @@ %b Measured activity: - 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, mw); '%.2e' % v + " (#{@models[i].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : prediction[:value].join(", ") + = (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("
") : prediction[:value].join(", ") - else - = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} (mg/kg_bw/day)" : prediction[:value] %p %b Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 @@ -46,7 +46,7 @@ = type %br %b Prediction: - = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + = (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 Please keep in mind that predictions are based on the measured activities of neighbors."}} %br -- cgit v1.2.3