aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2023-06-21 00:19:23 +0300
committerAlexander_Kabui2023-06-21 00:19:23 +0300
commit46d32a65d27a5577d7a61f76fb55c7c2f32f46d3 (patch)
tree24f979b73adc5a5cb3da09c052b9eaeb24082337
parent7a5f04106ba3df4f3268d56d8813105d31d66733 (diff)
downloadgenenetwork2-46d32a65d27a5577d7a61f76fb55c7c2f32f46d3.tar.gz
generate general info for file output
-rw-r--r--wqflask/wqflask/correlation/pre_computes.py39
1 files changed, 27 insertions, 12 deletions
diff --git a/wqflask/wqflask/correlation/pre_computes.py b/wqflask/wqflask/correlation/pre_computes.py
index c91e3862..81111a3c 100644
--- a/wqflask/wqflask/correlation/pre_computes.py
+++ b/wqflask/wqflask/correlation/pre_computes.py
@@ -210,15 +210,30 @@ def fetch_lmdb_info(db_path: str, db_target_name: str):
e.g ProbeSets: ProbestFreeze__112_
"""
# open db_read if results return none write the file write the file target
- with lmdb.open(target_file_path, readonly=True, lock=False) as env:
- with env.begin() as txn:
- target_key = __generate_file_name__(db_target_name)
- dataset = txn.get(target_key.encode())
- if dataset:
- return {
- "lmdb_target_path": f"{db_path}data.mdb",
- "lmdb_target_key": target_key,
- "file_type": "lmdb",
- }
-
- return {}
+ try:
+ with lmdb.open(target_file_path, readonly=True, lock=False) as env:
+ with env.begin() as txn:
+ target_key = __generate_file_name__(db_target_name)
+ dataset = txn.get(target_key.encode())
+ if dataset:
+ return {
+ "lmdb_target_path": f"{db_path}data.mdb",
+ "lmdb_target_key": target_key,
+ "file_type": "lmdb",
+ }
+ except Exception:
+ return {}
+
+
+def generate_general_info(trait_name, sample_names,
+ strains_vals, file_type_info):
+ if not file_type_info:
+ #! code should not be reached at this point
+ pass
+ # implement fetch code
+ return {
+ "trait_name": target_name,
+ "primary_sample_names": primary_sample_names,
+ "primary_strains_vals": strain_vals,
+ **file_type_info
+ }