From a871ca20194acb9e367c817bdbd5fb3863f27a1b Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Mar 2016 17:37:28 +0000 Subject: Legend option now works for GN1 mapping figure --- wqflask/wqflask/marker_regression/marker_regression.py | 7 ++++++- .../wqflask/marker_regression/marker_regression_gn1.py | 17 ++++++++++------- wqflask/wqflask/templates/marker_regression_gn1.html | 9 +++++---- wqflask/wqflask/views.py | 1 + 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 43c99744..745cdfaa 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -94,13 +94,18 @@ class MarkerRegression(object): self.endMb = start_vars['endMb'] if "graphWidth" in start_vars: self.graphWidth = start_vars['graphWidth'] - if "startMb" in start_vars: #ZS: This is to ensure showGenes is checked the first time you open the mapping page, since startMb will only not be set during the first load + if "startMb" in start_vars: #ZS: This is to ensure showGenes, Legend, etc are checked the first time you open the mapping page, since startMb will only not be set during the first load if "showGenes" in start_vars: self.showGenes = start_vars['showGenes'] else: self.showGenes = False + if "viewLegend" in start_vars: + self.viewLegend = start_vars['viewLegend'] + else: + self.viewLegend = False else: self.showGenes = "ON" + self.viewLegend = "ON" self.dataset.group.get_markers() if self.mapping_method == "gemma": diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index b338d8ea..0a4846fe 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -282,7 +282,10 @@ class MarkerRegression(object): self.LRS_LOD = start_vars['score_type'] self.cutoff = start_vars['cutoff'] self.intervalAnalystChecked = False - self.legendChecked = False + if 'viewLegend' in start_vars.keys(): + self.legendChecked = start_vars['viewLegend'] + else: + self.legendChecked = False if 'showGenes' in start_vars.keys(): self.geneChecked = start_vars['showGenes'] else: @@ -805,7 +808,7 @@ class MarkerRegression(object): if self.multipleInterval: self.drawMultiTraitName(fd, canvas, gifmap, showLocusForm, offset=newoffset) elif self.legendChecked: - self.drawLegendPanel(fd, canvas, offset=newoffset, zoom = zoom) + self.drawLegendPanel(canvas, offset=newoffset, zoom = zoom) else: pass @@ -1063,7 +1066,7 @@ class MarkerRegression(object): gifmap.areas.append(Areas) - def drawLegendPanel(self, fd, canvas, offset= (40, 120, 80, 10), zoom = 1, locLocation= None): + def drawLegendPanel(self, canvas, offset= (40, 120, 80, 10), zoom = 1, locLocation= None): xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset plotWidth = canvas.size[0] - xLeftOffset - xRightOffset plotHeight = canvas.size[1] - yTopOffset - yBottomOffset @@ -1118,16 +1121,16 @@ class MarkerRegression(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' % fd.RISet + string1 = 'Mapping for Dataset: %s, mapping on All Chromosomes' % self.dataset.group.name else: - string1 = 'Mapping for Dataset: %s, mapping on Chromosome %s' % (fd.RISet,self.genotype[0].name) + string1 = 'Mapping for Dataset: %s, mapping on Chromosome %s' % (self.dataset.group.name, self.selectedChr) if self.controlLocus: string2 = 'Using %s as control' % self.controlLocus else: string2 = 'Using Haldane mapping function with no control for other QTLs' d = 4+ max(canvas.stringWidth(string1,font=labelFont),canvas.stringWidth(string2,font=labelFont)) - if fd.identification: - identification = "Trait ID: %s" % fd.identification + if self.this_trait.name: + identification = "Trait ID: %s : %s" % (self.dataset.fullname, self.this_trait.name) canvas.drawString(identification,canvas.size[0] - xRightOffset-d,20*fontZoom,font=labelFont,color=labelColor) canvas.drawString(string1,canvas.size[0] - xRightOffset-d,35*fontZoom,font=labelFont,color=labelColor) diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index 097cc873..ab75d5e3 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -40,7 +40,7 @@ {% endif %}
-
+
@@ -55,7 +55,7 @@ - @@ -67,8 +67,9 @@
Chr: 
View:  + to
-
- Gene Track * +
+ Gene Track *
+ Legend
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index d3db044d..f1b55b51 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -358,6 +358,7 @@ def marker_regression_page(): 'endMb', 'graphWidth', 'showGenes', + 'viewLegend', 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno' ) -- cgit v1.2.3