aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask
diff options
context:
space:
mode:
authorzsloan2016-03-15 17:07:28 +0000
committerzsloan2016-03-15 17:07:28 +0000
commitae98a066a0937295543c7c57095c2a7b0c855ecd (patch)
treeeea19be5c31a98ffed9047d4ee0873ca268b8968 /wqflask/wqflask
parent98293e5a4b68565bc0a26240d111f55c60907006 (diff)
downloadgenenetwork2-ae98a066a0937295543c7c57095c2a7b0c855ecd.tar.gz
Fixed the mapping figure track that lets you zoom into a smaller range
Fixed the third party mapping figure tracks to refer to the correct chromosome (before it was always 1)
Diffstat (limited to 'wqflask/wqflask')
-rwxr-xr-xwqflask/wqflask/marker_regression/marker_regression.py2
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py22
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html10
-rwxr-xr-xwqflask/wqflask/views.py1
4 files changed, 26 insertions, 9 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index a6fa5274..37f9351d 100755
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -84,6 +84,8 @@ class MarkerRegression(object):
self.selected_chr = -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.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 a7b5fad3..56286ee6 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -295,8 +295,11 @@ class MarkerRegression(object):
self.SNPChecked = False
self.draw2X = False
self.lrsMax = 0
- self.startMb = -1
- self.endMb = -1
+ if 'mb_range' in start_vars:
+ self.startMb, self.endMb = [float(x) for x in start_vars['mb_range'].split(',')]
+ else:
+ self.startMb = -1
+ self.endMb = -1
#self.additiveChecked = fd.formdata.getvalue('additiveCheck')
#self.dominanceChecked = fd.formdata.getvalue('dominanceCheck')
@@ -1597,7 +1600,7 @@ class MarkerRegression(object):
WEBQTL_COORDS = "%d, %d, %d, %d" % (xBrowse1, paddingTop, xBrowse2, (paddingTop+self.WEBQTL_BAND_HEIGHT))
bandWidth = xBrowse2 - xBrowse1
- WEBQTL_HREF = "javascript:centerIntervalMapOnRange2('%s', %f, %f, document.changeViewForm)" % (currentChromosome, max(0, (calBase-webqtlZoomWidth))/1000000.0, (calBase+webqtlZoomWidth)/1000000.0)
+ WEBQTL_HREF = "javascript:rangeView('%s', %f, %f)" % (self.selectedChr, 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))
@@ -1606,9 +1609,9 @@ class MarkerRegression(object):
UCSC_COORDS = "%d, %d, %d, %d" %(xBrowse1, ucscPaddingTop, xBrowse2, (ucscPaddingTop+self.UCSC_BAND_HEIGHT))
if self.species == "mouse":
- UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d&hgt.customText=%s/snp/chr%s" % (self._ucscDb, currentChromosome, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases, webqtlConfig.PORTADDR, currentChromosome)
+ UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d&hgt.customText=%s/snp/chr%s" % (self._ucscDb, self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases, webqtlConfig.PORTADDR, self.selectedChr)
else:
- UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d" % (self._ucscDb, currentChromosome, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
+ UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d" % (self._ucscDb, self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
UCSC_TITLE = "Click to view this section of the genome in the UCSC Genome Browser"
gifmap.areas.append(HT.Area(shape='rect',coords=UCSC_COORDS,href=UCSC_HREF, title=UCSC_TITLE))
canvas.drawRect(xBrowse1, ucscPaddingTop, xBrowse2, (ucscPaddingTop+self.UCSC_BAND_HEIGHT), edgeColor=self.CLICKABLE_UCSC_REGION_COLOR, fillColor=self.CLICKABLE_UCSC_REGION_COLOR)
@@ -1616,9 +1619,9 @@ class MarkerRegression(object):
ENSEMBL_COORDS = "%d, %d, %d, %d" %(xBrowse1, ensemblPaddingTop, xBrowse2, (ensemblPaddingTop+self.ENSEMBL_BAND_HEIGHT))
if self.species == "mouse":
- ENSEMBL_HREF = "http://www.ensembl.org/Mus_musculus/contigview?highlight=&chr=%s&vc_start=%d&vc_end=%d&x=35&y=12" % (currentChromosome, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
+ ENSEMBL_HREF = "http://www.ensembl.org/Mus_musculus/contigview?highlight=&chr=%s&vc_start=%d&vc_end=%d&x=35&y=12" % (self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
else:
- ENSEMBL_HREF = "http://www.ensembl.org/Rattus_norvegicus/contigview?chr=%s&start=%d&end=%d" % (currentChromosome, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
+ ENSEMBL_HREF = "http://www.ensembl.org/Rattus_norvegicus/contigview?chr=%s&start=%d&end=%d" % (self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
ENSEMBL_TITLE = "Click to view this section of the genome in the Ensembl Genome Browser"
gifmap.areas.append(HT.Area(shape='rect',coords=ENSEMBL_COORDS,href=ENSEMBL_HREF, title=ENSEMBL_TITLE))
canvas.drawRect(xBrowse1, ensemblPaddingTop, xBrowse2, (ensemblPaddingTop+self.ENSEMBL_BAND_HEIGHT), edgeColor=self.CLICKABLE_ENSEMBL_REGION_COLOR, fillColor=self.CLICKABLE_ENSEMBL_REGION_COLOR)
@@ -1632,7 +1635,7 @@ class MarkerRegression(object):
#draw the gray text
chrFont = pid.Font(ttf="verdana", size=26*zoom, bold=1)
traitFont = pid.Font(ttf="verdana", size=14, bold=0)
- chrX = xLeftOffset + plotWidth - 2 - canvas.stringWidth("Chr %s" % currentChromosome, font=chrFont)
+ chrX = xLeftOffset + plotWidth - 2 - canvas.stringWidth("Chr %s" % self.selectedChr, font=chrFont)
canvas.drawString("Chr %s" % currentChromosome, chrX, ensemblPaddingTop-5, font=chrFont, color=pid.gray)
traitX = chrX - 28 - canvas.stringWidth("database", font=traitFont)
# end of drawBrowserClickableRegions
@@ -2752,7 +2755,8 @@ class MarkerRegression(object):
geneSymbolNCBI = theGO["GeneSymbol"]
geneLength = (float(theGO["TxEnd"]) - float(theGO["TxStart"]))
- geneLengthURL = "javascript:centerIntervalMapOnRange2('%s', %f, %f, document.changeViewForm)" % (theGO["Chromosome"], float(theGO["TxStart"])-(geneLength*0.1), float(theGO["TxEnd"])+(geneLength*0.1))
+ #geneLengthURL = "javascript:centerIntervalMapOnRange2('%s', %f, %f, document.changeViewForm)" % (theGO["Chromosome"], float(theGO["TxStart"])-(geneLength*0.1), float(theGO["TxEnd"])+(geneLength*0.1))
+ geneLengthURL = "javascript:rangeView('%s', %f, %f)" % (theGO["Chromosome"], float(theGO["TxStart"])-(geneLength*0.1), float(theGO["TxEnd"])+(geneLength*0.1))
avgExprVal = []
if avgExprVal != "" and avgExprVal:
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index 9f7dd41f..dd8ae236 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -20,6 +20,7 @@
<input type="hidden" name="maf">
<input type="hidden" name="method" value="{{ mapping_method }}">
<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 }}">
@@ -145,6 +146,15 @@
return $('#marker_regression_form').submit();
};
+ rangeView = function(this_chr, start_mb, end_mb) {
+ $('input[name=selected_chr]').val(this_chr)
+ $('input[name=mb_range]').val(start_mb + "," + end_mb)
+
+ console.log("mb_range:", $('input[name=mb_range]').val())
+
+ return $('#marker_regression_form').submit();
+ };
+
</script>
{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index b42e0d4c..65b6dae4 100755
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -352,6 +352,7 @@ def marker_regression_page():
'control_marker_db',
'do_control',
'pair_scan',
+ 'mb_range',
'mapmethod_rqtl_geno',
'mapmodel_rqtl_geno'
)