aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2016-03-28 17:37:28 +0000
committerzsloan2016-03-28 17:37:28 +0000
commita871ca20194acb9e367c817bdbd5fb3863f27a1b (patch)
tree8a4d4d43941a524bc0eef1509dfcf74c0799e79a
parentbd3b9516abcad0c368d8f9e1de161030e26c5f8a (diff)
downloadgenenetwork2-a871ca20194acb9e367c817bdbd5fb3863f27a1b.tar.gz
Legend option now works for GN1 mapping figure
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py7
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py17
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html9
-rw-r--r--wqflask/wqflask/views.py1
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 %}
</div>
<div id="gn1_map_options" class="col-xs-5" style="border:2px solid black; padding: 10px; margin: 10px;">
- <div class="col-xs-8" style="padding-left: 0px;">
+ <div class="col-xs-8" style="padding: 0px;">
<table>
<tr>
<td><b>Chr:&nbsp;</b></td>
@@ -55,7 +55,7 @@
</tr>
<tr>
<td><b>View:&nbsp;</b></td>
- <td>
+ <td style="padding: 5px;">
<input type="text" name="startMb" size="10"> to <input type="text" name="endMb" size="10">
</td>
</tr>
@@ -67,8 +67,9 @@
</tr>
</table>
</div>
- <div class="col-xs-4">
- <input type="checkbox" name="showGenes" class="checkbox" style="display: inline;" {% if geneChecked|upper == "ON" %}value="ON" checked{% endif %}> <span>Gene Track </span> <span style="color:red;">*</span>
+ <div class="col-xs-4" style="padding: 0px;">
+ <input type="checkbox" name="showGenes" class="checkbox" style="display: inline; margin-top: 0px;" {% if geneChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Gene Track </span> <span style="color:red;">*</span><br>
+ <input type="checkbox" name="viewLegend" class="checkbox" style="display: inline; margin-top: 0px;" {% if legendChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Legend </span>
</div>
</div>
</div>
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'
)