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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
{% extends "base.html" %}
{% block title %}Search Results{% endblock %}
{% block css %}
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
{% endblock %}
{% block content %}
<!-- Start of body -->
<div class="container">
<p>You searched for {{ terms }}.</p>
<p>To study a record, click on its ID below.<br />Check records below and click Add button to add to selection.</p>
<div>
<br />
<button class="btn btn-default" id="select_all"><span class="glyphicon glyphicon-ok"></span> Select All</button>
<button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button>
<button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button>
<button class="btn btn-default" id="add" disabled ><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
<input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ...">
<input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ...">
<br />
<br />
<form id="export_form" method="POST" action="/export_traits_csv">
<input type="hidden" name="database_name" id="database_name" value="None">
<input type="hidden" name="export_data" id="export_data" value="">
<button class="btn btn-default" id="export_traits">Download CSV</button>
</form>
<br />
<div>
<table id="trait_table" class="display dataTable nowrap" style="float: left;">
<thead>
<tr>
<th></th>
<th data-export="Index">Index</th>
<th data-export="Species">Species</th>
<th data-export="Group">Group</th>
<th data-export="Record">Record</th>
<th data-export="Description">Description</th>
<th data-export="Authors">Authors</th>
<th data-export="Year">Year</th>
<th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th>
<th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th>
</tr>
</thead>
<tbody>
{% for this_trait in trait_list %}
<tr id="trait:{{ this_trait.name }}:{{ this_trait.dataset }}">
<td align="center" style="padding-right: 0px; padding-left: 5px;"><input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset)) }}"></td>
<td align="right" data-export="{{ loop.index }}">{{ loop.index }}</td>
<td data-export="{{ this_trait.species }}">{{ this_trait.species }}</td>
<td data-export="{{ this_trait.group }}">{{ this_trait.group }}</td>
<td data-export="{{ this_trait.name }}"><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset)}}">{{ this_trait.name }}</a></td>
<td data-export="{{ this_trait.description }}">{{ this_trait.description }}</td>
<td data-export="{{ this_trait.authors }}">{{ this_trait.authors }}</td>
<td data-export="{{ this_trait.pubmed_text }}" data-order="{{ this_trait.pubmed_text }}"><a href="{{ this_trait.pubmed_link }}">{{ this_trait.pubmed_text }}</a></td>
<td data-export="{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}" align="right">{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td>
<td data-export="{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}" align="right">{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th></th>
<th>Index</th>
<th>Species</th>
<th>Group</th>
<th>Record</th>
<th>Description</th>
<th>Authors</th>
<th>Year</th>
<th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th>
<th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank"><img style="width: 15px; height: 15px;" src="/static/new/images/question_mark.jpg"></a></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<!-- End of body -->
{% endblock %}
{% block js %}
<script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
<script language="javascript" type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script>
<script type="text/javascript" charset="utf-8">
$.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col )
{
return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
return $('input', td).prop('checked') ? '1' : '0';
} );
};
$(document).ready( function () {
$('#trait_table tr').click(function(event) {
if (event.target.type !== 'checkbox') {
$(':checkbox', this).trigger('click');
}
});
console.time("Creating table");
$('#trait_table').DataTable( {
"createdRow": function ( row, data, index ) {
$('td', row).eq(5).attr('title', $('td', row).eq(5).text());
if ($('td', row).eq(5).text().length > 50) {
$('td', row).eq(5).text($('td', row).eq(5).text().substring(0, 50));
$('td', row).eq(5).text($('td', row).eq(5).text() + '...')
}
$('td', row).eq(6).attr('title', $('td', row).eq(6).text());
if ($('td', row).eq(6).text().length > 50) {
$('td', row).eq(6).text($('td', row).eq(6).text().substring(0, 50));
$('td', row).eq(6).text($('td', row).eq(6).text() + '...')
}
},
"paging": false,
"columns": [
{ "orderDataType": "dom-checkbox" },
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural", "width": "30%"},
{ "type": "natural", "width": "25%"},
{ "type": "natural" },
{ "type": "natural", "width": "8%"},
{ "type": "natural" }
],
"columnDefs": [
{
"targets": 0,
"orderable": false,
"orderDataType": "dom-checkbox"
}
],
"order": [[1, "asc" ]],
"sDom": "tir",
"autoWidth": false,
"deferRender": true,
"bSortClasses": false,
"scrollY": "600px",
"scrollCollapse": true,
"scroller": true,
"scrollX": true,
"paging": false,
"orderClasses": true
} );
console.timeEnd("Creating table");
});
</script>
{% endblock %}
|