From 17e783b5d159f205f0de59c6c522f5de5b8c9a6e Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 7 Dec 2012 11:42:12 +0100 Subject: working version without proxy --- views/assays.haml | 13 +++++---- views/compound.haml | 65 ++++++++++++++++++++++++++++---------------- views/layout.haml | 7 +++-- views/neighbors.haml | 58 ++++++++++++++++++--------------------- views/nontargets.haml | 3 ++ views/not_found.haml | 2 ++ views/predicted_assays.haml | 19 +++++++++---- views/predicted_targets.haml | 21 ++++++++++---- views/targets.haml | 17 ++++++++---- 9 files changed, 123 insertions(+), 82 deletions(-) create mode 100644 views/nontargets.haml create mode 100644 views/not_found.haml (limited to 'views') diff --git a/views/assays.haml b/views/assays.haml index e995842..510234d 100644 --- a/views/assays.haml +++ b/views/assays.haml @@ -1,6 +1,7 @@ -%ul - - @assays.each do |assay| - %li - %a{:href => "/aid/#{assay["AID"]}"} #{assay['Assay Name']} - AID: - = assay["AID"] +%dl + - @assays.sort{|a,b| a["Assay Name"] <=> b["Assay Name"]}.each do |assay| + %dt + %a{:href => "http://pubchem.ncbi.nlm.nih.gov/assay/assay.cgi?aid=#{assay["AID"]}"} #{assay['Assay Name']} + %dd + Assay ID: + %a{:href => "http://pubchem.ncbi.nlm.nih.gov/assay/assay.cgi?aid=#{assay["AID"]}"} #{assay['AID']} diff --git a/views/compound.haml b/views/compound.haml index 7614142..de4cf77 100644 --- a/views/compound.haml +++ b/views/compound.haml @@ -1,46 +1,65 @@ -:javascript - $(document).ready(function() { - display(".targets", "/cid/#{session[:compound].cid}/targets"); - //display(".nontargets", "/cid/#{session[:compound].cid}/targets"); - display(".active_assays", "/cid/#{session[:compound].cid}/other_active_assays"); - //display(".inactive_assays", "/cid/#{session[:compound].cid}/other_active_assays"); - display(".predicted_targets", "/cid/#{session[:compound].cid}/predicted_targets"); - display(".predicted_active_assays", "/cid/#{session[:compound].cid}/other_predicted_active_assays"); - display(".neighbors", "/cid/#{session[:compound].cid}/neighbors"); - }); - %script{:type => "text/javascript", :src => "sorttable.js"} %table{:class => "sortable"} %tr %th Structure - %th %th Targets (experimental data) - %th Other assays (experimental data) + %th Other active assays (experimental data) %tr %td{:valign => "top"} + %br= session[:compound].name %img{:src => session[:compound].image_uri} - %td %td{:valign => "top"} .targets - -# %h2 Non-Targets - .nontargets + :javascript + display(".targets", "/cid/#{session[:compound].cid}/targets"); %td{:valign => "top"} .active_assays - -# %h2 Inactive assays - .inactive_assays + :javascript + display(".active_assays", "/cid/#{session[:compound].cid}/other_active_assays"); %tr - %th %th %th Targets (predicted) - %th Other assays (predicted) + %th Other active assays (predicted) %tr - %td %td %td{:valign => "top"} .predicted_targets + :javascript + display(".predicted_targets", "/cid/#{session[:compound].cid}/predicted_targets"); %td{:valign => "top"} .predicted_active_assays + :javascript + display(".predicted_active_assays", "/cid/#{session[:compound].cid}/other_predicted_active_assays"); + %tr + %th + %th Non-targets (experimental data) + %th Other inactive assays (experimental data) + %tr + %td + %td{:valign => "top"} + .nontargets + :javascript + display(".nontargets", "/cid/#{session[:compound].cid}/nontargets"); + %td{:valign => "top"} + .inactive_assays + :javascript + display(".inactive_assays", "/cid/#{session[:compound].cid}/other_inactive_assays"); + %tr + %th + %th Non-targets (predicted) + %th Other inactive assays (predicted) + %tr + %td + %td{:valign => "top"} + .predicted_nontargets + :javascript + display(".predicted_nontargets", "/cid/#{session[:compound].cid}/predicted_nontargets"); + %td{:valign => "top"} + .predicted_inactive_assays + :javascript + display(".predicted_inactive_assays", "/cid/#{session[:compound].cid}/other_predicted_inactive_assays"); -%h2 Neighbors +%h2 Read across compounds .neighbors - +:javascript + display(".neighbors", "/cid/#{session[:compound].cid}/neighbors"); diff --git a/views/layout.haml b/views/layout.haml index 8641692..40c6747 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -6,6 +6,7 @@ function display(element,uri) { $(element).html("\"Searching"); $.ajax({ + cache: true, url: uri, success: function(data){ $(element).html(data); @@ -20,7 +21,7 @@ %h1 adverse outcome pathways %form{:name => "form", :action => '/search', :method => "GET"} %fieldset - %label{:for => 'identifier'} Compound name: - %input{:type => 'text', :name => 'name', :id => 'name', :size => '60'} - %input{ :type => "submit", :value => "Predict" } + %label{:for => 'name'} Compound name: + %input{:type => 'text', :name => 'name', :id => 'name'} + %input{ :type => "submit", :value => "Search" } = yield diff --git a/views/neighbors.haml b/views/neighbors.haml index 54905ce..7b9c79d 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -1,43 +1,37 @@ -%script{:type => "text/javascript", :src => "sorttable.js"} -%table{:class => "sortable"} +%table - session[:compound].neighbors[0..10].each do |compound| + %tr + %th Structure + %th Similarity + %th Targets (experimental data) + %th Other active assays (experimental data) + %tr %td{:valign => "top"} + %br= compound.name %img{:src => compound.image_uri} %td{:id => "sim#{compound.cid}", :valign => "top"} - %img{:src => "/spinning-wait-icons/wait30trans.gif"} :javascript - $.ajax({ - url: "/cid/#{session[:compound].cid}/cosine/#{compound.cid}", - success: function(data){ - $("#sim#{compound.cid}").html(data); - }, - error: function(data,textStatus,message){ - $("#sim#{compound.cid}").html(message); - } - }); + display("#sim#{compound.cid}", "/cid/#{session[:compound].cid}/cosine/#{compound.cid}"); %td{:id => "targets#{compound.cid}", :valign => "top"} - %img{:src => "/spinning-wait-icons/wait30trans.gif"} :javascript - $.ajax({ - url: "/cid/#{compound.cid}/targets", - success: function(data){ - $("#targets#{compound.cid}").html(data); - }, - error: function(data,textStatus,message){ - $("#targets#{compound.cid}").html(message); - } - }); + display("#targets#{compound.cid}", "/cid/#{compound.cid}/targets"); %td{:id => "assays#{compound.cid}", :valign => "top"} - %img{:src => "/spinning-wait-icons/wait30trans.gif"} :javascript - $.ajax({ - url: "/cid/#{compound.cid}/other_active_assays", - success: function(data){ - $("#assays#{compound.cid}").html(data); - }, - error: function(data,textStatus,message){ - $("#assays#{compound.cid}").html(message); - } - }); + display("#assays#{compound.cid}", "/cid/#{compound.cid}/other_active_assays"); + + %tr + %th + %th + %th Non-targets (experimental data) + %th Other inactive assays (experimental data) + + %tr + %td %td + %td{:id => "targets#{compound.cid}", :valign => "top"} + :javascript + display("#targets#{compound.cid}", "/cid/#{compound.cid}/nontargets"); + %td{:id => "assays#{compound.cid}", :valign => "top"} + :javascript + display("#assays#{compound.cid}", "/cid/#{compound.cid}/other_inactive_assays"); diff --git a/views/nontargets.haml b/views/nontargets.haml new file mode 100644 index 0000000..154b5da --- /dev/null +++ b/views/nontargets.haml @@ -0,0 +1,3 @@ +%pre + =# session[:compound].non_targets.to_yaml + diff --git a/views/not_found.haml b/views/not_found.haml new file mode 100644 index 0000000..5903559 --- /dev/null +++ b/views/not_found.haml @@ -0,0 +1,2 @@ +No compound found that matches name += "\"#{params[:name]}\"." diff --git a/views/predicted_assays.haml b/views/predicted_assays.haml index e995842..991c267 100644 --- a/views/predicted_assays.haml +++ b/views/predicted_assays.haml @@ -1,6 +1,13 @@ -%ul - - @assays.each do |assay| - %li - %a{:href => "/aid/#{assay["AID"]}"} #{assay['Assay Name']} - AID: - = assay["AID"] +%dl + - @assays.sort{|a,b| [b[:p_active],b[:p_inactive]].max <=> [a[:p_active],a[:p_inactive]].max}.each do |assay| + %dt + %a{:href => "http://pubchem.ncbi.nlm.nih.gov/assay/assay.cgi?aid=#{assay["AID"]}"} #{assay['Assay Name']} + %dd + Assay ID: + %a{:href => "http://pubchem.ncbi.nlm.nih.gov/assay/assay.cgi?aid=#{assay["AID"]}"} #{assay['AID']} + %dd + p_active: + = assay[:p_active].to_f.round(3) + %dd + p_inactive: + = assay[:p_inactive].to_f.round(3) diff --git a/views/predicted_targets.haml b/views/predicted_targets.haml index 1a172ff..523a217 100644 --- a/views/predicted_targets.haml +++ b/views/predicted_targets.haml @@ -1,6 +1,15 @@ -%ul - - @assays.each do |assay| - %li - %a{:href => "/aid/#{assay["AID"]}"} #{assay['Target Name']} - Target GI: - = assay['Target GI'] +%dl + - @assays.sort{|a,b| [b[:p_active],b[:p_inactive]].max <=> [a[:p_active],a[:p_inactive]].max}.each do |assay| + %dt= assay["Target Name"] + %dd + Target GeneID: + = assay["Target GI"] + %dd + Assay ID: + %a{:href => "http://pubchem.ncbi.nlm.nih.gov/assay/assay.cgi?aid=#{assay["AID"]}"} #{assay['AID']} + %dd + p_active: + = assay[:p_active].to_f.round(3) + %dd + p_inactive: + = assay[:p_inactive].to_f.round(3) diff --git a/views/targets.haml b/views/targets.haml index 1a172ff..9622abd 100644 --- a/views/targets.haml +++ b/views/targets.haml @@ -1,6 +1,11 @@ -%ul - - @assays.each do |assay| - %li - %a{:href => "/aid/#{assay["AID"]}"} #{assay['Target Name']} - Target GI: - = assay['Target GI'] +%dl + - @assays.collect{|a| [a["Target Name"],a["Target GI"]]}.uniq.sort{|a,b| a[0] <=> b[0]}.each do |target| + %dt= target.first + %dd + Target GeneID: + = target.last + %dd + Assay IDs: + - @assays.select{|a| a["Target GI"] == target.last}.each do |assay| + %a{:href => "http://pubchem.ncbi.nlm.nih.gov/assay/assay.cgi?aid=#{assay["AID"]}"} #{assay['AID']} + -- cgit v1.2.3