aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/gsearch.py35
-rw-r--r--wqflask/wqflask/static/new/css/show_trait.css4
-rw-r--r--wqflask/wqflask/templates/gsearch_gene.html217
-rw-r--r--wqflask/wqflask/templates/show_trait_details.html12
-rw-r--r--wqflask/wqflask/templates/snp_browser.html2
5 files changed, 163 insertions, 107 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 94965507..99dd087d 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -7,6 +7,8 @@ from db import webqtlDatabaseFunction
from base import webqtlConfig
+from wqflask import user_manager
+
from utility.type_checking import is_float, is_int, is_str, get_float, get_int, get_string
from utility.benchmark import Bench
@@ -30,6 +32,7 @@ class GSearch(object):
InbredSet.`Name` AS inbredset_name,
Tissue.`Name` AS tissue_name,
ProbeSetFreeze.Name AS probesetfreeze_name,
+ ProbeSetFreeze.FullName AS probesetfreeze_fullname,
ProbeSet.Name AS probeset_name,
ProbeSet.Symbol AS probeset_symbol,
ProbeSet.`description` AS probeset_description,
@@ -58,30 +61,38 @@ class GSearch(object):
re = g.db.execute(sql).fetchall()
self.trait_list = []
with Bench("Creating trait objects"):
- for line in re:
+ for i, line in enumerate(re):
this_trait = {}
- this_trait['name'] = line[4]
+ this_trait['index'] = i + 1
+ this_trait['name'] = line[5]
this_trait['dataset'] = line[3]
+ this_trait['dataset_fullname'] = line[4]
+ this_trait['hmac'] = user_manager.data_hmac('{}:{}'.format(line[4], line[3]))
this_trait['species'] = line[0]
this_trait['group'] = line[1]
this_trait['tissue'] = line[2]
- this_trait['symbol'] = line[5]
- this_trait['description'] = line[6]
+ this_trait['symbol'] = line[6]
+ this_trait['description'] = line[7]
this_trait['location_repr'] = 'N/A'
- if (line[7] != "NULL" and line[7] != "") and (line[8] != 0):
- this_trait['location_repr'] = 'Chr%s: %.6f' % (line[7], float(line[8]))
- this_trait['mean'] = line[9]
+ if (line[8] != "NULL" and line[8] != "") and (line[9] != 0):
+ this_trait['location_repr'] = 'Chr%s: %.6f' % (line[8], float(line[9]))
+ this_trait['mean'] = round(line[10], 3)
this_trait['LRS_score_repr'] = "N/A"
- if line[10] != "" and line[10] != None:
- this_trait['LRS_score_repr'] = '%3.1f' % line[10]
+ if line[11] != "" and line[11] != None:
+ this_trait['LRS_score_repr'] = round(line[10], 1)
this_trait['additive'] = "N/A"
- if line[13] != "":
- this_trait['additive'] = line[13]
+ if line[14] != "" and line[14] != None:
+ this_trait['additive'] = round(line[14], 3)
#dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False)
#trait_id = line[4]
#with Bench("Building trait object"):
- #this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=False, get_sample_info=False)
+ trait_ob = GeneralTrait(dataset_name=this_trait['dataset'], name=this_trait['name'], get_qtl_info=True, get_sample_info=False)
+ max_lrs_text = "N/A"
+ if trait_ob.locus_chr != "" and trait_ob.locus_mb != "":
+ max_lrs_text = "Chr" + str(trait_ob.locus_chr) + ": " + str(trait_ob.locus_mb)
+ this_trait['max_lrs_text'] = max_lrs_text
+
self.trait_list.append(this_trait)
elif self.type == "phenotype":
diff --git a/wqflask/wqflask/static/new/css/show_trait.css b/wqflask/wqflask/static/new/css/show_trait.css
index 59901404..09d5e1e3 100644
--- a/wqflask/wqflask/static/new/css/show_trait.css
+++ b/wqflask/wqflask/static/new/css/show_trait.css
@@ -14,7 +14,7 @@ div.sample_group {
left: 100px;
}
-table.dataTable thead th{
+table.dataTable thead th, table.dataTable tfoot th{
border-right: 1px solid white;
color: white;
background-color: #369;
@@ -27,7 +27,7 @@ table.dataTable thead .sorting_desc {
background-image: url("../packages/DataTables/images/sort_desc_disabled.png");
}
-table.dataTable thead th {
+table.dataTable thead th, table.dataTable tfoot {
padding: 4px 18px 4px 10px;
}
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index ff5c56f1..5433f2c5 100644
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -7,7 +7,7 @@
{% block content %}
<!-- Start of body -->
- <div class="container">
+ <div class="container" style="width: 2000px;">
<p>You searched for {{ terms }}.</p>
<p>To study a record, click on its Record ID below.<br />Check records below and click Add button to add to selection.</p>
@@ -30,59 +30,9 @@
<br />
<div style="width: 100%;">
<table id="trait_table" class="table-hover table-striped cell-border" style="float: left;">
- <thead>
- <tr>
- <th></th>
- <th data-export="Index">Index</th>
- <th data-export="Record">Record ID</th>
- <th data-export="Species">Species</th>
- <th data-export="Group">Group</th>
- <th data-export="Tissue">Tissue</th>
- <th data-export="Dataset">Dataset</th>
- <th data-export="Symbol">Symbol</th>
- <th data-export="Description">Description</th>
- <th data-export="Location">Location</th>
- <th data-export="Mean">Mean</th>
- <th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank" style="color: white;"><sup>?</sup></a></th>
- <th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank" style="color: white;"><sup>?</sup></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: 0px;"><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.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.species }}">{{ this_trait.species }}</td>
- <td data-export="{{ this_trait.group }}">{{ this_trait.group }}</td>
- <td data-export="{{ this_trait.tissue }}">{{ this_trait.tissue }}</td>
- <td data-export="{{ this_trait.dataset }}">{{ this_trait.dataset }}</td>
- <td data-export="{{ this_trait.symbol }}">{{ this_trait.symbol }}</td>
- <td data-export="{{ this_trait.description }}">{{ this_trait.description }}</td>
- <td data-export="{{ this_trait.location_repr }}" align="right">{{ this_trait.location_repr }}</td>
- <td data-export="{{ '%0.3f' % this_trait.mean|float }}" align="right">{{ '%0.3f' % this_trait.mean|float }}</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 != "" %}{{ '%0.3f' % this_trait.additive|float }}{% else %}N/A{% endif %}" align="right">{% if this_trait.additive != "" %}{{ '%0.3f' % this_trait.additive|float }}{% else %}N/A{% endif %}</td>
- </tr>
- {% endfor %}
+ <td colspan="100%" align="center"><br><b><font size="15">Loading...</font></b><br></td>
</tbody>
- <tfoot>
- <tr>
- <th></th>
- <th>Index</th>
- <th>Record ID</th>
- <th>Species</th>
- <th>Group</th>
- <th>Tissue</th>
- <th>Dataset</th>
- <th>Symbol</th>
- <th>Description</th>
- <th>Location</th>
- <th>Mean</th>
- <th data-export="Max LRS">Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank" style="color: white;"><sup>?</sup></a></th>
- <th data-export="Additive Effect">Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank" style="color: white;"><sup>?</sup></a></th>
- </tr>
- </tfoot>
</table>
</div>
</div>
@@ -100,7 +50,11 @@
<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'>
+ var the_rows = {{ trait_list|safe }};
+ </script>
+
<script type="text/javascript" charset="utf-8">
$.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col )
{
@@ -119,49 +73,138 @@
console.time("Creating table");
$('#trait_table').DataTable( {
- "createdRow": function ( row, data, index ) {
+ 'createdRow': function ( row, data, index ) {
+ $('td', row).eq(0).attr("style", "text-align: center; padding: 4px 10px 2px 10px;");
+ $('td', row).eq(1).attr("align", "right");
+ $('td', row).slice(10,14).attr("align", "right");
$('td', row).eq(8).attr('title', $('td', row).eq(8).text());
- if ($('td', row).eq(8).text().length > 50) {
- $('td', row).eq(8).text($('td', row).eq(8).text().substring(0, 50));
+ if ($('td', row).eq(8).text().length > 45) {
+ $('td', row).eq(8).text($('td', row).eq(8).text().substring(0, 45));
$('td', row).eq(8).text($('td', row).eq(8).text() + '...')
}
+ $('td', row).eq(5).attr('title', $('td', row).eq(5).text());
+ if ($('td', row).eq(5).text().length > 25) {
+ $('td', row).eq(5).text($('td', row).eq(5).text().substring(0, 25));
+ $('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 > 35) {
+ $('td', row).eq(6).text($('td', row).eq(6).text().substring(0, 35));
+ $('td', row).eq(6).text($('td', row).eq(6).text() + '...')
+ }
},
- "paging": false,
- "columns": [
- { "orderDataType": "dom-checkbox" },
- { "type": "natural", "width": "3%" },
- { "type": "natural", "width": "6%" },
- { "type": "natural", "width": "8%" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural", "width": "7%" },
- { "type": "natural", "width": "4%" },
- { "type": "natural", "width": "5%" },
- { "type": "natural", "width": "5%" }
- ],
- "columnDefs": [
+ 'data': the_rows,
+ 'columns': [
+ {
+ 'data': null,
+ 'orderDataType': "dom-checkbox",
+ 'render': function(data, type, row, meta) {
+ return '<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="' + data.hmac + '">'
+ }
+ },
+ {
+ 'title': "Index",
+ 'type': "natural",
+ 'data': "index"
+ },
+ {
+ 'title': "Record ID",
+ 'type': "natural",
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ return '<a href="/show_trait?trait_id=' + data.name + '&dataset=' + data.dataset + '">' + data.name + '</a>'
+ }
+ },
+ {
+ 'title': "Species",
+ 'type': "natural",
+ 'data': "species"
+ },
+ {
+ 'title': "Group",
+ 'type': "natural",
+ 'data': "group"
+ },
+ {
+ 'title': "Tissue",
+ 'type': "natural",
+ 'data': "tissue"
+ },
+ {
+ 'title': "Dataset",
+ 'type': "natural",
+ 'data': "dataset_fullname"
+ },
+ {
+ 'title': "Symbol",
+ 'type': "natural",
+ 'data': "symbol"
+ },
+ {
+ 'title': "Description",
+ 'type': "natural",
+ 'data': "description"
+ },
+ {
+ 'title': "Location",
+ 'type': "natural",
+ 'data': "location_repr"
+ },
{
- "targets": 0,
- "orderable": false,
- "orderDataType": "dom-checkbox"
+ 'title': "Mean",
+ 'type': "natural",
+ 'data': "mean"
+ },
+ {
+ 'title': "Max LRS<a href=\"http://genenetwork.org//glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'type': "natural",
+ 'data': "LRS_score_repr"
+ },
+ {
+ 'title': "Max LRS Location",
+ 'type': "natural",
+ 'data': "max_lrs_text"
+ },
+ {
+ 'title': "Additive Effect<a href=\"http://genenetwork.org//glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup>?</sup></a>",
+ 'type': "natural",
+ 'data': "additive"
}
],
- "order": [[1, "asc" ]],
- "sDom": "tir",
- "autoWidth": false,
- "deferRender": true,
- "bSortClasses": false,
- "scrollY": "600px",
- "scrollCollapse": true,
- "scroller": true,
- "scrollX": true,
- "paging": false,
- "orderClasses": true
+ 'order': [[1, "asc" ]],
+ 'sDom': "tir",
+ 'autoWidth': true,
+ 'deferRender': true,
+ 'paging': false,
+ 'orderClasses': true,
+ 'processing': true,
+ 'language': {
+ 'loadingRecords': '&nbsp;',
+ 'processing': 'Loading...'
+ }
} );
+ $('#trait_table').append(
+ '<tfoot>' +
+ '<tr>' +
+ '<th></th>' +
+ '<th>Index</th>' +
+ '<th>Record ID</th>' +
+ '<th>Species</th> ' +
+ '<th>Group</th>' +
+ '<th>Tissue</th>' +
+ '<th>Dataset</th>' +
+ '<th>Symbol</th>' +
+ '<th>Description</th>' +
+ '<th>Location</th>' +
+ '<th>Mean</th>' +
+ '<th>Max LRS <a href="http://genenetwork.org//glossary.html#LRS" target="_blank" style="color: white;"><sup>?</sup></a></th>' +
+ '<th>Max LRS Location</th>' +
+ '<th>Additive Effect <a href="http://genenetwork.org//glossary.html#A" target="_blank" style="color: white;"><sup>?</sup></a></th>' +
+ '</tr>' +
+ '</tfoot>'
+ );
+
console.timeEnd("Creating table");
});
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index 96675306..566ea7ca 100644
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -112,25 +112,27 @@
</a>
{% if this_trait.dataset.type == 'ProbeSet' %}
{% if this_trait.symbol != None %}
- <a href="http://www.genenetwork.org/webqtl/main.py?cmd=sch&amp;gene={{ this_trait.symbol }}&amp;alias=1&amp;species={{ dataset.group.species }}">
+ <a target="_blank" href="http://www.genenetwork.org/webqtl/main.py?cmd=sch&amp;gene={{ this_trait.symbol }}&amp;alias=1&amp;species={{ dataset.group.species }}">
<button type="button" class="btn btn-default" title="Find similar expression data">Find</button>
</a>
{% endif %}
{% if UCSC_BLAT_URL != "" %}
- <a href="{{ UCSC_BLAT_URL }}">
+ <a target="_blank" href="{{ UCSC_BLAT_URL }}">
<button type="button" class="btn btn-default" title="Check probe locations at UCSC">Verify</button>
</a>
{% endif %}
{% if this_trait.symbol != None %}
- <a href="http://genenetwork.org/webqtl/main.py?FormID=geneWiki&symbol={{ this_trait.symbol }}">
+ <a target="_blank" href="http://genenetwork.org/webqtl/main.py?FormID=geneWiki&symbol={{ this_trait.symbol }}">
<button type="button" class="btn btn-default" title="Write or review comments about this gene">GeneWiki</button>
</a>
- <a href="http://genenetwork.org/webqtl/main.py?FormID=SnpBrowserResultPage&submitStatus=1&diffAlleles=True&customStrain=True&geneName={{ this_trait.symbol }}">
+ {% if dataset.group.species == "mouse" or dataset.group.species == "rat" %}
+ <a href="./snp_browser?first_run=true&species={{ dataset.group.species }}&gene_name={{ this_trait.symbol }}&limit_strains=on">
<button type="button" class="btn btn-default" title="View SNPs and Indels">SNPs</button>
</a>
{% endif %}
+ {% endif %}
{% if show_probes == "True" %}
- <a href="http://genenetwork.org/webqtl/main.py?FormID=showProbeInfo&database={{ this_trait.dataset.name }}&ProbeSetID={{ this_trait.name }}&CellID={{ this_trait.cellid }}&RISet={{ dataset.group.name }}&incparentsf1=ON">
+ <a target="_blank" href="http://genenetwork.org/webqtl/main.py?FormID=showProbeInfo&database={{ this_trait.dataset.name }}&ProbeSetID={{ this_trait.name }}&CellID={{ this_trait.cellid }}&RISet={{ dataset.group.name }}&incparentsf1=ON">
<button type="button" class="btn btn-default" title="Check sequence of probes">Probes</button>
</a>
{% endif %}
diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html
index 8ae763fa..87cbab84 100644
--- a/wqflask/wqflask/templates/snp_browser.html
+++ b/wqflask/wqflask/templates/snp_browser.html
@@ -183,7 +183,7 @@
<div style="margin-top: 20px;">
{% if filtered_results is defined %}
{% if filtered_results|length > limit_number %}
- There are more than 5000 results. Consider limiting your search to a smaller range.
+ There are more than 10000 results. Consider limiting your search to a smaller range.
{% else %}
<table class="dataTable cell-border nowrap" id="results_table" style="float: left;">
<thead>