diff options
author | zsloan | 2023-05-04 18:20:44 +0000 |
---|---|---|
committer | zsloan | 2023-05-04 18:20:44 +0000 |
commit | 5a8432adb56f9fddbc9e42a9eb8de5e4a0879ee6 (patch) | |
tree | e6f1dcb12e7ea1147d456ce7a6f53dd26939c440 | |
parent | 3a5131b57ec93c5cc955a3f5ec0511caadfb4db0 (diff) | |
download | genenetwork2-5a8432adb56f9fddbc9e42a9eb8de5e4a0879ee6.tar.gz |
Fix bug where global search had wrong checkbox values
-rw-r--r-- | wqflask/wqflask/gsearch.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 9e3d8133..72c55153 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -5,6 +5,7 @@ from pymonad.tools import curry import requests from gn3.monads import MonadicDict +from utility.hmac import hmac_creation from utility.tools import GN3_LOCAL_URL from base import webqtlConfig @@ -24,7 +25,7 @@ class GSearch: # search results. chr_mb = curry(2, lambda chr, mb: f"Chr{chr}: {mb:.6f}") format3f = lambda x: f"{x:.3f}" - hmac = curry(2, lambda dataset, dataset_fullname: f"{dataset_fullname}:{dataset}") + hmac = curry(3, lambda trait_name, dataset, data_hmac: f"{trait_name}:{dataset}:{data_hmac}") convert_lod = lambda x: x / 4.61 self.trait_list = [] for i, trait in enumerate(requests.get( @@ -42,7 +43,7 @@ class GSearch: .to_arguments(trait.pop("geno_chr"), trait.pop("geno_mb"))) if self.type == "gene": trait["hmac"] = (Maybe.apply(hmac) - .to_arguments(trait["dataset"], trait["dataset_fullname"])) + .to_arguments(trait['name'], trait['dataset'], Just(hmac_creation(f"{trait['name']}:{trait['dataset']}")))) elif self.type == "phenotype": trait["display_name"] = trait["name"] inbredsetcode = trait.pop("inbredsetcode") @@ -50,8 +51,9 @@ class GSearch: trait["display_name"] = (Maybe.apply( curry(2, lambda inbredsetcode, name: f"{inbredsetcode}_{name}")) .to_arguments(inbredsetcode, trait["name"])) + trait["hmac"] = (Maybe.apply(hmac) - .to_arguments(trait.pop("dataset_fullname"), trait["name"])) + .to_arguments(trait['name'], trait['dataset'], Just(hmac_creation(f"{trait['name']}:{trait['dataset']}")))) trait["authors_display"] = (trait.pop("authors").map( lambda authors: ", ".join(authors[:2] + ["et al."] if len(authors) >=2 else authors))) |