From be9d7e0dd360328d3ef7db77128527c40819cc1c Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 17 Jun 2019 10:21:24 +0000 Subject: add PubChem links for compound cid --- application.rb | 1 + views/neighbors.haml | 12 ++++++------ views/prediction.haml | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/application.rb b/application.rb index 73ec11a..a2ec091 100644 --- a/application.rb +++ b/application.rb @@ -3,6 +3,7 @@ require_relative 'qmrf_report.rb' require_relative 'task.rb' require_relative 'helper.rb' include OpenTox +PUBCHEM_CID_URI = PUBCHEM_URI.split("/")[0..-3].join("/")+"/compound/" [ "api.rb", diff --git a/views/neighbors.haml b/views/neighbors.haml index c4f3b94..91b5f57 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -20,8 +20,6 @@ %tr %th{:scope=>"col"} Compound - %th{:scope=>"col"} - SMILES %th{:scope=>"col"} Measured Activity %a.btn.fa.fa-info-circle{: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;"} @@ -38,8 +36,6 @@ %td %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}"}} = embedded_svg(c.svg, :title=>"click for details") - %td - %p= c.smiles / Measured Activity %td @@ -48,6 +44,10 @@ - else - if !neighbor[:measurement].nil? = (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] + %p + %a{:href=>PUBCHEM_CID_URI+c.cid, :rel => "external"} + PubChem + %span.fa.fa-xs.fa-external-link / Similarity = tanimoto %td = neighbor[:similarity].round(3) @@ -80,8 +80,8 @@ shouldSwitch = false; /* Get the two elements you want to compare, one from current row and one from the next: */ - x = rows[i].getElementsByTagName("TD")[3]; - y = rows[i + 1].getElementsByTagName("TD")[3]; + x = rows[i].getElementsByTagName("TD")[2]; + y = rows[i + 1].getElementsByTagName("TD")[2]; // Check if the two rows should switch place: if (parseFloat(x.innerHTML) < parseFloat(y.innerHTML)) { // If so, mark as a switch and break the loop: diff --git a/views/prediction.haml b/views/prediction.haml index 2a315f9..23d27ba 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -25,6 +25,10 @@ %a.btn.btn-link{:href => "#details0", data: { toggle: "modal", remote: to("/prediction/#{@compound.id}/details"), :id=>"link01"}} = embedded_svg(@compound.svg, :title=>"click for details") %p= @compound.smiles + %p + %a{:href=>PUBCHEM_CID_URI+@compound.cid, :rel => "external"} + PubChem + %span.fa.fa-xs.fa-external-link - @model_types = {} - @dbhit = {} - @predictions.each_with_index do |prediction,i| -- cgit v1.2.3