1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/ @@prediction_models and @@predictions defined in POST request '/predict'
/ unpacks multi prediction array ;
/ prepare it for neighbours ;
/ align single prediction to endpoint ;
/ display preordered in table view ;
/ loaded in iframe, necessary to load js/css here ;
%link{ :href=>"/stylesheets/screen.css", :media=>"screen, projection", :rel=>"stylesheet", :type=>"text/css"}
%link{:rel=>"stylesheet", :href=>"http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css"}
%script{:src=>"http://code.jquery.com/jquery-1.9.1.js"}
%script{ :src=>"http://code.jquery.com/ui/1.10.0/jquery-ui.js"}
%script{:src=>"/javascripts/jquery.tablesorter.min.js"}
.results{:style=>"display:none"}
- count_m = 0
/ tabs div ;
#tabs
%ul
/ each endpoint becomes a tab head ;
- @@prediction_models.each do |m|
- count_m += 1
%li
%a{:href => "#results_#{count_m}", :id => "link#{m.title}"}
= m.title
- count_rs = 0
/ unpack to single arrays
- @@predictions.each do |pa|
- count_rs += 1
#results{:id=>"#{count_rs}"}
- pa.each do |p|
/ get prediction OpenTox::Dataset
- p.get
/ prepare dataset for neighbours table ;
/ delete first array which contains input compound prediction ;
/ keep the following arrays they are the neighbour predictions ;
- p.data_entries.shift
- p.compounds.shift
/ call the tablesorter plugin ;
/ presort by similarity ;
:javascript
$(document).ready(function(){
$("table##{count_rs}").tablesorter({
//debug: true,
widgets: ['zebra'],
headers: {0: {sorter: false},3: {sorter: false}},
sortList: [[2,0]]
});
});
/ TODO catch table error if tbody is empty
%h2= "Neighbours: "
%table{:id=>"#{count_rs}", :class=>"tablesorter", :cellspacing=>"1"}
%thead
%tr
%th
Compound
%th
Measured Activity
%th
Similarity
%th
Details
-#%tbody
- count = 0
- p.compounds.each do |neighbour_compound|
%tr
%td
%img{:src=>"#{neighbour_compound.uri}/image", :alt=>neighbour_compound.uri, :width=>"100px"}
%td
= p.data_entries[count][0]
%td
= p.data_entries[count][3].round(3)
%td
%a{:href => to("/prediction/#{CGI.escape(neighbour_compound.uri)}/details"), :id=>"link#{count_rs}#{count}", :target=>"details"}
%img{:src=>"/images/arrow_right_float.png", :alt=>"arrow"}
:javascript
$("a#link#{count_rs}#{count}").click(function () {
$(".details").toggle();
document.getElementById('details').focus();
});
- count += 1
-#= haml :details, :layout => false
%iframe{:id=>"details", :name=>"details", :height=>"400px", :width=>"100%", :style=>"border:0px"}
|