From f86c084311282036ffa7b4588c0fa0d5b59af95b Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 24 Nov 2016 16:03:09 +0000 Subject: several fixes; works with lazar tree e111369ce5564f159b3f5f85c92afdd22352eaa1 --- views/neighbors.haml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index 096e432..d9f2796 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -79,20 +79,19 @@ - prediction[:neighbors].uniq.each_with_index do |neighbor,count| %tr / Compound - - c = Compound.find(neighbor["_id"]) + - c = Compound.find(neighbor) %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"} /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor["_id"])}/details"), :id=>"link#{j+1}#{count}"}} %p= c.svg %p= c.smiles - - mw = c.molecular_weight - / Measured Activity = compound.features + / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - - features = c.features.collect{|k,v| v if k == predictionFeature[j]["id"] }.compact.flatten - = (predictionFeature[j]["type"] == "numeric") ? features.collect{|v| weight = c.mmol_to_mg(v); '%.2e' % v + " (#{@models[j].unit})"+" , #{'%.2e' % weight} #{(unit == "mmol/L") ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : features.join("
") + = (type == "Regression" ? "#{neighbor[:measurement].delog10}" + " (#{unit})" : neighbor[:measurement]) + %br + = "#{c.mmol_to_mg(neighbor[:measurement].delog10)}" + " (#{(unit =~ /\b(mol\/L)\b/) ? "mg/L" : "mg/kg_bw/day"})" if type == "Regression" / Similarity = tanimoto %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? - = neighbor[:tanimoto] != nil ? neighbor[:tanimoto].to_f.round(3) : "Not enough similar compounds
in training dataset." + = neighbor[:similarity].round(3) - else %span.btn.btn-default.disabled -- cgit v1.2.3 From c5ca09fb039e38abd89005d49ef373cf18b79039 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 28 Nov 2016 14:13:18 +0000 Subject: bumped version;training dataset download;show warnings for batch;csv info and upload catch;code cleanup --- views/neighbors.haml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index d9f2796..32b8389 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -67,10 +67,10 @@ Compound %th.sorter-false{:style =>"vertical-align:middle;"} Measured Activity - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Measured Activity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"left", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Measured Activity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} %th.sorter-false{:style =>"vertical-align:middle;"} Similarity - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"left", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} / %th{:style =>"vertical-align:middle;"} / Supporting Information %tbody @@ -84,11 +84,14 @@ /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor["_id"])}/details"), :id=>"link#{j+1}#{count}"}} %p= c.svg %p= c.smiles + / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - = (type == "Regression" ? "#{neighbor[:measurement].delog10}" + " (#{unit})" : neighbor[:measurement]) - %br - = "#{c.mmol_to_mg(neighbor[:measurement].delog10)}" + " (#{(unit =~ /\b(mol\/L)\b/) ? "mg/L" : "mg/kg_bw/day"})" if type == "Regression" + - if neighbor[:measurement].is_a?(Array) + = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10} (#{unit})
#{c.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") + - else + = (type == "Regression") ? "#{neighbor[:measurement].delog10} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] + / Similarity = tanimoto %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} = neighbor[:similarity].round(3) -- cgit v1.2.3 From 55bf06381a42c9bb1e1e991e990f5d6e90c8e33e Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 7 Dec 2016 12:07:13 +0000 Subject: rebuild code for public release;prepared to work with lazar v1.0.0;reintroduced compound details --- views/neighbors.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index 32b8389..a608c4d 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -81,8 +81,8 @@ / Compound - c = Compound.find(neighbor) %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"} - /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor["_id"])}/details"), :id=>"link#{j+1}#{count}"}} - %p= c.svg + %a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(c.id.to_s)}/details"), :id=>"link#{j+1}#{count}"}} + = c.svg %p= c.smiles / Measured Activity -- cgit v1.2.3 From cb2ad5835eae10c85ee426102b2a9bf165c5c848 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 20 Dec 2016 16:25:27 +0000 Subject: result values round by signif(n);set dependent lazar gem version --- views/neighbors.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index a608c4d..2f0b3d7 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -88,9 +88,9 @@ / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - if neighbor[:measurement].is_a?(Array) - = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10} (#{unit})
#{c.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") + = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") - else - = (type == "Regression") ? "#{neighbor[:measurement].delog10} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] + = (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] / Similarity = tanimoto %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} -- cgit v1.2.3 From e6b8488b757f1d6036fd74b75f44d8c75ed3779f Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 16 Jan 2017 16:53:13 +0000 Subject: issue fixes;added faq --- views/neighbors.haml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index 2f0b3d7..18c23f8 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -3,6 +3,11 @@ / align single prediction to endpoint ; / display preordered in table view ; +:javascript + $(document).ready(function(){ + addExternalLinks(); + }); + %div.results %h3 Neighbors: / tabs div @@ -35,6 +40,7 @@ / presort by similarity ; :javascript $(document).ready(function(){ + addExternalLinks(); $("table##{j+1}").tablesorter({ debug: false, theme: "bootstrap", @@ -70,7 +76,7 @@ %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Measured Activity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} %th.sorter-false{:style =>"vertical-align:middle;"} Similarity - %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} / %th{:style =>"vertical-align:middle;"} / Supporting Information %tbody -- cgit v1.2.3