aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2021-09-07 18:22:44 +0000
committerzsloan2021-09-07 18:22:44 +0000
commitd243e3a69b26d60709fe10ab0b70a0e1d53ba50d (patch)
tree7c824916064d6c5fd279f24f31897293d9ff211a /wqflask
parent25a5fe8027a00a64513855630a4365480cf567d7 (diff)
downloadgenenetwork2-d243e3a69b26d60709fe10ab0b70a0e1d53ba50d.tar.gz
Add trait hash and datetime to mapping figure
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py68
-rw-r--r--wqflask/wqflask/marker_regression/run_mapping.py1
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js10
-rw-r--r--wqflask/wqflask/templates/mapping_results.html1
-rw-r--r--wqflask/wqflask/views.py1
5 files changed, 51 insertions, 30 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 3986c441..5f5fe6a3 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -24,6 +24,7 @@
#
# Last updated by Zach 12/14/2010
+import datetime
import string
from math import *
from PIL import Image
@@ -271,6 +272,7 @@ class DisplayMappingResults:
# Needing for form submission when doing single chr
# mapping or remapping after changing options
self.sample_vals = start_vars['sample_vals']
+ self.vals_hash= start_vars['vals_hash']
self.sample_vals_dict = json.loads(self.sample_vals)
self.transform = start_vars['transform']
@@ -651,7 +653,7 @@ class DisplayMappingResults:
btminfo.append(
'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.')
- def plotIntMapping(self, canvas, offset=(80, 120, 90, 100), zoom=1, startMb=None, endMb=None, showLocusForm=""):
+ def plotIntMapping(self, canvas, offset=(80, 120, 110, 100), zoom=1, startMb=None, endMb=None, showLocusForm=""):
im_drawer = ImageDraw.Draw(canvas)
# calculating margins
xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset
@@ -661,7 +663,7 @@ class DisplayMappingResults:
if self.legendChecked:
yTopOffset += 10
if self.covariates != "" and self.controlLocus and self.doControl != "false":
- yTopOffset += 20
+ yTopOffset += 25
if len(self.transform) > 0:
yTopOffset += 5
else:
@@ -1195,43 +1197,47 @@ class DisplayMappingResults:
dataset_label = "%s - %s" % (self.dataset.group.name,
self.dataset.fullname)
- string1 = 'Dataset: %s' % (dataset_label)
+
+ current_datetime = datetime.datetime.now()
+ string1 = 'UTC Timestamp: %s' % (current_datetime.strftime("%b %d %Y %H:%M:%S"))
+ string2 = 'Dataset: %s' % (dataset_label)
+ string3 = 'Trait Hash: %s' % (self.vals_hash)
if self.genofile_string == "":
- string2 = 'Genotype File: %s.geno' % self.dataset.group.name
+ string4 = 'Genotype File: %s.geno' % self.dataset.group.name
else:
- string2 = 'Genotype File: %s' % self.genofile_string
+ string4 = 'Genotype File: %s' % self.genofile_string
- string4 = ''
+ string6 = ''
if self.mapping_method == "gemma" or self.mapping_method == "gemma_bimbam":
if self.use_loco == "True":
- string3 = 'Using GEMMA mapping method with LOCO and '
+ string5 = 'Using GEMMA mapping method with LOCO and '
else:
- string3 = 'Using GEMMA mapping method with '
+ string5 = 'Using GEMMA mapping method with '
if self.covariates != "":
- string3 += 'the cofactors below:'
+ string5 += 'the cofactors below:'
cofactor_names = ", ".join(
[covar.split(":")[0] for covar in self.covariates.split(",")])
- string4 = cofactor_names
+ string6 = cofactor_names
else:
- string3 += 'no cofactors'
+ string5 += 'no cofactors'
elif self.mapping_method == "rqtl_plink" or self.mapping_method == "rqtl_geno":
- string3 = 'Using R/qtl mapping method with '
+ string5 = 'Using R/qtl mapping method with '
if self.covariates != "":
- string3 += 'the cofactors below:'
+ string5 += 'the cofactors below:'
cofactor_names = ", ".join(
[covar.split(":")[0] for covar in self.covariates.split(",")])
- string4 = cofactor_names
+ string6 = cofactor_names
elif self.controlLocus and self.doControl != "false":
- string3 += '%s as control' % self.controlLocus
+ string5 += '%s as control' % self.controlLocus
else:
- string3 += 'no cofactors'
+ string5 += 'no cofactors'
else:
- string3 = 'Using Haldane mapping function with '
+ string5 = 'Using Haldane mapping function with '
if self.controlLocus and self.doControl != "false":
- string3 += '%s as control' % self.controlLocus
+ string5 += '%s as control' % self.controlLocus
else:
- string3 += 'no control for other QTLs'
+ string5 += 'no control for other QTLs'
y_constant = 10
if self.this_trait.name:
@@ -1260,7 +1266,9 @@ class DisplayMappingResults:
d = 4 + max(
im_drawer.textsize(identification, font=labelFont)[0],
im_drawer.textsize(string1, font=labelFont)[0],
- im_drawer.textsize(string2, font=labelFont)[0])
+ im_drawer.textsize(string2, font=labelFont)[0],
+ im_drawer.textsize(string3, font=labelFont)[0],
+ im_drawer.textsize(string4, font=labelFont)[0])
im_drawer.text(
text=identification,
xy=(xLeftOffset, y_constant * fontZoom), font=labelFont,
@@ -1269,7 +1277,9 @@ class DisplayMappingResults:
else:
d = 4 + max(
im_drawer.textsize(string1, font=labelFont)[0],
- im_drawer.textsize(string2, font=labelFont)[0])
+ im_drawer.textsize(string2, font=labelFont)[0],
+ im_drawer.textsize(string3, font=labelFont)[0],
+ im_drawer.textsize(string4, font=labelFont)[0])
if len(self.transform) > 0:
transform_text = "Transform - "
@@ -1296,14 +1306,22 @@ class DisplayMappingResults:
text=string2, xy=(xLeftOffset, y_constant * fontZoom),
font=labelFont, fill=labelColor)
y_constant += 15
- if string3 != '':
+ im_drawer.text(
+ text=string3, xy=(xLeftOffset, y_constant * fontZoom),
+ font=labelFont, fill=labelColor)
+ y_constant += 15
+ im_drawer.text(
+ text=string4, xy=(xLeftOffset, y_constant * fontZoom),
+ font=labelFont, fill=labelColor)
+ y_constant += 15
+ if string4 != '':
im_drawer.text(
- text=string3, xy=(xLeftOffset, y_constant * fontZoom),
+ text=string5, xy=(xLeftOffset, y_constant * fontZoom),
font=labelFont, fill=labelColor)
y_constant += 15
- if string4 != '':
+ if string5 != '':
im_drawer.text(
- text=string4, xy=(xLeftOffset, y_constant * fontZoom),
+ text=string6, xy=(xLeftOffset, y_constant * fontZoom),
font=labelFont, fill=labelColor)
def drawGeneBand(self, canvas, gifmap, plotXScale, offset=(40, 120, 80, 10), zoom=1, startMb=None, endMb=None):
diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py
index ebad7d36..2f90b475 100644
--- a/wqflask/wqflask/marker_regression/run_mapping.py
+++ b/wqflask/wqflask/marker_regression/run_mapping.py
@@ -75,6 +75,7 @@ class RunMapping:
self.vals = []
self.samples = []
self.sample_vals = start_vars['sample_vals']
+ self.vals_hash = start_vars['vals_hash']
sample_val_dict = json.loads(self.sample_vals)
samples = sample_val_dict.keys()
if (len(genofile_samplelist) != 0):
diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
index 09e9d024..b75d658e 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
@@ -141,11 +141,11 @@ $('input[name=display_all]').change((function(_this) {
})(this));
//ZS: This is a list of inputs to be passed to the loading page, since not all inputs on the trait page are relevant to mapping
-var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale', 'sample_vals',
- 'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'perm_strata', 'categorical_vars', 'num_bootstrap', 'bootCheck', 'bootstrap_results',
- 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'control_marker', 'do_control', 'genofile',
- 'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend', 'haplotypeAnalystCheck',
- 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species', 'reaper_version', 'primary_samples']
+var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale',
+ 'sample_vals', 'vals_hash', 'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'perm_strata', 'categorical_vars',
+ 'num_bootstrap', 'bootCheck', 'bootstrap_results', 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'control_marker',
+ 'do_control', 'genofile', 'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend',
+ 'haplotypeAnalystCheck', 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species', 'reaper_version', 'primary_samples']
$(".rqtl-geno-tab, #rqtl_geno_compute").on("click", (function(_this) {
return function() {
diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html
index d446745d..162ae810 100644
--- a/wqflask/wqflask/templates/mapping_results.html
+++ b/wqflask/wqflask/templates/mapping_results.html
@@ -34,6 +34,7 @@
<input type="hidden" name="results_path" value="{{ mapping_results_path }}">
<input type="hidden" name="method" value="{{ mapping_method }}">
<input type="hidden" name="sample_vals" value="{{ sample_vals }}">
+ <input type="hidden" name="vals_hash" value="{{ vals_hash }}">
<input type="hidden" name="n_samples" value="{{ n_samples }}">
<input type="hidden" name="maf" value="{{ maf }}">
<input type="hidden" name="use_loco" value="{{ use_loco }}">
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 11a9380c..707b18e1 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1051,6 +1051,7 @@ def mapping_results_page():
'samples',
'vals',
'sample_vals',
+ 'vals_hash',
'first_run',
'output_files',
'geno_db_exists',