diff options
author | zsloan | 2023-04-28 18:32:52 +0000 |
---|---|---|
committer | zsloan | 2023-04-28 13:35:17 -0500 |
commit | 458681a451dad3e0d5e75b8e8b7459f6ccffb240 (patch) | |
tree | e71bfec897d858876bc895f6101144de46ec2d47 /wqflask | |
parent | 4487dca75a35fc69dc289f1b61a819831eeb9f4e (diff) | |
download | genenetwork2-458681a451dad3e0d5e75b8e8b7459f6ccffb240.tar.gz |
Enable passing dataid for correlation results
This allows the scatterplots to use edited sample data
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/correlation/show_corr_results.py | 10 | ||||
-rw-r--r-- | wqflask/wqflask/templates/correlation_page.html | 2 |
2 files changed, 11 insertions, 1 deletions
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 "<a target\"_blank\" href=\"corr_scatter_plot?method=" + corr_method + "&dataset_1={% if this_dataset.name == 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" + return "<a target\"_blank\" href=\"corr_scatter_plot?method=" + corr_method + "&dataid={{ dataid }}&dataset_1={% if this_dataset.name == 'Temp' %}Temp_{{ this_dataset.group }}{% else %}{{ this_dataset.name }}{% endif %}&dataset_2=" + data.dataset + "&trait_1={{ this_trait.name }}&trait_2=" + data.trait_id + "\">" + data.sample_r + "</a>" } else { return data.sample_r } |