From 31c6412b19a10cfb78a3f3294e6acec9811a7ee8 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 28 Nov 2021 19:01:16 +0300 Subject: fix bug:unpacking error when generator returns empty list --- gn3/computations/correlations.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index c5c56db..2f79c4a 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -79,9 +79,12 @@ def compute_sample_r_correlation(trait_name, corr_method, trait_vals, """ - sanitized_traits_vals, sanitized_target_vals = list( - zip(*list(normalize_values(trait_vals, target_samples_vals)))) - num_overlap = len(sanitized_traits_vals) + try: + sanitized_traits_vals, sanitized_target_vals = list( + zip(*list(normalize_values(trait_vals, target_samples_vals)))) + num_overlap = len(sanitized_traits_vals) + except ValueError: + return if num_overlap > 5: -- cgit v1.2.3