diff options
author | uditgulati | 2021-01-17 08:57:12 -0600 |
---|---|---|
committer | BonfaceKilz | 2021-01-18 11:05:37 +0300 |
commit | 6749974cccdf10fc300c4265720dfd147db88989 (patch) | |
tree | e1a7fb6697cb74c528680d7a927c681b829047d3 | |
parent | 715d9137038887c6654a14d22dc0512bb01aaf86 (diff) | |
download | genenetwork2-6749974cccdf10fc300c4265720dfd147db88989.tar.gz |
add dataset object creation, permission check in global search code itself which takes the load off creating Trait object
-rw-r--r-- | wqflask/wqflask/gsearch.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 6ff57563..2b8d4bc1 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -68,6 +68,7 @@ class GSearch(object): re = g.db.execute(sql).fetchall() trait_list = [] + dataset_to_permissions = {} with Bench("Creating trait objects"): for i, line in enumerate(re): this_trait = {} @@ -101,9 +102,15 @@ class GSearch(object): this_trait['locus_chr'] = line[16] this_trait['locus_mb'] = line[17] - #dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False) - #trait_id = line[4] - #with Bench("Building trait object"): + dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="ProbeSet",species=this_trait["species"]) + if dataset_ob.id not in dataset_to_permissions: + permissions = check_resource_availability(dataset_ob) + dataset_to_permissions[dataset_ob.id] = permissions + else: + pemissions = dataset_to_permissions[dataset_ob.id] + if "view" not in permissions['data']: + continue + max_lrs_text = "N/A" if this_trait['locus_chr'] != None and this_trait['locus_mb'] != None: max_lrs_text = "Chr" + str(this_trait['locus_chr']) + ": " + str(this_trait['locus_mb']) |