aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-09-09 13:41:03 +0300
committerFrederick Muriuki Muriithi2022-09-09 13:41:03 +0300
commita3c0a12584a22a834ece5baa08702320db74242f (patch)
tree3429d01a9f61841341bb67d6050fdaf1f1875052
parent8eec2b879273b9e1a83f946bc784c03383a20595 (diff)
downloadgenenetwork2-a3c0a12584a22a834ece5baa08702320db74242f.tar.gz
Check whether trait_list and sample_data exist before operations
-rw-r--r--wqflask/wqflask/correlation/rust_correlation.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py
index 775f4ee9..ef3988e5 100644
--- a/wqflask/wqflask/correlation/rust_correlation.py
+++ b/wqflask/wqflask/correlation/rust_correlation.py
@@ -20,6 +20,9 @@ from gn3.db_utils import database_connector
def query_probes_metadata(dataset, trait_list):
"""query traits metadata in bulk for probeset"""
+ if not bool(trait_list):
+ return []
+
with database_connector() as conn:
with conn.cursor() as cursor:
@@ -221,6 +224,8 @@ def __compute_sample_corr__(
sample_data = get_sample_corr_data(
sample_type=start_vars["corr_samples_group"], all_samples=all_samples,
dataset_samples=this_dataset.group.all_samples_ordered())
+ if not bool(sample_data):
+ return {}
if target_dataset.type == "ProbeSet":
with database_connector() as conn: