From a53302a077b8eea3591460a03a60c9621c3f4586 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Nov 2020 13:11:11 -0600 Subject: Substituted CDN link to the font-awesome CSS with the local guix profile link --- wqflask/wqflask/templates/search_result_page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 8e2b06a4..35d8ed27 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -2,9 +2,9 @@ {% block title %}Search Results{% endblock %} {% block css %} + - {% endblock %} -- cgit v1.2.3 From c8a339616fb3dd3f63427378dc4285de9ad1ccef Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Nov 2020 13:11:48 -0600 Subject: Removed an unused console.timeEnd in the JS --- wqflask/wqflask/templates/search_result_page.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 35d8ed27..9a28a78e 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -440,8 +440,6 @@ 'processing': 'Loading...' } } ); - - console.timeEnd("Creating table"); $('.toggle-vis').on( 'click', function (e) { e.preventDefault(); -- cgit v1.2.3 From ab6681e545bd4c84e1f74107b90ea52f7d2ca24c Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Nov 2020 13:15:25 -0600 Subject: Added form options for changing manhattan plot color scheme + added necessary imports and hidden inputs --- wqflask/wqflask/templates/mapping_results.html | 47 +++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 28d93542..9542c29d 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -40,6 +40,9 @@ + {% if manhattan_plot == True %} + + {% endif %} @@ -55,7 +58,7 @@ -
+

Map Viewer: Whole Genome


Population: {{ dataset.group.species|capitalize }} {{ dataset.group.name }}
@@ -77,7 +80,7 @@ - - + @@ -114,11 +117,31 @@ -
Chr:  +
View: View:  to
Width:  + pixels (minimum=900)
+ {% if manhattan_plot == True and selectedChr == -1 %} + + + + + + +
+ Manhattan Plot Color Scheme:  + + + + + +
+ {% endif %}
{% if (mapping_method == "reaper" or mapping_method == "rqtl_geno") and nperm > 0 %} @@ -328,6 +351,9 @@ + {% if manhattan_plot == True and selectedChr == -1 %} + + {% endif %} @@ -423,7 +449,7 @@ var mapping_input_list = ['temp_uuid', 'trait_id', 'dataset', 'tool_used', 'form_url', 'method', 'transform', 'trimmed_markers', 'selected_chr', 'chromosomes', 'mapping_scale', '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', 'control_marker_db', 'do_control', 'genofile', + 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'color_scheme', 'manhattan_single_color', 'control_marker', 'control_marker_db', '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', 'n_samples'] @@ -449,10 +475,21 @@ remap = function() { $('input[name=selected_chr]').val($('select[name=chromosomes]').val()); + $('input[name=color_scheme]').val($('select#color_scheme').val()); $('#marker_regression_form').attr('action', '/loading'); return $('#marker_regression_form').submit(); }; + {% if manhattan_plot == True and selectedChr == -1 %} + $('#color_scheme').change(function(){ + if ($(this).val() == "single"){ + $('#point_color_picker').show(); + } else { + $('#point_color_picker').hide(); + } + }); + {% endif %} + {% if mapping_method != "gemma" and mapping_method != "plink" %} $('#download_perm').click(function(){ perm_info_dict = { -- cgit v1.2.3 From a1563aee47a54d5ff4253e1da7e851afe28805c0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Nov 2020 13:16:26 -0600 Subject: Added code for passing around form parameters related to manhattan plot coloration to run_mapping.py and views.py --- wqflask/wqflask/marker_regression/run_mapping.py | 7 ++++++- wqflask/wqflask/views.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 31d6a67c..c474e0e0 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -138,7 +138,12 @@ class RunMapping(object): mapping_results_filename = self.dataset.group.name + "_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) self.mapping_results_path = "{}{}.csv".format(webqtlConfig.GENERATED_IMAGE_DIR, mapping_results_filename) - if start_vars['manhattan_plot'] == "true": + if start_vars['manhattan_plot']: + self.color_scheme = "alternating" + if "color_scheme" in start_vars: + self.color_scheme = start_vars['color_scheme'] + if self.color_scheme == "single": + self.manhattan_single_color = start_vars['manhattan_single_color'] self.manhattan_plot = True else: self.manhattan_plot = False diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index b7c4d142..7118bab7 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -718,6 +718,8 @@ def mapping_results_page(): 'maf', 'use_loco', 'manhattan_plot', + 'color_scheme', + 'manhattan_single_color', 'control_marker', 'control_marker_db', 'do_control', -- cgit v1.2.3 From d1740605ffd36e49b9560e81c0e085c58ef8b688 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Nov 2020 13:17:03 -0600 Subject: Added actual code for coloring manhattan plot differently to display_mapping_results.py --- .../marker_regression/display_mapping_results.py | 46 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 3f6de2b2..87910401 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -74,6 +74,34 @@ DARKVIOLET = ImageColor.getrgb("darkviolet") MEDIUMPURPLE = ImageColor.getrgb("mediumpurple") # ---- END: Define common colours ---- # +# ZS: List of distinct colors for manhattan plot if user selects "varied" +DISTINCT_COLOR_LIST = [ + ImageColor.getrgb("#FF0000"), + ImageColor.getrgb("#00FF00"), + ImageColor.getrgb("#0000FF"), + ImageColor.getrgb("#FFFF00"), + ImageColor.getrgb("#FF00FF"), + ImageColor.getrgb("#00FFFF"), + ImageColor.getrgb("#000000"), + ImageColor.getrgb("#800000"), + ImageColor.getrgb("#008000"), + ImageColor.getrgb("#000080"), + ImageColor.getrgb("#808000"), + ImageColor.getrgb("#800080"), + ImageColor.getrgb("#008080"), + ImageColor.getrgb("#808080"), + ImageColor.getrgb("#C00000"), + ImageColor.getrgb("#00C000"), + ImageColor.getrgb("#0000C0"), + ImageColor.getrgb("#C0C000"), + ImageColor.getrgb("#C000C0"), + ImageColor.getrgb("#00C0C0"), + ImageColor.getrgb("#C0C0C0"), + ImageColor.getrgb("#400000"), + ImageColor.getrgb("#004000"), + ImageColor.getrgb("#000040"), +] + # ---- FONT FILES ---- # VERDANA_FILE = "./wqflask/static/fonts/verdana.ttf" VERDANA_BOLD_FILE = "./wqflask/static/fonts/verdanab.ttf" @@ -293,6 +321,12 @@ class DisplayMappingResults(object): self.plotScale = "physic" self.manhattan_plot = start_vars['manhattan_plot'] + if self.manhattan_plot: + self.color_scheme = "alternating" + if 'color_scheme' in start_vars: + self.color_scheme = start_vars['color_scheme'] + if self.color_scheme == "single": + self.manhattan_single_color = ImageColor.getrgb("#" + start_vars['manhattan_single_color']) if 'permCheck' in list(start_vars.keys()): self.permChecked = start_vars['permCheck'] @@ -2424,10 +2458,16 @@ class DisplayMappingResults(object): Yc = yZero - qtlresult['lod_score']*LRSHeightThresh/LRS_LOD_Max if self.manhattan_plot == True: - if self.selectedChr == -1 and (previous_chr_as_int % 2 == 1): - point_color = RED + if self.color_scheme == "single": + point_color = self.manhattan_single_color + elif self.color_scheme == "varied": + point_color = DISTINCT_COLOR_LIST[previous_chr_as_int] else: - point_color = BLUE + if self.selectedChr == -1 and (previous_chr_as_int % 2 == 1): + point_color = RED + else: + point_color = BLUE + im_drawer.text( text="5", xy=( -- cgit v1.2.3 From 78fd4d4a89a02fc5233a1f5bbdfd3946ec08f3b7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 26 Nov 2020 16:06:59 -0600 Subject: Changed the way the chromosome colors for the "color by chr" manhattan plot option are stored to using a list comprehension on a list of the just the hex strings --- .../marker_regression/display_mapping_results.py | 32 ++++------------------ 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 87910401..08c2d750 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -75,32 +75,12 @@ MEDIUMPURPLE = ImageColor.getrgb("mediumpurple") # ---- END: Define common colours ---- # # ZS: List of distinct colors for manhattan plot if user selects "varied" -DISTINCT_COLOR_LIST = [ - ImageColor.getrgb("#FF0000"), - ImageColor.getrgb("#00FF00"), - ImageColor.getrgb("#0000FF"), - ImageColor.getrgb("#FFFF00"), - ImageColor.getrgb("#FF00FF"), - ImageColor.getrgb("#00FFFF"), - ImageColor.getrgb("#000000"), - ImageColor.getrgb("#800000"), - ImageColor.getrgb("#008000"), - ImageColor.getrgb("#000080"), - ImageColor.getrgb("#808000"), - ImageColor.getrgb("#800080"), - ImageColor.getrgb("#008080"), - ImageColor.getrgb("#808080"), - ImageColor.getrgb("#C00000"), - ImageColor.getrgb("#00C000"), - ImageColor.getrgb("#0000C0"), - ImageColor.getrgb("#C0C000"), - ImageColor.getrgb("#C000C0"), - ImageColor.getrgb("#00C0C0"), - ImageColor.getrgb("#C0C0C0"), - ImageColor.getrgb("#400000"), - ImageColor.getrgb("#004000"), - ImageColor.getrgb("#000040"), -] +COLOR_CODES = ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF", + "#000000", "#800000", "#008000", "#000080", "#808000", "#800080", + "#008080", "#808080", "#C00000", "#00C000", "#0000C0", "#C0C000", + "#C000C0", "#00C0C0", "#C0C0C0", "#400000", "#004000", "#000040"] + +DISTINCT_COLOR_LIST = [ImageColor.getrgb(color) for color in COLOR_CODES] # ---- FONT FILES ---- # VERDANA_FILE = "./wqflask/static/fonts/verdana.ttf" -- cgit v1.2.3