From 623cdd2cfafc3d2dd45bc1adf460c9f3c5120e7a Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 24 Jan 2018 20:11:59 +0000 Subject: Added links for markers in mapping results table when genotypes exist in DB Added more info to trait details for phenotype traits Changed order of mapping methods Fixed layout of mapping loading screen to hopefully be centered on different screen sizes Improved layout of some elements in mapping results page --- .../wqflask/marker_regression/marker_regression.py | 10 ++ .../marker_regression/marker_regression_gn1.py | 17 +- .../new/javascript/dataset_menu_structure.json | 24 +++ .../new/javascript/show_trait_mapping_tools.js | 1 + wqflask/wqflask/templates/loading.html | 18 +-- .../wqflask/templates/marker_regression_gn1.html | 22 +-- wqflask/wqflask/templates/show_trait.html | 2 + wqflask/wqflask/templates/show_trait_details.html | 31 +++- .../templates/show_trait_mapping_tools.html | 174 ++++++++++----------- wqflask/wqflask/views.py | 1 + 10 files changed, 184 insertions(+), 116 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index bcb14451..087b95b4 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -79,6 +79,16 @@ class MarkerRegression(object): self.samples.append(sample) self.vals.append(value) + #ZS: Check if genotypes exist in the DB in order to create links for markers + if "geno_db_exists" in start_vars: + self.geno_db_exists = start_vars['geno_db_exists'] + else: + try: + geno_dataset = data_set.create_dataset(self.dataset.group.name + "Geno") + self.geno_db_exists = "True" + except: + self.geno_db_exists = "False" + self.mapping_method = start_vars['method'] if "results_path" in start_vars: self.mapping_results_path = start_vars['results_path'] diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index 93bd9d42..211cf187 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -174,6 +174,8 @@ class MarkerRegression(object): if 'genofile_string' in start_vars: self.genofile_string = start_vars['genofile_string'] + self.geno_db_exists = start_vars['geno_db_exists'] + #Needing for form submission when doing single chr mapping or remapping after changing options self.samples = start_vars['samples'] self.vals = start_vars['vals'] @@ -576,7 +578,7 @@ class MarkerRegression(object): self.gifmap = gifmap.__str__() self.filename= webqtlUtil.genRandStr("Itvl_") - intCanvas.save(os.path.join(webqtlConfig.GENERATED_IMAGE_DIR, self.filename), format='jpeg') + intCanvas.save(os.path.join(webqtlConfig.GENERATED_IMAGE_DIR, self.filename), format='png') intImg=HT.Image('/image/'+self.filename+'.png', border=0, usemap='#WebQTLImageMap') #Scales plot differently for high resolution @@ -616,7 +618,7 @@ class MarkerRegression(object): else: showLocusForm = intImg - if self.permChecked and self.nperm > 0 and not self.multipleInterval and 0 < self.nperm: + if (self.permChecked and self.nperm > 0) and not (self.multipleInterval and 0 < self.nperm): self.perm_filename = self.drawPermutationHistogram() #perm_text_file = self.permutationTextFile() @@ -1200,8 +1202,10 @@ class MarkerRegression(object): if self.controlLocus and self.doControl != "false": string2 = 'Using %s as control' % self.controlLocus else: - if self.mapping_method == "gemma": + if self.mapping_method == "gemma" or self.mapping_method == "gemma_bimbam": string2 = 'Using GEMMA mapping method with no control for other QTLs.' + elif self.mapping_method == "rqtl_plink" or self.mapping_method == "rqtl_geno": + string2 = 'Using R/qtl mapping method with no control for other QTLs.' elif self.mapping_method == "plink": string2 = 'Using PLINK mapping method with no control for other QTLs.' else: @@ -1963,6 +1967,8 @@ class MarkerRegression(object): if self.permChecked and self.nperm > 0 and not self.multipleInterval: LRS_LOD_Max = max(self.significant, LRS_LOD_Max) + else: + LRS_LOD_Max = 1.15*LRS_LOD_Max #genotype trait will give infinite LRS LRS_LOD_Max = min(LRS_LOD_Max, webqtlConfig.MAXLRS) @@ -2164,10 +2170,7 @@ class MarkerRegression(object): # Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max if self.manhattan_plot == True: - if previous_chr_as_int % 2 == 1: - point_color = pid.grey - else: - point_color = pid.black + point_color = pid.black canvas.drawString("5", Xc-canvas.stringWidth("5",font=symbolFont)/2+1,Yc+2,color=point_color, font=symbolFont) else: LRSCoordXY.append((Xc, Yc)) diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 8de85a86..b7ebb9ed 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -2974,6 +2974,20 @@ ] ] }, + "BXD-Harvested": { + "Liver mRNA": [ + [ + "843", + "UTHSC-BXD-Harv_Liv-0118", + "UTHSC BXD Harvested Liver RNA-Seq (Jan18) Log2 **" + ], + [ + "842", + "UTHSC-BXD-Liv-0917", + "UTHSC BXD Liver Affy Clariom S GeneLevel Main (Sep17) RMA **" + ] + ] + }, "BXD300": { "Genotypes": [ [ @@ -3863,6 +3877,10 @@ "BXD-Bone", "BXD Bone" ], + [ + "BXD-Harvested", + "BXD NIA Longevity Study" + ], [ "BXD300", "BXD300" @@ -5007,6 +5025,12 @@ "Phenotypes" ] ], + "BXD-Harvested": [ + [ + "Liver mRNA", + "Liver mRNA" + ] + ], "BXD300": [ [ "Phenotypes", 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 2f1d836a..4d98f5d8 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -245,6 +245,7 @@ //$("#static_progress_bar_container").modal(); url = "/loading"; $('input[name=method]').val("gemma_bimbam"); + $('input[name=num_perm]').val(0); $('input[name=genofile]').val($('#genofile_gemma').val()); $('input[name=maf]').val($('input[name=maf_gemma]').val()); form_data = $('#trait_data_form').serialize(); diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index cede0e86..46136ddb 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -1,20 +1,20 @@ Loading Mapping Results - - - -
{% for key, value in start_vars.iteritems() %} {% endfor %}
-
-
-

Loading Mapping Results...

+
+
+
+

Loading Mapping Results...

+
-
-
+
+
+
+
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index d13c68cd..08a934a6 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -15,6 +15,7 @@ + {% for sample in samples %} @@ -154,7 +155,7 @@
{{ gifmap|safe }} - + {% if additiveChecked|upper == "ON" %}
A positive additive coefficient (green line) indicates that {{ dataset.group.parlist[1] }} alleles increase trait values. In contrast, a negative additive coefficient (orange line) indicates that {{ dataset.group.parlist[0] }} alleles increase trait values. @@ -180,10 +181,10 @@ {% if selectedChr == -1 %} -
-

Results

-
- +
+

Mapping Statistics

+
+
@@ -194,7 +195,7 @@ {% if plotScale != "physic" %} {% else %} - + {% endif %} {% if 'additive' in trimmed_markers[0] %} @@ -209,11 +210,11 @@ - + {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %} {% if 'lod_score' in marker %} @@ -294,6 +295,7 @@ {% endif %} + {% if mapping_method != "gemma" and mapping_method != "plink" %} @@ -304,7 +306,7 @@
cMMbMbAdd Eff
+ class="checkbox trait_checkbox" + value="{{ marker.name }}"> {{ loop.index }}{{ marker.name }}{% if geno_db_exists == "True" %}{{ marker.name }}{% else %}{{ marker.name }}{% endif %}{{ '%0.2f' | format(marker.lod_score|float) }}