From 3935e9bee66fbfff4f35365eb9cff8c79f5fadd8 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 29 Oct 2015 10:09:13 +0000 Subject: patch merge --- 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 21b4b35..a741b45 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -58,7 +58,7 @@ / %td %tbody - type = @model_types[j] - - prediction[:neighbors].each_with_index do |neighbor,count| + - prediction[:neighbors].uniq.each_with_index do |neighbor,count| %tr / Compound %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"} @@ -67,7 +67,7 @@ %p= Compound.find(neighbor[0]).smiles / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} - = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join(", ") : neighbor[2].join(", ") + = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.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? -- cgit v1.2.3 From 1d6588b35b4ffff16717e24b42a0d396d5347f95 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 26 Jan 2016 12:53:40 +0000 Subject: batch merge --- views/neighbors.haml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index a741b45..6001605 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -29,7 +29,20 @@ debug: false, theme: "bootstrap", headerTemplate: '{content} {icon}', - widgets: ['zebra', 'columns', 'uitheme'], + widgets: ['zebra', 'columns', 'uitheme', 'stickyHeaders'], + widgetOptions: { + stickyHeaders_attachTo : '.tab-content', + stickyHeaders : '', + stickyHeaders_offset : 0, + stickyHeaders_cloneId : '-sticky', + stickyHeaders_addResizeEvent : true, + stickyHeaders_includeCaption : true, + stickyHeaders_zIndex : 2, + stickyHeaders_attachTo : null, + stickyHeaders_xScroll : null, + stickyHeaders_yScroll : null, + stickyHeaders_filteredToTop: true + }, headers: {0: {sorter: false}, 3: {sorter: false}}, sortList: [[2,1]], widthFixed: false @@ -65,9 +78,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("
") : 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); '%.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? -- cgit v1.2.3 From 510822b13d48344ffe4e047a4415ebdb218dadc0 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 24 Mar 2016 19:41:37 +0000 Subject: updated for latest lazar changes; introduced 95% prediction interval --- views/neighbors.haml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index 6001605..6011a6d 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -9,7 +9,17 @@ #tabs %ul.nav.nav-tabs.nav-justified{:id=>"neighborTabs", :role=>"tablist"} / each model a tab head ; + / hash for predictionFeature + - predictionFeature = {} - @models.each_with_index do |model,i| + / get predictionFeature type + - m = Model::Lazar.find model.model_id.to_s + - predFeature = Feature.find m.prediction_feature_id.to_s + / define feature type (numeric : nominal) + - predFeatureType = (predFeature.numeric? ? "numeric" : "nominal") + / use prediction feature id for neighbor compound features + - predFeatureId = m.prediction_feature_id.to_s + - predictionFeature[i] = {"id" => predFeatureId, "type" => predFeatureType} %li{:class => ("active" if i == 0)} %a{:href => "#results_#{i+1}", :id => "linkTab#{i+1}", data: {toggle:"tab"}} = "#{model.endpoint} (#{model.species})" @@ -29,7 +39,7 @@ debug: false, theme: "bootstrap", headerTemplate: '{content} {icon}', - widgets: ['zebra', 'columns', 'uitheme', 'stickyHeaders'], + widgets: ['columns', 'uitheme', 'stickyHeaders'], widgetOptions: { stickyHeaders_attachTo : '.tab-content', stickyHeaders : '', @@ -74,19 +84,20 @@ - prediction[:neighbors].uniq.each_with_index do |neighbor,count| %tr / Compound + - c = Compound.find(neighbor["_id"]) %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[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 + /%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 %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); '%.2e' % n + " (#{@models[j].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : neighbor[2].join(", ") - / Similarity + - 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} (mg/kg_bw/day)"}.join("
") : features.join("
") + / 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[1] != nil ? neighbor[1].round(2) : "Not enough similar compounds
in training dataset." + = neighbor[:tanimoto] != nil ? neighbor[:tanimoto].to_f.round(3) : "Not enough similar compounds
in training dataset." - else %span.btn.btn-default.disabled -- cgit v1.2.3 From df8ed98fcc052da2641c26897a8dd0592f274e53 Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 15 Apr 2016 09:59:43 +0000 Subject: reactivated info buttons; changed unit for fish; introduced FAQ --- views/neighbors.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index 6011a6d..c94331a 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -75,12 +75,13 @@ %tr %td %td{:style=>"font-size:x-small;padding:0px;"} - / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Measured Activity", data: {toggle:"popover", placement:"auto", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} + %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;"} %td{:style=>"font-size:x-small;padding:0px;"} - / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Similarity", data: {toggle:"popover", placement:"auto", html:"true", content:"LAZAR calculates activity specific similarities based on the presence of statistically significant fragments. This procedure will
  • consider only those parts of a chemical structure that are relevant for a particular endpoint
  • ignore inert parts of the structure
  • lead to different similarities, depending on the toxic endpoint Similarities of 1 may be encountered even for structurally dissimilar compounds, because inert parts are ignored.
"}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"left", html:"true", content:"LAZAR calculates activity specific similarities based on the presence of statistically significant fragments. This procedure will
  • consider only those parts of a chemical structure that are relevant for a particular endpoint
  • ignore inert parts of the structure
  • lead to different similarities, depending on the toxic endpoint Similarities of 1 may be encountered even for structurally dissimilar compounds, because inert parts are ignored.
"}, :style=>"z-index:auto+10;"} / %td %tbody - type = @model_types[j] + - unit = @models[j].unit - prediction[:neighbors].uniq.each_with_index do |neighbor,count| %tr / Compound @@ -93,7 +94,7 @@ / Measured Activity = compound.features %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} (mg/kg_bw/day)"}.join("
") : features.join("
") + = (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("
") / 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? -- cgit v1.2.3 From 512458e2489c8cc12a9d539d8895c1802d7b081a Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 20 Apr 2016 14:12:03 +0000 Subject: adopted changes from CH on the master branch --- views/neighbors.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index c94331a..3014255 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -75,9 +75,11 @@ %tr %td %td{:style=>"font-size:x-small;padding:0px;"} + / 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;"} %td{:style=>"font-size:x-small;padding:0px;"} - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"left", html:"true", content:"LAZAR calculates activity specific similarities based on the presence of statistically significant fragments. This procedure will
  • consider only those parts of a chemical structure that are relevant for a particular endpoint
  • ignore inert parts of the structure
  • lead to different similarities, depending on the toxic endpoint Similarities of 1 may be encountered even for structurally dissimilar compounds, because inert parts are ignored.
"}, :style=>"z-index:auto+10;"} + / 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;"} / %td %tbody - type = @model_types[j] -- cgit v1.2.3 From 48738e50ab34768cccfc770d3010c4f055bd76eb Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 20 Apr 2016 14:44:57 +0000 Subject: updated similarity info; changed delimiter --- 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 3014255..2edc3ab 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -79,7 +79,7 @@ %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;"} %td{:style=>"font-size:x-small;padding:0px;"} / 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=>"#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;"} / %td %tbody - type = @model_types[j] @@ -96,7 +96,7 @@ / Measured Activity = compound.features %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("
") + = (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("
") / 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? -- cgit v1.2.3 From b3fffd49c61745e953415c50084fee900d8029e9 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 21 Apr 2016 13:45:20 +0000 Subject: fixed neighbors table; bg-color predictions due to safari; disabled neighbors sort option; enabled table header info icons --- views/neighbors.haml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'views/neighbors.haml') diff --git a/views/neighbors.haml b/views/neighbors.haml index 2edc3ab..096e432 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -38,7 +38,7 @@ $("table##{j+1}").tablesorter({ debug: false, theme: "bootstrap", - headerTemplate: '{content} {icon}', + headerTemplate: '', widgets: ['columns', 'uitheme', 'stickyHeaders'], widgetOptions: { stickyHeaders_attachTo : '.tab-content', @@ -53,34 +53,26 @@ stickyHeaders_yScroll : null, stickyHeaders_filteredToTop: true }, - headers: {0: {sorter: false}, 3: {sorter: false}}, sortList: [[2,1]], + headers: {sorter: false}, widthFixed: false }); }); - if prediction[:neighbors].size > 0 %div.table-responsive - %table.tablesorter{:id=>"#{j+1}", :style=>"border-style: solid;"} + %table{:id=>"#{j+1}", :style=>"border-style: solid;"} %thead %tr - %th{:style =>"vertical-align:middle;"} + %th.sorter-false{:style =>"vertical-align:middle;"} Compound - %th{:style =>"vertical-align:middle;"} + %th.sorter-false{:style =>"vertical-align:middle;"} Measured Activity - %th{:style =>"vertical-align:middle;"} + %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;"} + %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;"} / %th{:style =>"vertical-align:middle;"} / Supporting Information - %span - %tr - %td - %td{:style=>"font-size:x-small;padding:0px;"} - / 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;"} - %td{:style=>"font-size:x-small;padding:0px;"} - / 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;"} - / %td %tbody - type = @model_types[j] - unit = @models[j].unit -- cgit v1.2.3 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