aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/base/trait.py2
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py57
-rw-r--r--wqflask/wqflask/templates/correlation_page.html453
3 files changed, 288 insertions, 224 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index cfc02f8b..e0afa915 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -513,7 +513,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
# If the dataset is confidential and the user has access to confidential
# phenotype traits, then display the pre-publication description instead
# of the post-publication description
- if trait.confidential:
+ if not trait.pubmed_id:
trait.abbreviation = trait.pre_publication_abbreviation
trait.description_display = trait.pre_publication_description
else:
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 4c2b64ba..394c113d 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -484,30 +484,31 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap
if trait.view == False:
continue
results_dict = {}
- if not for_api:
- results_dict['checkbox'] = "<INPUT TYPE='checkbox' NAME='searchResult' class='checkbox trait_checkbox' style='padding-right: 0px;' VALUE='" + hmac.hmac_creation('{}:{}'.format(trait.name, trait.dataset.name)) + "'>"
- results_dict['index'] = i + 1
- results_dict['trait_id'] = "<a href='/show_trait?trait_id="+str(trait.name)+"&dataset="+str(dataset.name)+"'>"+str(trait.name)+"</a>"
- else:
- results_dict['trait_id'] = trait.name
+ results_dict['index'] = i + 1
+ results_dict['trait_id'] = trait.name
+ results_dict['dataset'] = trait.dataset.name
if target_dataset.type == "ProbeSet":
results_dict['symbol'] = trait.symbol
+ if len(trait.description_display) > 40:
+ results_dict['description'] = trait.description_display[:40] + "..."
+ else:
+ results_dict['description'] = trait.description_display
results_dict['description'] = trait.description_display
results_dict['location'] = trait.location_repr
- results_dict['mean'] = float(trait.mean)
+ if trait.mean and trait.mean != "":
+ results_dict['mean'] = float(trait.mean)
+ else:
+ results_dict['mean'] = "N/A"
if trait.LRS_score_repr != "N/A":
results_dict['lrs_score'] = "%.1f" % float(trait.LRS_score_repr)
else:
results_dict['lrs_score'] = "N/A"
results_dict['lrs_location'] = trait.LRS_location_repr
- if trait.additive != "":
+ if trait.additive and trait.additive != "":
results_dict['additive'] = "%0.3f" % float(trait.additive)
else:
results_dict['additive'] = "N/A"
- if for_api:
- results_dict['sample_r'] = "%0.3f" % float(trait.sample_r)
- else:
- results_dict['sample_r'] = "<a target='_blank' href='corr_scatter_plot?dataset_1=" + str(dataset.name) + "&dataset_2=" + str(trait.dataset.name) + "&trait_1=" + str(this_trait.name) + "&trait_2=" + str(trait.name) + "'>" + "%0.3f" % float(trait.sample_r) + "</a>"
+ results_dict['sample_r'] = "%0.3f" % float(trait.sample_r)
results_dict['num_overlap'] = trait.num_overlap
results_dict['sample_p'] = "%0.3e" % float(trait.sample_p)
if trait.lit_corr == "" or trait.lit_corr == 0:
@@ -516,41 +517,49 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap
results_dict['lit_corr'] = "%0.3f" % float(trait.lit_corr)
if trait.tissue_corr == "" or trait.tissue_corr == 0:
results_dict['tissue_corr'] = "--"
+ results_dict['tissue_pvalue'] = "--"
else:
results_dict['tissue_corr'] = "%0.3f" % float(trait.tissue_corr)
+ results_dict['tissue_pvalue'] = "%0.3e" % float(trait.tissue_pvalue)
elif target_dataset.type == "Publish":
- results_dict['description'] = trait.description_display
+ results_dict['abbreviation_display'] = "N/A"
+ if trait.abbreviation:
+ results_dict['abbreviation_display'] = trait.abbreviation
+ results_dict['description'] = "N/A"
+ if trait.description_display:
+ results_dict['description'] = trait.description_display
results_dict['authors'] = trait.authors
+ authors_list = trait.authors.split(',')
+ if len(authors_list) > 6:
+ results_dict['authors_display'] = ", ".join(authors_list[:6]) + ", et al."
+ else:
+ results_dict['authors_display'] = trait.authors
if trait.pubmed_id:
if for_api:
results_dict['pubmed_id'] = trait.pubmed_id
results_dict['year'] = trait.pubmed_text
else:
- results_dict['pubmed'] = "<a href='" + trait.pubmed_link + "'> " + trait.pubmed_text + "</a>"
+ results_dict['pubmed_link'] = trait.pubmed_link
+ results_dict['pubmed_text'] = trait.pubmed_text
else:
if for_api:
results_dict['pubmed_id'] = "N/A"
results_dict['year'] = "N/A"
else:
- results_dict['pubmed'] = "N/A"
+ results_dict['pubmed_link'] = "N/A"
+ results_dict['pubmed_text'] = "N/A"
results_dict['lrs_score'] = trait.LRS_score_repr
results_dict['lrs_location'] = trait.LRS_location_repr
- if trait.additive != "":
+ if trait.additive and trait.additive != "":
results_dict['additive'] = "%0.3f" % float(trait.additive)
else:
results_dict['additive'] = "N/A"
- if for_api:
- results_dict['sample_r'] = "%0.3f" % trait.sample_r
- else:
- results_dict['sample_r'] = "<a target='_blank' href='corr_scatter_plot?dataset_1=" + str(dataset.name) + "&dataset_2=" + str(trait.dataset.name) + "&trait_1=" + str(this_trait.name) + "&trait_2=" + str(trait.name) + "'>" + "%0.3f" % trait.sample_r + "</a>"
+ results_dict['sample_r'] = "%0.3f" % trait.sample_r
results_dict['num_overlap'] = trait.num_overlap
results_dict['sample_p'] = "%0.3e" % float(trait.sample_p)
else:
results_dict['lrs_location'] = trait.LRS_location_repr
- if for_api:
- results_dict['sample_r'] = "%0.3f" % trait.sample_r
- else:
- results_dict['sample_r'] = "<a target='_blank' href='corr_scatter_plot?dataset_1=" + str(dataset.name) + "&dataset_2=" + str(trait.dataset.name) + "&trait_1=" + str(this_trait.name) + "&trait_2=" + str(trait.name) + "'>" + "%0.3f" % float(trait.sample_r) + "</a>"
+ results_dict['sample_r'] = "%0.3f" % trait.sample_r
results_dict['num_overlap'] = trait.num_overlap
results_dict['sample_p'] = "%0.3e" % float(trait.sample_p)
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index bc0b592c..bb7d3df6 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -2,9 +2,9 @@
{% block title %}Correlation 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="/static/new/css/show_trait.css" />
<link rel="stylesheet" type="text/css" href="{{ url_for('js', filename='DataTablesExtensions/buttonsBootstrap/css/buttons.bootstrap.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="/static/new/css/show_trait.css" />
{% endblock %}
{% block content %}
<div class="container" style="min-width: 1250px;">
@@ -127,77 +127,7 @@
</thead>
<tbody>
- {% for trait in correlation_results %}
- <tr>
- <td><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="padding-right: 0px;" VALUE="{{ data_hmac('{}:{}'.format(trait.name, trait.dataset.name)) }}"></td>
- <td data-export="{{ loop.index }}" style="padding-left: 8px; padding-right: 0px; padding-top: 4px; align: right;">{{ loop.index }}</td>
- <td data-export="{{ trait.name }}">
- <a href="{{ url_for('show_trait_page',
- trait_id = trait.name,
- dataset = trait.dataset.name
- )}}">
- {{ trait.name }}
- </a>
- </td>
- {% if target_dataset.type == 'ProbeSet' %}
- <td data-export="{{ trait.symbol }}">{{ trait.symbol }}</td>
- <td data-export="{{ trait.description_display }}">{{ trait.description_display }}</TD>
- <td data-export="{{ trait.location_repr }}" style="white-space: nowrap;">{{ trait.location_repr }}</td>
- <td data-export="{{ '%0.3f' % trait.mean|float }}" align="right">{{ '%0.3f' % trait.mean|float }}</td>
- <td data-export="{{ '%0.3f'|format(trait.sample_r) }}"" align="right"><a target="_blank" href="corr_scatter_plot?dataset_1={% if dataset.name == 'Temp' %}Temp_{{ dataset.group.name }}{% else %}{{ dataset.name }}{% endif %}&dataset_2={% if trait.dataset.name == 'Temp' %}Temp_{{ trait.dataset.group.name }}{% else %}{{ trait.dataset.name }}{% endif %}&trait_1={{ this_trait.name }}&trait_2={{ trait.name }}">{{ '%0.3f'|format(trait.sample_r) }}</a></td>
- <td data-export="{{ trait.num_overlap }}" align="right">{{ trait.num_overlap }}</td>
- <td data-export="{{ '%0.3e'|format(trait.sample_p) }}" align="right">{{ '%0.3e'|format(trait.sample_p) }}</td>
- {% if trait.lit_corr == "" or trait.lit_corr == 0.000 %}
- <td data-export="--" align="right">--</td>
- {% else %}
- <td data-export="{{ '%0.3f'|format(trait.lit_corr) }}" align="right">{{ '%0.3f'|format(trait.lit_corr) }}</td>
- {% endif %}
- {% if trait.tissue_corr == "" or trait.tissue_corr == 0.000 %}
- <td data-export="--" align="right">--</td>
- <td data-export="--" align="right">--</td>
- {% else %}
- <td data-export="{{ '%0.3f'|format(trait.tissue_corr) }}" align="right">{{ '%0.3f'|format(trait.tissue_corr) }}</td>
- <td data-export="{{ '%0.3e'|format(trait.tissue_pvalue) }}" align="right">{{ '%0.3e'|format(trait.tissue_pvalue) }}</td>
- {% endif %}
- <td data-export={% if trait.LRS_score_repr != "N/A" %}"{{ '%0.1f' % trait.LRS_score_repr|float }}"{% else %}"N/A"{% endif %} align="right">{% if trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td>
- <td data-export="{{ trait.LRS_location_repr }}" align="right">{{ trait.LRS_location_repr }}</td>
- <td data-export={% if trait.additive != "" %}"{{ '%0.3f' % trait.additive|float }}"{% else %}"N/A"{% endif %} align="right">{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %}</td>
- {% elif target_dataset.type == "Publish" %}
- {% if trait.abbreviation %}
- <td title="{{ trait.abbreviation }}" data-export="{{ trait.abbreviation }}">{% if trait.abbreviation|length > 20 %}{{ trait.abbreviation[:20] }}...{% else %}{{ trait.abbreviation }}{% endif %}</td>
- {% else %}
- <td data-export="N/A">N/A</td>
- {% endif %}
- <td data-export="{{ trait.description_display }}">{% if trait.description_display|length > 70 %}{{ trait.description_display[:70] }}...{% else %}{{ trait.description_display }}{% endif %}</td>
- {% if trait.authors %}
- {% set authors_list = trait.authors.split(',') %}
- <td data-export="{{ trait.authors }}">{% if authors_list|length > 6 %}{{ authors_list[:6]|join(', ') }}, et al.{% else %}{{ trait.authors }}{% endif %}</td>
- {% else %}
- <td data-export="N/A">N/A</td>
- {% endif %}
- <td data-export="{{ trait.pubmed_text }}">
- {% if trait.pubmed_text != "N/A" %}
- <a href="{{ trait.pubmed_link }}">
- {{ trait.pubmed_text }}
- </a>
- {% else %}
- {{ trait.pubmed_text }}
- {% endif %}
- </td>
- <td data-export="{{ '%0.3f'|format(trait.sample_r) }}"" align="right"><a target="_blank" href="corr_scatter_plot?dataset_1={% if dataset.name == 'Temp' %}Temp_{{ dataset.group.name }}{% else %}{{ dataset.name }}{% endif %}&dataset_2={{ trait.dataset.name }}&trait_1={{ this_trait.name }}&trait_2={{ trait.name }}">{{ '%0.3f'|format(trait.sample_r) }}</a></td>
- <td data-export="{{ trait.num_overlap }}" align="right">{{ trait.num_overlap }}</td>
- <td data-export="{{ '%0.3e'|format(trait.sample_p) }}" align="right">{{ '%0.3e'|format(trait.sample_p) }}</td>
- <td data-export="{{ trait.LRS_score_repr }}" align="right">{{ trait.LRS_score_repr }}</td>
- <td data-export="{{ trait.LRS_location_repr }}" align="right">{{ trait.LRS_location_repr }}</td>
- <td data-export={% if trait.additive != "" %}"{{ '%0.3f' % trait.additive|float }}"{% else %}"N/A"{% endif %} align="right">{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %}</td>
- {% elif target_dataset.type == "Geno" %}
- <td data-export="{{ trait.location_repr }}" align="right">{{ trait.location_repr }}</TD>
- <td data-export="{{ '%0.3f'|format(trait.sample_r) }}"" align="right"><a target="_blank" href="corr_scatter_plot?dataset_1={% if dataset.name == 'Temp' %}Temp_{{ dataset.group.name }}{% else %}{{ dataset.name }}{% endif %}&dataset_2={{ trait.dataset.name }}&trait_1={{ this_trait.name }}&trait_2={{ trait.name }}">{{ '%0.3f'|format(trait.sample_r) }}</a></td>
- <td data-export="{{ trait.num_overlap }}" align="right">{{ trait.num_overlap }}</td>
- <td data-export="{{ '%0.3e'|format(trait.sample_p) }}" align="right">{{ '%0.3e'|format(trait.sample_p) }}</td>
- {% endif %}
- </tr>
- {% endfor %}
+ <td colspan="100%" align="center"><br><b><font size="15">Loading...</font></b><br></td>
</tbody>
</table>
</div>
@@ -215,6 +145,7 @@
<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='DataTablesExtensions/plugins/sorting/natural.js') }}"></script>
+ <script type="text/javascript" src="https://cdn.datatables.net/scroller/2.0.2/js/dataTables.scroller.min.js"></script>
<script type="text/javascript" charset="utf-8">
var table_json = {{ json_results | safe }}
@@ -329,16 +260,7 @@
console.time("Creating table");
- {% if target_dataset.type == "ProbeSet" %}
table_conf = {
- "drawCallback": function( settings ) {
- $('#trait_table tr').click(function(event) {
- if (event.target.type !== 'checkbox') {
- $(':checkbox', this).trigger('click');
- }
- });
- $('.trait_checkbox:checkbox').on("change", change_buttons);
- },
buttons: [
{
extend: 'columnsToggle',
@@ -352,134 +274,267 @@
postfixButtons: [ 'colvisRestore' ]
}
],
+ "data": table_json,
+ "columns": [
+ {
+ 'data': null,
+ 'width': "25px",
+ 'orderDataType': "dom-checkbox",
+ 'orderSequence': [ "desc", "asc"],
+ 'render': function(data, type, row, meta) {
+ return '<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="' + data.hmac + '">'
+ }
+ },
+ {
+ 'title': "Index",
+ 'type': "natural",
+ 'width': "30px",
+ 'data': "index"
+ },
+ {
+ 'title': "Record",
+ 'type': "natural-minus-na",
+ 'data': null,
+ 'width': "60px",
+ 'render': function(data, type, row, meta) {
+ return '<a target="_blank" href="/show_trait?trait_id=' + data.trait_id + '&dataset=' + data.dataset + '">' + data.trait_id + '</a>'
+ }
+ }{% if target_dataset.type == 'ProbeSet' %},
+ {
+ 'title': "Symbol",
+ 'type': "natural",
+ 'width': "120px",
+ 'data': "symbol"
+ },
+ {
+ 'title': "Description",
+ 'type': "natural",
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ try {
+ return decodeURIComponent(escape(data.description))
+ } catch(err){
+ return escape(data.description)
+ }
+ }
+ },
+ {
+ 'title': "Location",
+ 'type': "natural-minus-na",
+ 'width': "125px",
+ 'data': "location"
+ },
+ {
+ 'title': "Mean",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "mean",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "sample_r",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "N",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "num_overlap",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "sample_p",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Lit {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "lit_corr",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Tissue {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "tissue_corr",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Tissue p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "tissue_pvalue",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "High P<a href=\"http://gn1.genenetwork.org/glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'type': "natural-minus-na",
+ 'data': "lrs_score",
+ 'width': "60px",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Peak Location",
+ 'type': "natural-minus-na",
+ 'width': "125px",
+ 'data': "lrs_location"
+ },
+ {
+ 'title': "Effect Size<a href=\"http://gn1.genenetwork.org/glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'type': "natural-minus-na",
+ 'data': "additive",
+ 'width': "85px",
+ 'orderSequence': [ "desc", "asc"]
+ }{% elif target_dataset.type == 'Publish' %},
+ {
+ 'title': "Abbreviation",
+ 'type': "natural",
+ 'width': "200px",
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ try {
+ return decodeURIComponent(escape(data.abbreviation_display))
+ } catch(err){
+ return data.abbreviation_display
+ }
+ }
+ },
+ {
+ 'title': "Description",
+ 'type': "natural",
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ try {
+ return decodeURIComponent(escape(data.description))
+ } catch(err){
+ return data.description
+ }
+ }
+ },
+ {
+ 'title': "Authors",
+ 'type': "natural",
+ 'width': "400px",
+ 'data': null,
+ 'render': function(data, type, row, meta) {
+ try {
+ return decodeURIComponent(escape(data.authors_display))
+ } catch(err){
+ return data.authors_display
+ }
+ }
+ },
+ {
+ 'title': "Year",
+ 'type': "natural-minus-na",
+ 'data': null,
+ 'width': "80px",
+ 'render': function(data, type, row, meta) {
+ 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': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "sample_r",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "N",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "num_overlap",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "sample_p",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "High P<a href=\"http://gn1.genenetwork.org/glossary.html#LRS\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'type': "natural-minus-na",
+ 'data': "lrs_score",
+ 'width': "60px",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Peak Location",
+ 'type': "natural-minus-na",
+ 'width': "125px",
+ 'data': "lrs_location"
+ },
+ {
+ 'title': "Effect Size<a href=\"http://gn1.genenetwork.org/glossary.html#A\" target=\"_blank\" style=\"color: white;\"><sup style=\"font-size: small; color: #FF0000;\"> ?</sup></a>",
+ 'type': "natural-minus-na",
+ 'data': "additive",
+ 'width': "85px",
+ 'orderSequence': [ "desc", "asc"]
+ }{% elif dataset.type == 'Geno' %},
+ {
+ 'title': "Location",
+ 'type': "natural-minus-na",
+ 'width': "120px",
+ 'data': "location"
+ },
+ {
+ 'title': "Sample {% if corr_method == 'pearson' %}r{% else %}rho{% endif %}",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "sample_r",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "N",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "num_overlap",
+ 'orderSequence': [ "desc", "asc"]
+ },
+ {
+ 'title': "Sample p({% if corr_method == 'pearson' %}r{% else %}rho{% endif %})",
+ 'type': "natural-minus-na",
+ 'width': "40px",
+ 'data': "sample_p",
+ 'orderSequence': [ "desc", "asc"]
+ }{% endif %}
+ ],
"columnDefs": [ {
"targets": 0,
"orderable": false
} ],
- "columns": [
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural", "width": "15%" },
- { "type": "natural" },
- { "type": "natural" },
- { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
- { "type": "natural" },
- { "type": "scientific" },
- { "type": "natural-minus-na", 'orderSequence': [ "desc", "asc"] },
- { "type": "natural-minus-na", 'orderSequence': [ "desc", "asc"] },
- { "type": "scientific" },
- { "type": "natural-minus-na" },
- { "type": "natural-minus-na" },
- { "type": "natural-minus-na" }
- ],
- "createdRow": function ( row, data, index ) {
- $('td', row).eq(4).attr('title', $('td', row).eq(4).text());
- if ($('td', row).eq(4).text().length > 40) {
- $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 40));
- $('td', row).eq(4).text($('td', row).eq(4).text() + '...')
- }
- },
- "order": [[9, "asc" ]],
- "sDom": "Btir",
- "iDisplayLength": -1,
- "autoWidth": false,
- "deferRender": true,
- "bSortClasses": false,
- "paging": false,
- "orderClasses": true
- }
-
- {% elif target_dataset.type == "Publish" %}
- table_conf = {
- "drawCallback": function( settings ) {
- $('#trait_table tr').click(function(event) {
- if (event.target.type !== 'checkbox') {
- $(':checkbox', this).trigger('click');
- }
- });
- $('.trait_checkbox:checkbox').on("change", change_buttons);
- },
- "buttons": [
- {
- extend: 'columnsToggle',
- columns: function( idx, data, node ) {
- if (idx != 0) {
- return true;
- } else {
- return false;
- }
- },
- postfixButtons: [ 'colvisRestore' ]
- }
- ],
- "columnDefs": [
- { "targets": 0, "orderable": false }
- ],
- "columns": [
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural", "width": "20%" },
- { "type": "natural", "width": "12%" },
- { "type": "natural-minus-na" },
- { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
- { "type": "natural" },
- { "type": "scientific" },
- { "type": "natural-minus-na" },
- { "type": "natural-minus-na" },
- { "type": "natural-minus-na" }
- ],
"order": [[9, "asc" ]],
- "sDom": "Btir",
- "iDisplayLength": -1,
- "autoWidth": false,
- "deferRender": true,
+ "sDom": "Bitir",
+ "autoWidth": true,
"bSortClasses": false,
- "paging": false,
- "orderClasses": true,
+ "scrollY": "50vh",
+ "scroller": true,
+ "scrollCollapse": true
}
- {% elif target_dataset.type == "Geno" %}
- table_conf = {
- "paging": false,
- buttons: [
- {
- extend: 'columnsToggle',
- columns: function( idx, data, node ) {
- if (idx != 0) {
- return true;
- } else {
- return false;
- }
- },
- postfixButtons: [ 'colvisRestore' ]
- }
- ],
- "columnDefs": [
- { "targets": 0, "orderable": false }
- ],
- "columns": [
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
- { "type": "natural-minus-na" },
- { "type": "scientific" }
- ],
- "order": [[6, "asc" ]],
- "sDom": "Btir",
- "autoWidth": false,
- "bDeferRender": true,
- "scrollY": "800px",
- "scrollCollapse": false
- }
- {% endif %}
the_table = $('#trait_table').DataTable(table_conf);
+ the_table.on( 'order.dt search.dt draw.dt', function () {
+ the_table.column(1, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
+ cell.innerHTML = i+1;
+ } );
+ } ).draw();
+
console.timeEnd("Creating table");
submit_special = function(url) {