From 3241a8de759f18bbbc73bd755419831db37e71a0 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:01:31 -0600 Subject: Added 'Location Type' option to show_trait correlation options --- wqflask/wqflask/templates/show_trait_calculate_correlations.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index eaa0c308..46232b97 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -80,6 +80,15 @@ +
+ +
+ +
+
-- cgit v1.2.3 From ab9aebc567d1a10282ae55f282993a3fa9dd3582 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:14:32 -0600 Subject: Changed correlation options to always show the location field and both location_type options, since one or the other will always apply --- wqflask/wqflask/templates/show_trait_calculate_correlations.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html index 46232b97..cba977ac 100644 --- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html +++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html @@ -84,12 +84,12 @@
-
+
-- cgit v1.2.3 From a336ca94fd473fdfd6cc5a83ce879429c0f1db92 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:15:01 -0600 Subject: Added JS controlling which location_type options are available depending upon the selected target dataset --- wqflask/wqflask/static/new/javascript/show_trait.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 6918cf34..a301615b 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -519,21 +519,26 @@ $('select[name=corr_type]').change(on_corr_method_change); on_dataset_change = function() { let dataset_type = $('select[name=corr_dataset] option:selected').data('type'); + let location_type = $('select[name=location_type] option:selected').val(); if (dataset_type == "mrna_assay"){ $('#min_expr_filter').show(); - $('#location_filter').show(); + $('select[name=location_type] option:disabled').prop('disabled', false) } else if (dataset_type == "pheno"){ $('#min_expr_filter').show(); - $('#location_filter').hide(); + $('select[name=location_type]>option:eq(0)').prop('disabled', true).attr('selected', false); + $('select[name=location_type]>option:eq(1)').prop('disabled', false).attr('selected', true); } else { $('#min_expr_filter').hide(); - $('#location_filter').show(); + $('select[name=location_type]>option:eq(0)').prop('disabled', false).attr('selected', true); + $('select[name=location_type]>option:eq(1)').prop('disabled', true).attr('selected', false); } } + $('select[name=corr_dataset]').change(on_dataset_change); +$('select[name=location_type]').change(on_dataset_change); submit_special = function(url) { get_table_contents_for_form_submit("trait_data_form"); -- cgit v1.2.3 From 8dd6f67d37c2d5cc800ee9dc33dd13a566e256fa Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 28 Dec 2020 15:48:50 -0600 Subject: Incorporated location_type into the filtering logic for the correlation page --- wqflask/wqflask/correlation/show_corr_results.py | 37 +++++++++++++++--------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 298a3559..6175dc7e 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -101,11 +101,12 @@ class CorrelationResults(object): 'min_loc_mb' in start_vars and 'max_loc_mb' in start_vars): + self.location_type = get_string(start_vars, 'location_type') self.location_chr = get_string(start_vars, 'loc_chr') self.min_location_mb = get_int(start_vars, 'min_loc_mb') self.max_location_mb = get_int(start_vars, 'max_loc_mb') else: - self.location_chr = self.min_location_mb = self.max_location_mb = None + self.location_type = self.location_chr = self.min_location_mb = self.max_location_mb = None self.get_formatted_corr_type() self.return_number = int(start_vars['corr_return_results']) @@ -173,23 +174,25 @@ class CorrelationResults(object): self.correlation_data = collections.OrderedDict(sorted(list(self.correlation_data.items()), key=lambda t: -abs(t[1][0]))) - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - #ZS: Convert min/max chromosome to an int for the location range option - range_chr_as_int = None - for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): - if 'loc_chr' in start_vars: - if chr_info.name == self.location_chr: - range_chr_as_int = order_id + + #ZS: Convert min/max chromosome to an int for the location range option + range_chr_as_int = None + for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + if 'loc_chr' in start_vars: + if chr_info.name == self.location_chr: + range_chr_as_int = order_id for _trait_counter, trait in enumerate(list(self.correlation_data.keys())[:self.return_number]): trait_object = create_trait(dataset=self.target_dataset, name=trait, get_qtl_info=True, get_sample_info=False) if not trait_object: continue - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - #ZS: Convert trait chromosome to an int for the location range option - chr_as_int = 0 - for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + chr_as_int = 0 + for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + if self.location_type == "highest_lod": + if chr_info.name == trait_object.locus_chr: + chr_as_int = order_id + else: if chr_info.name == trait_object.chr: chr_as_int = order_id @@ -199,9 +202,15 @@ class CorrelationResults(object): if (self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Publish") and bool(trait_object.mean): if (self.min_expr != None) and (float(trait_object.mean) < self.min_expr): continue - if self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Geno": - if range_chr_as_int != None and (chr_as_int != range_chr_as_int): + + if range_chr_as_int != None and (chr_as_int != range_chr_as_int): + continue + if self.location_type == "highest_lod": + if (self.min_location_mb != None) and (float(trait_object.locus_mb) < float(self.min_location_mb)): + continue + if (self.max_location_mb != None) and (float(trait_object.locus_mb) > float(self.max_location_mb)): continue + else: if (self.min_location_mb != None) and (float(trait_object.mb) < float(self.min_location_mb)): continue if (self.max_location_mb != None) and (float(trait_object.mb) > float(self.max_location_mb)): -- cgit v1.2.3 From e7324bf55b7dcfd46f7a2ab52765977fb189c26b Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 29 Dec 2020 13:12:48 -0600 Subject: Added location_type to the list of inputs to correlation page (a list of form inputs the correlation page needs is passed with it so it doesn't get unrelated form inputs) --- wqflask/wqflask/static/new/javascript/show_trait.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index a301615b..83d4f193 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -566,7 +566,7 @@ get_table_contents_for_form_submit = function(form_id) { } var corr_input_list = ['corr_type', 'primary_samples', 'trait_id', 'dataset', 'group', 'tool_used', 'form_url', 'corr_sample_method', 'corr_samples_group', 'corr_dataset', 'min_expr', - 'corr_return_results', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper'] + 'corr_return_results', 'location_type', 'loc_chr', 'min_loc_mb', 'max_loc_mb', 'p_range_lower', 'p_range_upper'] $(".corr_compute").on("click", (function(_this) { return function() { -- cgit v1.2.3