aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py9
-rw-r--r--wqflask/wqflask/templates/gsearch_gene.html35
-rw-r--r--wqflask/wqflask/templates/gsearch_pheno.html35
-rw-r--r--wqflask/wqflask/templates/search_result_page.html4
-rw-r--r--wqflask/wqflask/templates/show_trait.html2
5 files changed, 80 insertions, 5 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 5c349bf3..1dd80962 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -278,7 +278,12 @@ class ShowTrait(object):
FROM GeneList
WHERE geneSymbol = '{}'""".format(self.this_trait.symbol)
- chr, transcript_start, transcript_end = g.db.execute(query).fetchall()[0] if len(g.db.execute(query).fetchall()) > 0 else None
+ results = g.db.execute(query).fetchone()
+ if results:
+ chr, transcript_start, transcript_end = results
+ else:
+ chr = transcript_start = transcript_end = None
+
if chr and transcript_start and transcript_end and self.this_trait.refseq_transcriptid:
transcript_start = int(transcript_start*1000000)
transcript_end = int(transcript_end*1000000)
@@ -292,7 +297,7 @@ class ShowTrait(object):
WHERE geneSymbol = '{}'""".format(self.this_trait.symbol)
results = g.db.execute(query).fetchone()
- if results:
+ if results:
kgId, chr, transcript_start, transcript_end = results
else:
kgId = chr = transcript_start = transcript_end = None
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index 9b584ea5..0ee98972 100644
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -78,8 +78,43 @@
}
});
+ function change_buttons() {
+ buttons = ["#add", "#remove"];
+ num_checked = $('.trait_checkbox:checked').length;
+ if (num_checked === 0) {
+ for (_i = 0, _len = buttons.length; _i < _len; _i++) {
+ button = buttons[_i];
+ $(button).prop("disabled", true);
+ }
+ } else {
+ for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) {
+ button = buttons[_j];
+ $(button).prop("disabled", false);
+ }
+ }
+ //});
+ if ($(this).is(":checked")) {
+ if (!$(this).closest('tr').hasClass('selected')) {
+ $(this).closest('tr').addClass('selected')
+ }
+ }
+ else {
+ if ($(this).closest('tr').hasClass('selected')) {
+ $(this).closest('tr').removeClass('selected')
+ }
+ }
+ }
+
console.time("Creating table");
$('#trait_table').DataTable( {
+ 'drawCallback': function( settings ) {
+ $('#trait_table tr').click(function(event) {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
+ $(':checkbox', this).trigger('click');
+ }
+ });
+ $('.trait_checkbox:checkbox').on("change", change_buttons);
+ },
'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");
diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html
index 609c1852..4e142846 100644
--- a/wqflask/wqflask/templates/gsearch_pheno.html
+++ b/wqflask/wqflask/templates/gsearch_pheno.html
@@ -78,8 +78,43 @@
}
});
+ function change_buttons() {
+ buttons = ["#add", "#remove"];
+ num_checked = $('.trait_checkbox:checked').length;
+ if (num_checked === 0) {
+ for (_i = 0, _len = buttons.length; _i < _len; _i++) {
+ button = buttons[_i];
+ $(button).prop("disabled", true);
+ }
+ } else {
+ for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) {
+ button = buttons[_j];
+ $(button).prop("disabled", false);
+ }
+ }
+ //});
+ if ($(this).is(":checked")) {
+ if (!$(this).closest('tr').hasClass('selected')) {
+ $(this).closest('tr').addClass('selected')
+ }
+ }
+ else {
+ if ($(this).closest('tr').hasClass('selected')) {
+ $(this).closest('tr').removeClass('selected')
+ }
+ }
+ }
+
console.time("Creating table");
$('#trait_table').DataTable( {
+ 'drawCallback': function( settings ) {
+ $('#trait_table tr').click(function(event) {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
+ $(':checkbox', this).trigger('click');
+ }
+ });
+ $('.trait_checkbox:checkbox').on("change", change_buttons);
+ },
"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");
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index d1bfbd23..b1442b7f 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -205,7 +205,7 @@
$('#trait_table').DataTable( {
'drawCallback': function( settings ) {
$('#trait_table tr').click(function(event) {
- if (event.target.type !== 'checkbox') {
+ if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') {
$(':checkbox', this).trigger('click');
}
});
@@ -398,7 +398,7 @@
postfixButtons: [ 'colvisRestore' ]
}
],
- 'sDom': "Btir",
+ 'sDom': "Bitir",
'autoWidth': false,
'deferRender': true,
'paging': false,
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index d5473bca..ea7c5123 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -296,7 +296,7 @@
if (data.value == null) {
return '<input type="text" data-value="x" data-qnorm="x" data-zscore="x" name="value:' + data.name + '" style="text-align: right;" class="trait_value_input edit_sample_value" value="x" size=6 maxlength=6>'
} else {
- return '<input type="text" data-value="' + data.value.toFixed(3) + '" data-qnorm="' + js_data['qnorm_values'][0][parseInt(data.this_id)] + '" data-zscore="' + js_data['zscore_values'][0][parseInt(data.this_id)] + '" name="value:' + data.name + '" style="text-align: right;" class="trait_value_input edit_sample_value" value="' + data.value.toFixed(3) + '" size=6 maxlength=6>'
+ return '<input type="text" data-value="' + data.value.toFixed(3) + '" data-qnorm="' + js_data['qnorm_values'][0][parseInt(data.this_id) - 1] + '" data-zscore="' + js_data['zscore_values'][0][parseInt(data.this_id) - 1] + '" name="value:' + data.name + '" style="text-align: right;" class="trait_value_input edit_sample_value" value="' + data.value.toFixed(3) + '" size=6 maxlength=6>'
}
}
}{% if sample_groups[0].se_exists() %},