about summary refs log tree commit diff
path: root/gn2/wqflask/templates/search_result_page.html
diff options
context:
space:
mode:
Diffstat (limited to 'gn2/wqflask/templates/search_result_page.html')
-rw-r--r--gn2/wqflask/templates/search_result_page.html453
1 files changed, 453 insertions, 0 deletions
diff --git a/gn2/wqflask/templates/search_result_page.html b/gn2/wqflask/templates/search_result_page.html
new file mode 100644
index 00000000..cade198a
--- /dev/null
+++ b/gn2/wqflask/templates/search_result_page.html
@@ -0,0 +1,453 @@
+{% extends "base.html" %}
+{% block title %}Search Results{% endblock %}
+{% block css %}
+    <link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='DataTables/css/jquery.dataTables.css') }}" />
+    <link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='fontawesome/css/font-awesome.min.css') }}" />
+    <link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonStyles/css/buttons.dataTables.min.css') }}">
+    <link rel="stylesheet" type="text/css" href="{{ url_for('css', filename='fontawesome/css/all.min.css') }}"/>
+    <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
+    <link rel="stylesheet" type="text/css" href="/static/new/css/show_trait.css" />
+    <link rel="stylesheet" type="text/css" href="static/new/css/trait_list.css" />
+{% endblock %}
+{% block content %}
+<!-- Start of body -->
+    <div style="margin-left: 20px;">
+        <input type="hidden" name="uc_id" id="uc_id" value="{{ uc_id }}">
+
+        <div style="padding-top: 10px; padding-bottom: 10px; font-size: 16px;">
+        <!-- Need to customize text more for other types of searches -->
+
+            <p>We searched <a href="http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&{% if dataset.accession_id %}GN_AccessionId={{dataset.accession_id }}{% else %}InfoPageName={{ dataset.name }}{% endif %}">{{ dataset.fullname }}</a>
+          <br>
+          to find all records
+                {% if go_term is not none %}
+                with <span style="font-family: Courier New"><b>Gene Ontology ID</b></span> <strong>GO:{{ go_term }}</strong>.
+                {% else %}
+                {% for word in search_terms %}
+                    {% if word.key|lower == "rif" %}
+                    with <span style="font-family: Courier New"><b>GeneRIF</b></span> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.key|lower == "go" %}
+                    with <span style="font-family: Courier New"><b>Gene Ontology ID</b></span> <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.key|lower == "wiki" %}
+                    with <span style="font-family: Courier New"><b>GeneWiki</b></span> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.key|lower == "mean" %}
+                    with <span style="font-family: Courier New"><b>mean</b></span> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.key|lower == "range" %}
+                    with <span style="font-family: Courier New"><b>RANGE</b></span> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.key|lower == "lrs" or word.key|lower == "lod" or word.key|lower == "translrs" or word.key|lower == "cislrs" or word.key|lower == "translod" or word.key|lower == "cislod" %}
+                    {% if word.search_term|length == 1 %}
+                    with {% if word.key|lower == "translrs" %}trans{% elif word.key|lower == "cislrs" %}cis{% endif %}LRS {% if word.separator == ">" %} greater than {% elif word.separator == "<" %} less than {% elif word.separator == ">=" %} greater than or equal to {% elif word.separator == "<=" %} less than or equal to {% endif %} <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.search_term|length == 2 %}
+                    with <span style="font-family: Courier New"><b>{{ word.key|upper }}</b></span> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.search_term|length == 3 %}
+                    with <span style="font-family: Courier New"><b>{{ word.key|upper }}</b></span> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong>{% if loop.last %}{% else %} and {% endif %}
+                    {% elif word.search_term|length == 4 %}
+                    with <span style="font-family: Courier New"><b>{{ word.key|upper }}</b></span> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[3] }}</strong> with an exclusion zone of <strong>{{ word.search_term[2] }}</strong> Mb
+                    {% elif word.search_term|length == 5 %}
+                    with <span style="font-family: Courier New"><b>{{ word.key|upper }}</b></span> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong> between <strong>{{ word.search_term[3] }}</strong> and <strong>{{ word.search_term[4] }}</strong> Mb{% if loop.last %}{% else %} and {% endif %}
+                    {% endif %}
+                    {% elif word.key|lower == "position" or word.key|lower == "mb" %}
+                    with <u>target genes</u> on chromosome <strong>{% if (word.search_term[0]|lower).split('chr')|length > 1 %}{{ (word.search_term[0]|lower).split('chr')[1] }}{% else %}{{ word.search_term[0] }}{% endif %}</strong> between <strong>{{ word.search_term[1] }}</strong> and <strong>{{ word.search_term[2] }}</strong> Mb{% if loop.last %}{% else %} and {% endif %}
+                    {% else %}
+                    {% if word.search_term[0] == "*" %} in the dataset.{% else %}{% if loop.first %}that match: {% endif %}<b>{{ word.search_term[0] }}</b>{% if loop.last %}{% else %} and {% endif %}{% endif %}
+                    {% endif %}
+                {% endfor %}
+                {% endif %}
+                <br>
+                {% if results|count > 0 %}
+                <b>{{ results|count }}</b> record{% if results|count > 1 %}s{% else %}{% endif %} found
+                {% else %}
+                No (<b>0</b>) records found for this search. Modify your search, check target dataset, or use <b>Search All</b> above.
+                {% endif %}
+        </p>
+
+        {% if results|count > 0 %}
+        {% if go_term is not none %}
+        <p><b>The associated genes include:</b><br><br>{% for word in search_terms %}{{ word.search_term[0] }}{% endfor %}</p>
+        {% endif %}
+
+        </div>
+        {% if too_many_results %}
+        <p>Your search generated over 50000 results. Please modify your search to generate 50000 or fewer matches.</p>
+        {% else %}
+        <div style="min-width: 1050px;">
+          <form id="trait_submission_form" target="_blank" action="/corr_matrix" method="post">
+            <input type="hidden" name="tool_used" value="" />
+            <input type="hidden" name="form_url" value="" />
+            <input type="hidden" name="trait_list" id="trait_list" value= "
+            {% for this_trait in trait_list %}
+                {{ this_trait.name }}:{{ this_trait.dataset }},
+            {% endfor %}" >
+
+            {% include 'tool_buttons.html' %}
+
+          </form>
+        </div>
+
+        <div>
+          <br />
+          <form id="export_form" method="POST" action="/export_traits_csv" style="display: inline;">
+            <div style="min-width: 950px;">
+              <input type="hidden" name="headers" id="headers" value="{% for field in header_fields %}{{ field }},{% endfor %}">
+              <input type="hidden" name="search_string" id="search_string" value="{{ original_search_string }}">
+              <input type="hidden" name="database_name" id="database_name" value="{{ dataset.fullname }}">
+              <input type="hidden" name="file_name" id="file_name" value="search_results">
+              <input type="hidden" name="filter_term" id="filter_term" value="None">
+              {% if dataset.accession_id %}
+              <input type="hidden" name="accession_id" id="accession_id" value="{{ dataset.accession_id }}">
+              {% endif %}
+              <input type="hidden" name="export_data" id="export_data" value="">
+              <input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search For...">
+              <button class="btn btn-success" id="add" type="button" disabled><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
+              <button class="btn btn-default" id="select_all" type="button"><span class="glyphicon glyphicon-ok"></span> Select All</button>
+              <input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Rows (1-5, 11)">
+              <button class="btn btn-default" id="export_traits"><span class="glyphicon glyphicon-download-alt"></span> Download</button>
+              <button class="btn btn-default" id="invert" type="button"><span class="glyphicon glyphicon-adjust"></span> Invert</button>
+              <button class="btn btn-default" id="deselect_all" type="button"><span class="glyphicon glyphicon-remove"></span> Deselect</button>
+            </div>
+            <div id="select_samples_invalid" class="alert alert-error" style="display:none;">
+              Please check that your syntax includes only a combination of integers, dashes, and commas of a format 
+              similar to <strong>1,5,10</strong> or <strong>2, 5-10, 15</strong>, etc.
+            </div>
+          </form>
+          {% if dataset.type != 'Geno' %}
+          <div class="show-hide-container">
+            <b>Show/Hide Columns:&nbsp;&nbsp;</b>
+            {% if dataset.type == 'ProbeSet' %}
+            <button class="toggle-vis" data-column="3">Symbol</button>
+            <button class="toggle-vis" data-column="4">Description</button>
+            <button class="toggle-vis" data-column="5">Location</button>
+            <button class="toggle-vis" data-column="6">Mean</button>
+            <button class="toggle-vis" data-column="7">Peak -logP</button>
+            <button class="toggle-vis" data-column="8">Peak Location</button>
+            <button class="toggle-vis" data-column="9">Effect Size</button>
+            {% elif dataset.type == 'Publish' %}
+            <button class="toggle-vis" data-column="3">Description</button>
+            <button class="toggle-vis" data-column="4">Mean</button>
+            <button class="toggle-vis" data-column="5">Authors</button>
+            <button class="toggle-vis" data-column="6">Year</button>
+            <button class="toggle-vis" data-column="7">Peak -logP</button>
+            <button class="toggle-vis" data-column="8">Peak Location</button>
+            <button class="toggle-vis" data-column="9">Effect Size</button>
+            {% endif %}
+          </div>
+          {% endif %}
+          <div id="trait_table_container" style="{% if dataset.type == 'Geno' %}width: 450px;{% else %}width: 90%; min-width: 1250px;{% endif %}">
+            <table class="table-hover table-striped cell-border" id='trait_table' style="float: left;">
+                <tbody>
+                 <td colspan="100%" align="center"><br><b><font size="15">Loading...</font></b><br></td>
+                </tbody>
+            </table>
+          </div>
+        </div>
+        {% endif %}
+        {% else %}
+        <br>
+        <button type="button" onclick="window.location.href='/'">Return To Search</button>
+        {% endif %}
+    </div>
+    <div id="myModal"></div>
+
+<!-- End of body -->
+
+{% endblock %}
+
+{% block js %}
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='js_alt/md5.min.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTables/js/jquery.dataTables.min.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/scroller/js/dataTables.scroller.min.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='jszip/jszip.min.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/plugins/sorting/natural.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/buttons/js/dataTables.buttons.min.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='DataTablesExtensions/buttons/js/buttons.colVis.min.js') }}"></script>
+    <script language="javascript" type="text/javascript" src="{{ url_for('js', filename='fontawesome/js/all.min.js') }}"></script>
+
+    <script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script>
+    <script language="javascript" type="text/javascript" src="/static/new/javascript/table_functions.js"></script>
+    <script language="javascript" type="text/javascript" src="/static/new/javascript/create_datatable.js"></script>
+    <script language="javascript" type="text/javascript" src="/static/new/javascript/partial_correlations.js"></script>
+
+    <script type='text/javascript'>
+        var traitsJson = {{ trait_list|safe }};
+    </script>
+
+    <script type="text/javascript" charset="utf-8">
+        $(document).ready( function () {
+
+            var getParams = function(url) {
+                let parser = document.createElement('a');
+                parser.href = url;
+                let params = parser.search.substring(1);
+                if(params.length > 0) {
+                    return ('?'+params);
+                }
+                return params;
+            };
+
+            {% if results|count > 0  and not too_many_results %}
+            var tableId = "trait_table";
+
+            var widthChange = 0; //ZS: For storing the change in width so overall table width can be adjusted by that amount
+
+            columnDefs = [
+            {
+              'data': null,
+              'width': "5px",
+              'orderDataType': "dom-checkbox",
+              'targets': 0,
+              'render': function(data) {
+                return '<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="' + data.hmac + '" data-trait-info="' + data.trait_info_str + '">'
+              }
+            },
+            {
+              'title': "Index",
+              'type': "natural",
+              'width': "35px",
+              "searchable": false,
+              "orderable": false,
+              'targets': 1,
+              'data': "index"
+            }
+            {% if dataset.type == 'ProbeSet' %},
+            {
+              'title': "Record",
+              'type': "natural-minus-na",
+              'data': null,
+              'width': "{{ max_widths.display_name * 8 }}px",
+              'targets': 2,
+              'render': function(data) {
+                return '<a target="_blank" href="/show_trait?trait_id=' + data.display_name + '&dataset=' + data.dataset + '">' + data.display_name + '</a>'
+              }
+            },
+            {
+              'title': "Symbol",
+              'type': "natural",
+              'width': "{{ max_widths.symbol * 8 }}px",
+              'targets': 3,
+              'data': "symbol"
+            },
+            {
+              'title': "Description",
+              'type': "natural",
+              'data': null,
+              'targets': 4,
+              'render': function(data) {
+                description = data.description
+                if (data.description.length > 200) {
+                  description = data.description.slice(0, 200) + '...'
+                }
+                try {
+                  return decodeURIComponent(escape(description))
+                } catch(err){
+                  return escape(description)
+                }
+              }
+            },
+            {
+              'title': "<div style='text-align: right;'>Location</div>",
+              'type': "natural-minus-na",
+              'width': "130px",
+              'targets': 5,
+              'data': "location"
+            },
+            {
+              'title': "<div style='text-align: right;'>Mean</div>",
+              'type': "natural-minus-na",
+              'width': "40px",
+              'data': "mean",
+              'targets': 6,
+              'orderSequence': [ "desc", "asc"]
+            },
+            {
+              'title': "<div style='text-align: right; padding-right: 10px;'>Peak</div> <div style='text-align: right;'>-logP <a href=\"{{ url_for('glossary_blueprint.glossary') }}#LRS\" target=\"_blank\" style=\"color: white;\"><sup style='color: #FF0000;'><i>?</i></sup></a></div>",
+              'type': "natural-minus-na",
+              'data': "lod_score",
+              'width': "60px",
+              'targets': 7,
+              'orderSequence': [ "desc", "asc"]
+            },
+            {
+              'title': "<div style='text-align: right;'>Peak Location</div>",
+              'type': "natural-minus-na",
+              'width': "130px",
+              'targets': 8,
+              'data': "lrs_location"
+            },
+            {
+              'title': "<div style='text-align: right; padding-right: 10px;'>Effect</div> <div style='text-align: right;'>Size <a href=\"{{ url_for('glossary_blueprint.glossary') }}#A\" target=\"_blank\" style=\"color: white;\"><sup style='color: #FF0000;'><i>?</i></sup></a></div>",
+              'type': "natural-minus-na",
+              'data': "additive",
+              'width': "65px",
+              'targets': 9,
+              'orderSequence': [ "desc", "asc"]
+            }{% elif dataset.type == 'Publish' %},
+            {
+              'title': "Record",
+              'type': "natural-minus-na",
+              'width': "{{ max_widths.display_name * 9 }}px",
+              'data': null,
+              'targets': 2,
+              'render': function(data) {
+                return '<a target="_blank" href="/show_trait?trait_id=' + data.name + '&dataset=' + data.dataset + '">' + data.display_name + '</a>'
+              }
+            },
+            {
+              'title': "Description",
+              'type': "natural",
+              'data': null,
+              'targets': 3,
+              'render': function(data) {
+                description = data.description
+                if (data.description.length > 200) {
+                  description = data.description.slice(0, 200) + '...'
+                }
+                try {
+                  return decodeURIComponent(escape(description))
+                } catch(err){
+                  return escape(description)
+                }
+              }
+            },
+            {
+              'title': "<div style='text-align: right;'>Mean</div>",
+              'type': "natural-minus-na",
+              'width': "60px",
+              'data': "mean",
+              'targets': 4,
+              'orderSequence': [ "desc", "asc"]
+            },
+            {
+              'title': "Authors",
+              'type': "natural",
+              {% if (max_widths.authors * 5) < 500 %}
+              'width': "{{ max_widths.authors * 5 }}px",
+              {% else %}
+              'width': "500px",
+              {% endif %}
+              'data': "authors_display",
+              'targets': 5
+            },
+            {
+              'title': "<div style='text-align: right;'>Year</div>",
+              'type': "natural-minus-na",
+              'data': null,
+              'width': "50px",
+              'targets': 6,
+              'render': function(data) {
+                if (data.pubmed_id != "N/A"){
+                  return '<a href="' + data.pubmed_link + '">' + data.pubmed_text + '</a>'
+                } else {
+                  return data.pubmed_text
+                }
+              },
+              'orderSequence': [ "desc", "asc"]
+            },
+            {
+              'title': "<div style='text-align: right; padding-right: 10px;'>Peak</div> <div style='text-align: right;'>-logP <a href=\"{{ url_for('glossary_blueprint.glossary') }}#LRS\" target=\"_blank\" style=\"color: white;\"><sup style='color: #FF0000;'><i>?</i></sup></a></div>",
+              'type': "natural-minus-na",
+              'data': "lod_score",
+              'targets': 7,
+              'width': "60px",
+              'orderSequence': [ "desc", "asc"]
+            },
+            {
+              'title': "<div style='text-align: right;'>Peak Location</div>",
+              'type': "natural-minus-na",
+              'width': "125px",
+              'targets': 8,
+              'data': "lrs_location"
+            },
+            {
+              'title': "<div style='text-align: right; padding-right: 10px;'>Effect</div> <div style='text-align: right;'>Size <a href=\"{{ url_for('glossary_blueprint.glossary') }}#A\" target=\"_blank\" style=\"color: white;\"><sup style='color: #FF0000;'><i>?</i></sup></a></div>",
+              'type': "natural-minus-na",
+              'width': "60px",
+              'data': "additive",
+              'targets': 9,
+              'orderSequence': [ "desc", "asc"]
+            }{% elif dataset.type == 'Geno' %},
+            {
+              'title': "Record",
+              'type': "natural-minus-na",
+              'width': "{{ max_widths.display_name * 9 }}px",
+              'data': null,
+              'targets': 2,
+              'render': function(data) {
+                return '<a target="_blank" href="/show_trait?trait_id=' + data.display_name + '&dataset=' + data.dataset + '">' + data.display_name + '</a>'
+              }
+            },
+            {
+              'title': "<div style='text-align: right;'>Location</div>",
+              'type': "natural-minus-na",
+              'width': "125px",
+              'targets': 2,
+              'data': "location"
+            }{% endif %}
+            ];
+
+            tableSettings = {
+              "createdRow": function ( row, data, index ) {
+                $('td', row).eq(0).attr("style", "text-align: center; padding: 0px 10px 2px 10px;");
+                $('td', row).eq(1).attr("align", "right");
+                $('td', row).eq(1).attr('data-export', index+1);
+                $('td', row).eq(2).attr('data-export', $('td', row).eq(2).text());
+                {% if dataset.type == 'ProbeSet' %}
+                $('td', row).eq(3).attr('title', $('td', row).eq(3).text());
+                $('td', row).eq(3).attr('data-export', $('td', row).eq(3).text());
+                if ($('td', row).eq(3).text().length > 20) {
+                  $('td', row).eq(3).text($('td', row).eq(3).text().substring(0, 20));
+                  $('td', row).eq(3).text($('td', row).eq(3).text() + '...')
+                }
+                $('td', row).eq(4).attr('title', $('td', row).eq(4).text());
+                $('td', row).eq(4).attr('data-export', $('td', row).eq(4).text());
+                if ($('td', row).eq(4).text().length > 500) {
+                  $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 500));
+                  $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
+                }
+                $('td', row).slice(5,10).attr("align", "right");
+                $('td', row).eq(5).attr('data-export', $('td', row).eq(5).text());
+                $('td', row).eq(6).attr('data-export', $('td', row).eq(6).text());
+                $('td', row).eq(7).attr('data-export', $('td', row).eq(7).text());
+                $('td', row).eq(8).attr('data-export', $('td', row).eq(8).text());
+                $('td', row).eq(9).attr('data-export', $('td', row).eq(9).text());
+                {% elif dataset.type == 'Publish' %}
+                $('td', row).eq(3).attr('title', $('td', row).eq(3).text());
+                $('td', row).eq(3).attr('data-export', $('td', row).eq(3).text());
+                if ($('td', row).eq(3).text().length > 500) {
+                  $('td', row).eq(3).text($('td', row).eq(3).text().substring(0, 500));
+                  $('td', row).eq(3).text($('td', row).eq(3).text() + '...')
+                }
+                $('td', row).eq(4).attr('title', $('td', row).eq(4).text());
+                $('td', row).eq(4).attr('data-export', $('td', row).eq(4).text());
+                $('td', row).eq(4).attr('align', 'right');
+                $('td', row).slice(6,10).attr("align", "right");
+                $('td', row).eq(5).attr('data-export', $('td', row).eq(5).text());
+                $('td', row).eq(6).attr('data-export', $('td', row).eq(6).text());
+                $('td', row).eq(7).attr('data-export', $('td', row).eq(7).text());
+                $('td', row).eq(8).attr('data-export', $('td', row).eq(8).text());
+                $('td', row).eq(9).attr('data-export', $('td', row).eq(8).text());
+                {% elif dataset.type == 'Geno' %}
+                $('td', row).eq(3).attr('data-export', $('td', row).eq(3).text());
+                {% endif %}
+              },
+              "order": [[1, "asc" ]],
+              "autoWidth": true,
+              {% if trait_list|length > 10 %}
+              "scrollY": "1000px",
+              "scroller": true,
+              "scrollCollapse":true
+              {% else %}
+              "scroller": false
+              {% endif %}
+            }
+
+            create_table(tableId, traitsJson, columnDefs, tableSettings)
+            {% endif %}
+
+            submit_special = function(url) {
+                $("#trait_submission_form").attr("action", url);
+                return $("#trait_submission_form").submit();
+            };
+
+        });
+    </script>
+{% endblock %}