From 9e4219ccdfbbf8f77c1c55fc6bc6ef0fad35a960 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 24 Apr 2023 19:20:21 +0000 Subject: Cache trait sample data for mapping This is so edited sample values can be used in the additive effect scatterplots --- wqflask/wqflask/marker_regression/display_mapping_results.py | 1 + wqflask/wqflask/marker_regression/run_mapping.py | 1 + wqflask/wqflask/views.py | 10 +++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index b0bb5db0..d23ef7b1 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -244,6 +244,7 @@ class DisplayMappingResults: def __init__(self, start_vars): self.temp_uuid = start_vars['temp_uuid'] self.hash_of_inputs = start_vars['hash_of_inputs'] + self.dataid = start_vars['dataid'] self.dataset = start_vars['dataset'] self.this_trait = start_vars['this_trait'] diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 9161f283..952d9749 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -55,6 +55,7 @@ class RunMapping: self.group = self.dataset.group.name self.hash_of_inputs = start_vars['hash_of_inputs'] + self.dataid = start_vars['dataid'] self.json_data = {} self.json_data['lodnames'] = ['lod.hk'] diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 24426539..90747fc2 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -754,7 +754,8 @@ def mapping_results_page(): 'temp_trait', 'n_samples', 'transform', - 'hash_of_inputs' + 'hash_of_inputs', + 'dataid' ) start_vars = {} for key, value in list(initial_start_vars.items()): @@ -763,6 +764,13 @@ def mapping_results_page(): start_vars['hash_of_inputs'] = hash_of_inputs + # Store trait sample data in Redis, so additive effect scatterplots can include edited values + dhash = hashlib.md5() + dhash.update(start_vars['sample_vals'].encode()) + samples_hash = dhash.hexdigest() + Redis.set(samples_hash, start_vars['sample_vals'], ex=7*24*60*60) + start_vars['dataid'] = samples_hash + version = "v3" key = "mapping_results:{}:".format( version) + json.dumps(start_vars, sort_keys=True) -- cgit v1.2.3