From 458681a451dad3e0d5e75b8e8b7459f6ccffb240 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 28 Apr 2023 18:32:52 +0000 Subject: Enable passing dataid for correlation results This allows the scatterplots to use edited sample data --- wqflask/wqflask/correlation/show_corr_results.py | 10 ++++++++++ wqflask/wqflask/templates/correlation_page.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 5fa65594..86af8646 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -18,6 +18,7 @@ # # This module is used by GeneNetwork project (www.genenetwork.org) +import hashlib import html import json @@ -26,6 +27,8 @@ from base.data_set import create_dataset from utility import hmac from utility.type_checking import get_float, get_int, get_string +from utility.redis_tools import get_redis_conn +Redis = get_redis_conn() def set_template_vars(start_vars, correlation_data): corr_type = start_vars['corr_type'] @@ -39,6 +42,13 @@ def set_template_vars(start_vars, correlation_data): this_trait = create_trait(dataset=this_dataset_ob, name=start_vars['trait_id']) + # 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) + correlation_data['dataid'] = samples_hash + correlation_data['this_trait'] = jsonable(this_trait, this_dataset_ob) correlation_data['this_dataset'] = this_dataset_ob.as_monadic_dict().data diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index a85ac19b..84fa4648 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -299,7 +299,7 @@ 'orderSequence': [ "desc", "asc"], 'render': function(data) { if (data.sample_r != "N/A") { - return "" + data.sample_r + "" + return "" + data.sample_r + "" } else { return data.sample_r } -- cgit v1.2.3