aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2016-03-23 22:26:27 +0000
committerzsloan2016-03-23 22:26:27 +0000
commit04d0803abc543df0afc50d7a1bcafe797cb1bf67 (patch)
tree53f6e93966062d55814c6a5d7d58b63063d661b3
parent8e1a2728980c4f223a6ff8362b365d6d20010cd3 (diff)
downloadgenenetwork2-04d0803abc543df0afc50d7a1bcafe797cb1bf67.tar.gz
You can now select chromosome and an Mb range from the top menu and remap
The track in the single chromosome view to zoom into smaller intervals now works correctly again
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py12
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py16
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html22
-rw-r--r--wqflask/wqflask/views.py1
4 files changed, 33 insertions, 18 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 7adc0a2e..09dd7852 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -82,11 +82,15 @@ class MarkerRegression(object):
self.num_perm = 0
#ZS: This is passed to GN1 code for single chr mapping
- self.selected_chr = -1
+ self.selected_chr = -1
+ #if "chromosomes" in start_vars:
+ # self.selected_chr = int(start_vars['chromosomes']) + 1
if "selected_chr" in start_vars:
- self.selected_chr = int(start_vars['selected_chr'])
- if "mb_range" in start_vars:
- self.mb_range = start_vars['mb_range']
+ self.selected_chr = int(start_vars['selected_chr']) + 1
+ if "startMb" in start_vars:
+ self.startMb = start_vars['startMb']
+ if "endMb" in start_vars:
+ self.endMb = start_vars['endMb']
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 37e67d71..bb8f7b11 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -297,13 +297,13 @@ class MarkerRegression(object):
self.SNPChecked = False
self.draw2X = False
self.lrsMax = 0
- if 'startMb' in start_vars:
- self.startMb = start_vars['startMb']
- else:
+ try:
+ self.startMb = float(start_vars['startMb'])
+ except:
self.startMb = -1
- if 'endMb' in start_vars:
- self.endMb = start_vars['endMb']
- else:
+ try:
+ self.endMb = float(start_vars['endMb'])
+ except:
self.endMb = -1
#self.additiveChecked = fd.formdata.getvalue('additiveCheck')
@@ -487,7 +487,7 @@ class MarkerRegression(object):
#StartMb or EndMb
if self.startMb < 0 or self.endMb < 0:
self.startMb = 0
- self.endMb = self.ChrLengthMbList[self.selectedChr]
+ self.endMb = self.ChrLengthMbList[self.selectedChr - 1]
geneTable = ""
@@ -1605,7 +1605,7 @@ class MarkerRegression(object):
WEBQTL_COORDS = "%d, %d, %d, %d" % (xBrowse1, paddingTop, xBrowse2, (paddingTop+self.WEBQTL_BAND_HEIGHT))
bandWidth = xBrowse2 - xBrowse1
- WEBQTL_HREF = "javascript:rangeView('%s', %f, %f)" % (self.selectedChr, max(0, (calBase-webqtlZoomWidth))/1000000.0, (calBase+webqtlZoomWidth)/1000000.0)
+ WEBQTL_HREF = "javascript:rangeView('%s', %f, %f)" % (self.selectedChr - 1, max(0, (calBase-webqtlZoomWidth))/1000000.0, (calBase+webqtlZoomWidth)/1000000.0)
WEBQTL_TITLE = "Click to view this section of the genome in WebQTL"
gifmap.areas.append(HT.Area(shape='rect',coords=WEBQTL_COORDS,href=WEBQTL_HREF, title=WEBQTL_TITLE))
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index 11989ae7..767befd8 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -20,7 +20,6 @@
{% endfor %}
<input type="hidden" name="maf">
<input type="hidden" name="selected_chr" value="{{ selectedChr }}">
- <input type="hidden" name="mb_range" value="{{ startMb|string + "," + endMb|string }}">
<input type="hidden" name="manhattan_plot">
<input type="hidden" name="num_perm">
<input type="hidden" name="do_control" value="{{ doControl }}">
@@ -41,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-7" style="padding-left: 0px;">
+ <div class="col-xs-9" style="padding-left: 0px;">
<table>
<tr>
<td><b>Chr:&nbsp;</b></td>
@@ -51,13 +50,19 @@
<option value="{{ chr[1] }}">{{ chr[0] }}</option>
{% endfor %}
</select>&nbsp;
- <button type="button" class="btn btn-primary">Remap</button>
+ <button type="button" class="btn btn-primary" style="padding-bottom: 2px; padding-top: 2px;" onclick="javascript:remap();">Remap</button>
</td>
</tr>
<tr>
<td><b>View:&nbsp;</b></td>
<td>
- <input type="text" name="startMb"
+ <input type="text" name="startMb" size="10"> to <input type="text" name="endMb" size="10">
+ </td>
+ </tr>
+ <tr>
+ <td><b>Width:&nbsp;</b></td>
+ <td>
+ <input type="text" name="graphWidth" value="1600" size="5">
</td>
</tr>
</table>
@@ -213,10 +218,10 @@
$('div#gn1_map_options').show();
});
- });
+ });
chrView = function(this_chr, chr_mb_list) {
- $('input[name=selected_chr]').val(this_chr + 1)
+ $('input[name=selected_chr]').val(this_chr)
$('input[name=chr_mb_list]').val(chr_mb_list)
return $('#marker_regression_form').submit();
@@ -231,6 +236,11 @@
return $('#marker_regression_form').submit();
};
+ remap = function() {
+ $('input[name=selected_chr]').val($('select[name=chromosomes]').val());
+ return $('#marker_regression_form').submit();
+ };
+
</script>
{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 6f53a950..b5b6fa82 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -343,6 +343,7 @@ def marker_regression_page():
'method',
'trimmed_markers',
'selected_chr',
+ 'chromosomes',
'mapping_scale',
'score_type',
'suggestive',