aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py67
-rw-r--r--wqflask/wqflask/templates/correlation_page.html56
-rw-r--r--wqflask/wqflask/views.py7
3 files changed, 70 insertions, 60 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index fa20e8ad..2d0ed1d7 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -24,7 +24,7 @@
#
# Last updated by Zach 12/14/2010
-import time
+import datetime
import string
from math import *
import piddle as pid
@@ -146,6 +146,7 @@ class DisplayMappingResults(object):
self.dataset = start_vars['dataset']
self.this_trait = start_vars['this_trait']
+ self.n_samples = len(start_vars['vals'])
self.species = start_vars['species']
if 'genofile_string' in start_vars:
self.genofile_string = start_vars['genofile_string']
@@ -474,10 +475,10 @@ class DisplayMappingResults(object):
#calculating margins
xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset
if self.multipleInterval:
- yTopOffset = max(80, yTopOffset)
+ yTopOffset = max(90, yTopOffset)
else:
if self.legendChecked:
- yTopOffset = max(80, yTopOffset)
+ yTopOffset = max(90, yTopOffset)
else:
pass
@@ -879,52 +880,68 @@ class DisplayMappingResults(object):
labelFont = pid.Font(ttf="verdana",size=12*fontZoom)
labelColor = pid.black
- if self.selectedChr == -1:
- string1 = 'Mapping for Dataset: %s, mapping on All Chromosomes' % self.dataset.group.name
+ if self.dataset.type == "Publish" or self.dataset.type == "Geno":
+ dataset_label = self.dataset.fullname
else:
- string1 = 'Mapping for Dataset: %s, mapping on Chromosome %s' % (self.dataset.group.name, self.ChrList[self.selectedChr][0])
+ dataset_label = "%s - %s" % (self.dataset.group.name, self.dataset.fullname)
- string3 = ''
+ string1 = 'Dataset: %s' % (dataset_label)
+
+ string2 = 'Using Genotype File: %s' % self.genofile_string
+
+ string4 = ''
if self.mapping_method == "gemma" or self.mapping_method == "gemma_bimbam":
if self.use_loco == "True":
- string2 = 'Using GEMMA mapping method with LOCO and '
+ string3 = 'Using GEMMA mapping method with LOCO and '
else:
- string2 = 'Using GEMMA mapping method with '
+ string3 = 'Using GEMMA mapping method with '
if self.covariates != "":
- string2 += 'the cofactors below:'
+ string3 += 'the cofactors below:'
cofactor_names = ", ".join([covar.split(":")[0] for covar in self.covariates.split(",")])
- string3 = cofactor_names
+ string4 = cofactor_names
else:
- string2 += 'no cofactors'
+ string3 += 'no cofactors'
elif self.mapping_method == "rqtl_plink" or self.mapping_method == "rqtl_geno":
- string2 = 'Using R/qtl mapping method with '
+ string3 = 'Using R/qtl mapping method with '
if self.controlLocus and self.doControl != "false":
- string2 += '%s as control' % self.controlLocus
+ string3 += '%s as control' % self.controlLocus
else:
- string2 += 'no control for other QTLs'
- elif self.mapping_method == "plink":
- string2 = 'Using PLINK mapping method with no control for other QTLs'
+ string3 += 'no control for other QTLs'
else:
- string2 = 'Using Haldane mapping function with '
+ string3 = 'Using Haldane mapping function with '
if self.controlLocus and self.doControl != "false":
- string2 += '%s as control' % self.controlLocus
+ string3 += '%s as control' % self.controlLocus
else:
- string2 += 'no control for other QTLs'
+ string3 += 'no control for other QTLs'
if self.this_trait.name:
+ if self.selectedChr == -1:
+ identification = "Mapping on All Chromosomes for "
+ else:
+ identification = "Mapping on Chromosome %s for " % (self.ChrList[self.selectedChr][0])
+
if self.this_trait.symbol:
- identification = "Trait ID: %s : %s : %s" % (self.this_trait.symbol, self.dataset.fullname, self.this_trait.name)
+ identification += "Trait: %s - %s" % (self.this_trait.name, self.this_trait.symbol)
+ elif self.this_trait.post_publication_abbreviation:
+ identification += "Trait: %s - %s" % (self.this_trait.name, self.this_trait.post_publication_abbreviation)
+ elif self.this_trait.pre_publication_abbreviation:
+ identification += "Trait: %s - %s" % (self.this_trait.name, self.this_trait.pre_publication_abbreviation)
else:
- identification = "Trait ID: %s : %s" % (self.dataset.fullname, self.this_trait.name)
+ identification += "Trait: %s" % (self.this_trait.name)
+ identification += " with %s samples" % (self.n_samples)
+
d = 4+ max(canvas.stringWidth(identification, font=labelFont), canvas.stringWidth(string1, font=labelFont), canvas.stringWidth(string2, font=labelFont))
canvas.drawString(identification,canvas.size[0] - xRightOffset-d,20*fontZoom,font=labelFont,color=labelColor)
else:
d = 4+ max(canvas.stringWidth(string1, font=labelFont), canvas.stringWidth(string2, font=labelFont))
canvas.drawString(string1,canvas.size[0] - xRightOffset-d,35*fontZoom,font=labelFont,color=labelColor)
canvas.drawString(string2,canvas.size[0] - xRightOffset-d,50*fontZoom,font=labelFont,color=labelColor)
- if string3 != '':
- canvas.drawString(string3,canvas.size[0] - xRightOffset-d,65*fontZoom,font=labelFont,color=labelColor)
-
+ canvas.drawString(string3,canvas.size[0] - xRightOffset-d,65*fontZoom,font=labelFont,color=labelColor)
+ if string4 != '':
+ canvas.drawString(string4,canvas.size[0] - xRightOffset-d,80*fontZoom,font=labelFont,color=labelColor)
+ canvas.drawString("Created at: " + str(datetime.datetime.now()).split('.')[0], canvas.size[0] - xRightOffset-d,95*fontZoom,font=labelFont,color=labelColor)
+ else:
+ canvas.drawString("Created at: " + str(datetime.datetime.now()).split('.')[0], canvas.size[0] - xRightOffset-d,80*fontZoom,font=labelFont,color=labelColor)
def drawGeneBand(self, canvas, gifmap, plotXScale, offset= (40, 120, 80, 10), zoom = 1, startMb = None, endMb = None):
if self.plotScale != 'physic' or self.selectedChr == -1 or not self.geneCol:
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index 76513c82..2b5a7f33 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -229,42 +229,36 @@
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script>
<script type="text/javascript" charset="utf-8">
- jQuery.fn.dataTableExt.oSort['numeric-html-asc'] = function(a,b) {
- a = Math.abs(parseFloat($(a).text()));
- b = Math.abs(parseFloat($(b).text()));
+ var table_json = {{ json_results | safe }}
+ </script>
+
+ <script type="text/javascript" charset="utf-8">
+
+ $.fn.dataTable.ext.order['dom-innertext'] = function (settings, col) {
+ return this.api().column(col, { order: 'index' }).nodes().map(function (td, i) {
+ return Math.abs(parseFloat($('a', td).text()));
+ });
+ }
+
+ $.fn.dataTableExt.oSort['numeric-html-asc'] = function(a,b) {
+ a = Math.abs(parseFloat(a));
+ b = Math.abs(parseFloat(b));
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
};
- jQuery.fn.dataTableExt.oSort['numeric-html-desc'] = function(a,b) {
- a = Math.abs(parseFloat($(a).text()));
- b = Math.abs(parseFloat($(b).text()));
+ $.fn.dataTableExt.oSort['numeric-html-desc'] = function(a,b) {
+ a = Math.abs(parseFloat(a));
+ b = Math.abs(parseFloat(b));
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
};
- jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) {
- if (a == 'N/A' || a == '') {
- return 1;
- }
- else if (b == 'N/A' || b == '') {
- return -1;
- }
- else {
- return ((a < b) ? -1 : ((a > b) ? 1 : 0));
- }
- };
-
- jQuery.fn.dataTableExt.oSort['cust-txt-desc'] = function (a, b) {
- return ((a < b) ? 1 : ((a > b) ? -1 : 0));
- };
-
-
- jQuery.fn.dataTableExt.oSort['scientific-asc'] = function ( a, b ) {
+ $.fn.dataTableExt.oSort['scientific-asc'] = function ( a, b ) {
var x = parseFloat(a);
var y = parseFloat(b);
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
- jQuery.fn.dataTableExt.oSort['scientific-desc'] = function ( a, b ) {
+ $.fn.dataTableExt.oSort['scientific-desc'] = function ( a, b ) {
var x = parseFloat(a);
var y = parseFloat(b);
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
@@ -272,8 +266,6 @@
$(document).ready( function () {
-
- var table_json = {{ json_results | safe }}
$('#trait_table tr').click(function(event) {
if (event.target.type !== 'checkbox') {
@@ -346,11 +338,11 @@
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
- { "type": "natural" },
+ { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
{ "type": "natural" },
{ "type": "scientific" },
- { "type": "natural" },
- { "type": "natural" },
+ { "type": "numeric-html", 'orderSequence': [ "desc", "asc"] },
+ { "type": "numeric-html", 'orderSequence': [ "desc", "asc"] },
{ "type": "scientific" }
],
"createdRow": function ( row, data, index ) {
@@ -402,7 +394,7 @@
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
- { "type": "numeric-html" },
+ { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
{ "type": "natural" },
{ "type": "scientific" }
],
@@ -447,7 +439,7 @@
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
- { "type": "numeric-html" },
+ { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] },
{ "type": "natural" },
{ "type": "scientific" }
],
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 0b0871b1..3aea2541 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -615,6 +615,9 @@ def mapping_results_page():
wanted = (
'trait_id',
'dataset',
+ 'group',
+ 'species',
+ 'vals',
'geno_db_exists',
'method',
'mapping_results_path',
@@ -654,9 +657,7 @@ def mapping_results_page():
'haplotypeAnalystCheck',
'mapmethod_rqtl_geno',
'mapmodel_rqtl_geno',
- 'temp_trait',
- 'group',
- 'species'
+ 'temp_trait'
)
start_vars = {}
for key, value in initial_start_vars.iteritems():