From ae5fabd349fec05df31e7f8afba8d05d5bad2872 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 14 Dec 2015 23:58:06 +0000 Subject: GN1 mapping full genome figure now correct for pylmm and output to web page --- .gitignore | 2 +- wqflask/base/webqtlConfig.py | 2 +- .../marker_regression/marker_regression_gn1.py | 56 ++-- .../wqflask/templates/marker_regression_gn1.html | 295 +++++++-------------- wqflask/wqflask/views.py | 6 +- 5 files changed, 136 insertions(+), 225 deletions(-) diff --git a/.gitignore b/.gitignore index f4693a9a..15c0c848 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ web/new_genotypes/HSNIH.json wqflask/secure_server.py wqflask/base/webqtlConfig.py -wqflask/output/* +wqflask/wqflask/static/output/* diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py index 4f9b3af3..3eaeb56e 100755 --- a/wqflask/base/webqtlConfig.py +++ b/wqflask/base/webqtlConfig.py @@ -55,7 +55,7 @@ COMMON_LIB = GNROOT + 'support/admin' HTMLPATH = GNROOT + 'genotype_files/' PYLMM_PATH = '/home/zas1024/plink_gemma/' SNP_PATH = '/home/zas1024/snps/' -IMGDIR = GNROOT + '/wqflask/output/' +IMGDIR = GNROOT + '/wqflask/wqflask/static/output/' IMAGESPATH = HTMLPATH + 'images/' UPLOADPATH = IMAGESPATH + 'upload/' TMPDIR = '/home/zas1024/tmp/' # Will remove this and dependent items later diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index c2cd5e97..5b0851ed 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -516,20 +516,20 @@ class MarkerRegression(object): gifmap = self.plotIntMapping(intCanvas, startMb = self.startMb, endMb = self.endMb, showLocusForm= showLocusForm) print("AFTER PLOTINTMAPPING") - filename= webqtlUtil.genRandStr("Itvl_") - intCanvas.save(os.path.join(webqtlConfig.IMGDIR, filename), format='jpeg') - intImg=HT.Image('/image/'+filename+'.png', border=0, usemap='#WebQTLImageMap') + self.filename= webqtlUtil.genRandStr("Itvl_") + intCanvas.save(os.path.join(webqtlConfig.IMGDIR, self.filename), format='jpeg') + intImg=HT.Image('/image/'+self.filename+'.png', border=0, usemap='#WebQTLImageMap') #Scales plot differently for high resolution if self.draw2X: intCanvasX2 = pid.PILCanvas(size=(self.graphWidth*2,self.graphHeight*2)) gifmapX2 = self.plotIntMapping(intCanvasX2, startMb = self.startMb, endMb = self.endMb, showLocusForm= showLocusForm, zoom=2) - intCanvasX2.save(os.path.join(webqtlConfig.IMGDIR, filename+"X2"), format='png') - #DLintImgX2=HT.Href(text='Download',url = '/image/'+filename+'X2.png', Class='smallsize', target='_blank') + intCanvasX2.save(os.path.join(webqtlConfig.IMGDIR, self.filename+"X2"), format='png') + #DLintImgX2=HT.Href(text='Download',url = '/image/'+self.filename+'X2.png', Class='smallsize', target='_blank') print("AFTER GN1 PLOT") - textUrl = self.writeQTL2Text(fd, filename) + #textUrl = self.writeQTL2Text(fd, self.filename) ################################################################ # Info tables goes here @@ -571,13 +571,15 @@ class MarkerRegression(object): if (self.additiveChecked): btminfo.append(HT.BR(), 'A positive additive coefficient (', HT.Font('green', color='green'), ' line) indicates that %s alleles increase trait values. In contrast, a negative additive coefficient (' % fd.ppolar, HT.Font('red', color='red'), ' line) indicates that %s alleles increase trait values.' % fd.mpolar) - if self.traitList and self.traitList[0].db and self.traitList[0].db.type == 'Geno': + if self.traitList and self.traitList[0].dataset and self.traitList[0].dataset.type == 'Geno': btminfo.append(HT.BR(), 'Mapping using genotype data as a trait will result in infinity LRS at one locus. In order to display the result properly, all LRSs higher than 100 are capped at 100.') if self.permChecked and not self.multipleInterval and 0 - - - -Mapping +{% from "base_macro.html" import header %} +{% block content %} + {{ header("Mapping", + '{}: {}'.format(this_trait.name, this_trait.description_fmt)) }} - - - - - - +
+
+

+ Whole Genome Mapping +

+
+
+
+ +
+
+
+

+ Results +

+ + + + + + + + {% if plotScale == "centimorgan" %} + + {% else %} + + {% endif %} + + + + + {% for marker in qtlresults %} + {% if (score_type == "LOD" and marker.lod_score > cutoff) or + (score_type == "LRS" and marker.lrs_value > cutoff) %} + + + + {% if score_type == "LOD" %} + + {% else %} + + {% endif %} + + + + + {% endif %} + {% endfor %} + +
Index{{ score_type }}ChrcMMbLocus
+ + {{ loop.index }}{{ '%0.2f' | format(marker.lod_score|float) }}{{ '%0.2f' | format(marker.lrs_value|float) }}{{marker.chr}}{{ '%0.6f' | format(marker.Mb|float) }} + {{ marker.name }} + +
+
+
- - - - - - + - - - - - - - - +{% endblock %} - - +{% block js %} - - - - -
- - -
-
- - - - - +{% endblock %} -
-

Map Viewer: Whole Genome

-

- Population: {{ dataset.species }} {{ dataset.group.name }}
- Database: {{ dataset.fullname }}
- Trait ID: {{ marker.name }}
- {% if this_trait.symbol != None %} - Gene Symbol: this_trait.symbol
- {% if this_trait.dataset.type != 'Publish' %} - Location: {{ this_trait.location_fmt }} - {% endif %} -

-

-
Download results in tab-delimited text format.

  -
- - -
Chr: - + - -
- - -Itvl_bnCx5c3U.png -

-


A positive additive coefficient (green line) indicates that DBA/2J alleles increase trait values. In contrast, a negative additive coefficient (red line) indicates that C57BL/6J alleles increase trait values.

-

-
Histogram of Permutation Test
Total of 1000 permutations
-

-Download Permutation Results

-
- - - - - - - - - - \ No newline at end of file diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index c17d6274..0a8d6191 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -388,7 +388,7 @@ def marker_regression_page(): print("TESTING GN1!!!") gn1_template_vars = marker_regression_gn1.MarkerRegression(result).__dict__ print("gn1_template_vars:", gn1_template_vars) - causeerror + #causeerror #qtl_length = len(result['js_data']['qtl_results']) @@ -411,8 +411,8 @@ def marker_regression_page(): result['pair_scan_array'] = bytesarray rendered_template = render_template("pair_scan_results.html", **result) else: - rendered_template = render_template("marker_regression.html", **result) - #rendered_template = render_template("marker_regression_gn1.html", **result) + #rendered_template = render_template("marker_regression.html", **result) + rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars) return rendered_template -- cgit v1.2.3