summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-11-21 10:09:48 +0100
committerChristoph Helma <helma@in-silico.ch>2012-11-21 10:09:48 +0100
commitc38f9f2e4c2dec4ef163c6c76d64f5dbf4974a5a (patch)
tree4f4b71056b1e8728720fb2a5f6886dc2dfe634cd /views
parent9661a67983ffc93ee02bc12b20b9afb38e199d79 (diff)
Initial GUI
Diffstat (limited to 'views')
-rw-r--r--views/assays.haml6
-rw-r--r--views/compound.haml46
-rw-r--r--views/fp.haml41
-rw-r--r--views/index.haml27
-rw-r--r--views/layout.haml26
-rw-r--r--views/neighbors.haml43
-rw-r--r--views/predicted_assays.haml6
-rw-r--r--views/predicted_targets.haml6
-rw-r--r--views/select.haml8
-rw-r--r--views/targets.haml6
10 files changed, 188 insertions, 27 deletions
diff --git a/views/assays.haml b/views/assays.haml
new file mode 100644
index 0000000..e995842
--- /dev/null
+++ b/views/assays.haml
@@ -0,0 +1,6 @@
+%ul
+ - @assays.each do |assay|
+ %li
+ %a{:href => "/aid/#{assay["AID"]}"} #{assay['Assay Name']}
+ AID:
+ = assay["AID"]
diff --git a/views/compound.haml b/views/compound.haml
new file mode 100644
index 0000000..7614142
--- /dev/null
+++ b/views/compound.haml
@@ -0,0 +1,46 @@
+: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)
+ %tr
+ %td{:valign => "top"}
+ %img{:src => session[:compound].image_uri}
+ %td
+ %td{:valign => "top"}
+ .targets
+ -# %h2 Non-Targets
+ .nontargets
+ %td{:valign => "top"}
+ .active_assays
+ -# %h2 Inactive assays
+ .inactive_assays
+ %tr
+ %th
+ %th
+ %th Targets (predicted)
+ %th Other assays (predicted)
+ %tr
+ %td
+ %td
+ %td{:valign => "top"}
+ .predicted_targets
+ %td{:valign => "top"}
+ .predicted_active_assays
+
+%h2 Neighbors
+.neighbors
+
diff --git a/views/fp.haml b/views/fp.haml
new file mode 100644
index 0000000..4bffba3
--- /dev/null
+++ b/views/fp.haml
@@ -0,0 +1,41 @@
+!!! 5
+%style{:type => "text/css" }
+ //dt { float: left; clear: left; width: 100px; text-align: right; font-weight: bold; color: green; }
+ //dt { float: left; clear: left; text-align: left; font-weight: bold; color: green; }
+ table { border-top: 2px black }
+ dl {text-align:left;}
+ dt { display: inline; text-align: left; font-weight: bold; color: green; }
+ dt:after { content: ": "; }
+ dd { display: inline; text-align: left; margin:0 }
+ dd:after { content: '\A'; white-space: pre; }
+- @fp.each do |p|
+ %table{:class => "sortable"}
+ %tr
+ %th
+ %img{:src => "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/#{p["CID"]}/PNG"}
+ %th
+ %dl
+ - [ "CID", "Target GI", "p_active", "p_inactive" ].each do |k|
+ %dt= k
+ %dd= p[k]
+ - p[:assays].each do |a|
+ %th
+ %dl
+ - a.each do |k,v|
+ %dt= k
+ %dd= v
+ - p[:neighbors].each do |n|
+ %tr
+ %td
+ %img{:src => "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/#{n[:cid]}/PNG"}
+ %td
+ %dl
+ - ["CID", "Similarity"].each do |k|
+ %dt= k
+ %dd= n[k.downcase.to_sym]
+ - n[:assays].each do |a|
+ %td
+ %dl
+ - a.each do |k,v|
+ %dt= k
+ %dd= v
diff --git a/views/index.haml b/views/index.haml
index b75a9ab..e69de29 100644
--- a/views/index.haml
+++ b/views/index.haml
@@ -1,27 +0,0 @@
-!!! 5
-%script{:type => "text/javascript", :src => "sorttable.js"}
-%table{:class => "sortable"}
- %tr
- %th
- = @neighbors.query.to_name
- %br
- %img{:src => @neighbors.query.to_image_uri}
- %th Structure
- %th Properties
- %th Targets
- %th Assays
- - @neighbors.neighbors.each do |neighbor|
- - sim = neighbor.structure_similarity @neighbors.query
- %tr{:sorttable_customkey => sim}
- %td
- = neighbor.to_name
- %br
- %img{:src => neighbor.to_image_uri}
- %td
- = sim
- %td
- = neighbor.property_similarity @neighbors.query
- %td
- = neighbor.target_similarity @neighbors.query
- %td
- = neighbor.assay_similarity @neighbors.query
diff --git a/views/layout.haml b/views/layout.haml
new file mode 100644
index 0000000..8641692
--- /dev/null
+++ b/views/layout.haml
@@ -0,0 +1,26 @@
+!!! 5
+%html
+ %head
+ %script{:type => "text/javascript", :src => "jquery-1.8.2.js"}
+ :javascript
+ function display(element,uri) {
+ $(element).html("<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">");
+ $.ajax({
+ url: uri,
+ success: function(data){
+ $(element).html(data);
+ },
+ error: function(data,textStatus,message){
+ $(element).html(message);
+ }
+ });
+ }
+
+ %body
+ %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" }
+ = yield
diff --git a/views/neighbors.haml b/views/neighbors.haml
new file mode 100644
index 0000000..54905ce
--- /dev/null
+++ b/views/neighbors.haml
@@ -0,0 +1,43 @@
+%script{:type => "text/javascript", :src => "sorttable.js"}
+%table{:class => "sortable"}
+ - session[:compound].neighbors[0..10].each do |compound|
+ %tr
+ %td{:valign => "top"}
+ %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);
+ }
+ });
+ %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);
+ }
+ });
+ %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);
+ }
+ });
+ %td
diff --git a/views/predicted_assays.haml b/views/predicted_assays.haml
new file mode 100644
index 0000000..e995842
--- /dev/null
+++ b/views/predicted_assays.haml
@@ -0,0 +1,6 @@
+%ul
+ - @assays.each do |assay|
+ %li
+ %a{:href => "/aid/#{assay["AID"]}"} #{assay['Assay Name']}
+ AID:
+ = assay["AID"]
diff --git a/views/predicted_targets.haml b/views/predicted_targets.haml
new file mode 100644
index 0000000..1a172ff
--- /dev/null
+++ b/views/predicted_targets.haml
@@ -0,0 +1,6 @@
+%ul
+ - @assays.each do |assay|
+ %li
+ %a{:href => "/aid/#{assay["AID"]}"} #{assay['Target Name']}
+ Target GI:
+ = assay['Target GI']
diff --git a/views/select.haml b/views/select.haml
new file mode 100644
index 0000000..d6e3d20
--- /dev/null
+++ b/views/select.haml
@@ -0,0 +1,8 @@
+%p
+ More than one compound found for
+ = "\"#{params[:name]}\"."
+ Please select a structure:
+- @compounds.each do |compound|
+ %a{:href => "/cid/#{compound.cid}"}
+ %img{:src => compound.image_uri }
+
diff --git a/views/targets.haml b/views/targets.haml
new file mode 100644
index 0000000..1a172ff
--- /dev/null
+++ b/views/targets.haml
@@ -0,0 +1,6 @@
+%ul
+ - @assays.each do |assay|
+ %li
+ %a{:href => "/aid/#{assay["AID"]}"} #{assay['Target Name']}
+ Target GI:
+ = assay['Target GI']