aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-08-08 12:13:45 +0300
committerMuriithi Frederick Muriuki2021-08-08 12:13:45 +0300
commit86abf16313ac4579f33c357525115827a39451af (patch)
tree3041e00ac34aada32c1ee32b07b5351586734d5a /gn3
parent0ec39e6c5058f4f06bfb5f763f51cd9dc176cb35 (diff)
downloadgenenetwork3-86abf16313ac4579f33c357525115827a39451af.tar.gz
Only load extra data if the traits have basic info
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * Only load the extra trait data if the basic trait information is found.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/traits.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/gn3/db/traits.py b/gn3/db/traits.py
index f66ead3..6c31a4d 100644
--- a/gn3/db/traits.py
+++ b/gn3/db/traits.py
@@ -338,8 +338,7 @@ def retrieve_trait_info(
lambda ti: load_qtl_info(qtl, trait_type, ti, conn),
lambda ti: set_homologene_id_field(trait_type, ti, conn),
lambda ti: {"trait_type": trait_type, **ti},
- lambda ti: {**trait, **ti},
- set_haveinfo_field)
+ lambda ti: {**trait, **ti})
trait_post_processing_functions_table = {
"Publish": compose(
@@ -353,8 +352,7 @@ def retrieve_trait_info(
}
retrieve_info = compose(
- trait_post_processing_functions_table[trait_type],
- trait_info_function_table[trait_type])
+ set_haveinfo_field, trait_info_function_table[trait_type])
trait_dataset = retrieve_trait_dataset(trait_type, trait, threshold, conn)
trait_info = retrieve_info(
@@ -364,8 +362,10 @@ def retrieve_trait_info(
"trait_dataset_name": trait_dataset["dataset_name"]
},
conn)
- return {
- **trait_info,
- "db": {**trait["db"], **trait_dataset},
- "riset": trait_dataset["riset"]
- }
+ if trait_info["haveinfo"]:
+ return {
+ **trait_post_processing_functions_table[trait_type](trait_info),
+ "db": {**trait["db"], **trait_dataset},
+ "riset": trait_dataset["riset"]
+ }
+ return trait_info