From a3c0a12584a22a834ece5baa08702320db74242f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 9 Sep 2022 13:41:03 +0300 Subject: Check whether trait_list and sample_data exist before operations --- wqflask/wqflask/correlation/rust_correlation.py | 5 +++++ 1 file changed, 5 insertions(+) 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: -- cgit v1.2.3