aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/templates/gsearch_pheno.html
blob: be4981bb1bc6d68f9b972cd233a5708657e15579 (plain)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
{% 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" />
    <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" />
    <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" >
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css">
{% endblock %}
{% block content %}
<!-- Start of body -->

    <div class="container">

        <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 />
            <div style="width: 1500px; background-color: #eeeeee; border: 1px solid black;">
            <table width="1500px" id="trait_table" class="table table-hover table-striped">
                <thead>
                    <tr>
                        <th style="background-color: #eeeeee;"></th>
                        <th style="background-color: #eeeeee;">Index</th>
                        <th style="background-color: #eeeeee;">Species</th>
                        <th style="background-color: #eeeeee;">Group</th>
                        <th style="background-color: #eeeeee;">Record</th>
                        <th style="background-color: #eeeeee;">Description</th>
                        <th style="background-color: #eeeeee;">Authors</th>
                        <th style="background-color: #eeeeee;">Year</th>
                        <th style="background-color: #eeeeee; text-align: right;">Max&nbsp;&nbsp;<br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
                        <th style="background-color: #eeeeee;">Max LRS Location</th>
                        <th style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
                    </tr>
                </thead>
                <tbody>
                 {% for this_trait in trait_list %}
                    <TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}">
                        <td><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></td>
                        <td>{{ loop.index }}</td>
                        <td>{{ this_trait.dataset.group.species }}</td>
                        <td>{{ this_trait.dataset.group.name }}</td>
                        <td><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></td>
                        <td>{{ this_trait.description_display }}</td>
                        <td>{{ this_trait.authors }}</td>
                        <td data-order="{{ this_trait.pubmed_text }}"><a href="{{ this_trait.pubmed_link }}">{{ this_trait.pubmed_text }}</a></td>
                        <td align="right">{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td>
                        <td align="right">{{ this_trait.LRS_location_repr }}</td>
                        <td align="right">{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}</td>
                    </TR>
                {% endfor %}
                </tbody>
                <tfoot>
                    <tr>
                        <th style="background-color: #eeeeee;"></th>
                        <th style="background-color: #eeeeee;">Index</th>
                        <th style="background-color: #eeeeee;">Species</th>
                        <th style="background-color: #eeeeee;">Group</th>
                        <th style="background-color: #eeeeee;">Record</th>
                        <th style="background-color: #eeeeee;">Description</th>
                        <th style="background-color: #eeeeee;">Authors</th>
                        <th style="background-color: #eeeeee;">Year</th>
                        <th style="background-color: #eeeeee; text-align: right;">Max&nbsp;&nbsp;<br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
                        <th style="background-color: #eeeeee;">Max LRS Location</th>
                        <th style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></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="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script>
    <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script>
    <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.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 language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script>
    <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script>
	
    <script type="text/javascript" charset="utf-8">
        function getValue(x) {
            if (x.indexOf('input') >= 0) {
                if ($(x).val() == 'x') {
                    return 0;
                }
                else {
                   return parseFloat($(x).val());
                }
            }
            else if (isNaN(x)) {
                return x;
            }
            return parseFloat(x);
        }
            
        jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) {
            var x = getValue(a);
            var y = getValue(b); 
            
            if (x == 'N/A' || x == '') {
                return 1;
            }
            else if (y == 'N/A' || y == '') {
                return -1;
            }
            else {
                return ((x < y) ? -1 : ((x > y) ? 1 : 0));
            }
        };
            
        jQuery.fn.dataTableExt.oSort['cust-txt-desc'] = function (a, b) {
            var x = getValue(a);
            var y = getValue(b);
            return ((x < y) ? 1 : ((x > y) ? -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( {
                "paging": false,
                "buttons": [
                    {
                       extend: 'csvHtml5',
                       text: 'Download CSV',
                       title: 'search_results',
                       fieldBoundary: '"',
                       exportOptions: {
                           columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                       }
                    }
                ],
                "columns": [
                    { "type": "natural" },
                    { "type": "natural" },
                    { "type": "natural" },
                    { "type": "natural" },
                    { "type": "natural" },
                    { "type": "natural", "width": "30%"},
                    { "type": "natural", "width": "25%"},
                    { "type": "natural" },
                    { "type": "natural", "width": "8%"},
                    { "type": "natural", "width": "12%"},
                    { "type": "natural" }
                ],
                "order": [[1, "asc" ]],
                "sDom": "Btir",
                "autoWidth": false,
                "bDeferRender": true,
                "scrollY": "800px",
                "scrollCollapse": false
            } );
            console.timeEnd("Creating table");
        });
        
    </script>
{% endblock %}