From 97b83d20a5f6896614024a3cc40535bfb738ef51 Mon Sep 17 00:00:00 2001 From: zsloan Date: Sat, 12 Dec 2015 00:01:06 +0000 Subject: Changed loop drawing qtl curve to fix some issues; still need to make it draw to different chr areas though --- wqflask/base/webqtlConfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wqflask/base') diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py index 330fec56..4f9b3af3 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/wqflask/images/' +IMGDIR = GNROOT + '/wqflask/output/' IMAGESPATH = HTMLPATH + 'images/' UPLOADPATH = IMAGESPATH + 'upload/' TMPDIR = '/home/zas1024/tmp/' # Will remove this and dependent items later -- cgit v1.2.3 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(-) (limited to 'wqflask/base') 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 From 7d5dba3e38892475edec80c922f06bcb40b0dcb3 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 4 Feb 2016 19:01:16 +0000 Subject: Most importantly, this commit fixes an issue that caused the trait page to not work because of the new dataset_menu_structure.json file An Intro section is also added to the header, though for the time being its contents aren't populated and the edit option isn't working --- genotype_files/new_genotypes/HSNIH.json | 3 --- genotype_files/new_genotypes/output.json | 3 --- wqflask/base/data_set.py | 2 +- wqflask/wqflask/templates/base.html | 3 +++ wqflask/wqflask/views.py | 5 +++++ 5 files changed, 9 insertions(+), 7 deletions(-) (limited to 'wqflask/base') diff --git a/genotype_files/new_genotypes/HSNIH.json b/genotype_files/new_genotypes/HSNIH.json index fc8e42b3..e69de29b 100644 --- a/genotype_files/new_genotypes/HSNIH.json +++ b/genotype_files/new_genotypes/HSNIH.json @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -size 0 diff --git a/genotype_files/new_genotypes/output.json b/genotype_files/new_genotypes/output.json index fc8e42b3..e69de29b 100644 --- a/genotype_files/new_genotypes/output.json +++ b/genotype_files/new_genotypes/output.json @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -size 0 diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 5603fe2e..68a2a185 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -91,7 +91,7 @@ class Dataset_Types(object): for dataset in data['datasets'][species][group][dataset_type]: #print("dataset is:", dataset) - short_dataset_name = dataset[0] + short_dataset_name = dataset[1] if dataset_type == "Phenotypes": new_type = "Publish" elif dataset_type == "Genotypes": diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 4d44642b..24d959f4 100755 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -34,6 +34,9 @@