aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/correlations.py
diff options
context:
space:
mode:
authorAlexander Kabui2021-12-01 10:03:03 +0300
committerBonfaceKilz2021-12-10 09:58:29 +0300
commit7b63fb20154801d658150fcb41262a7c9f108183 (patch)
treef6533f60d417bd3244eacf7d79f18404947f57e2 /gn3/computations/correlations.py
parent3e22ff2d9f21316060893d47f0b014bdaf4ab359 (diff)
downloadgenenetwork3-7b63fb20154801d658150fcb41262a7c9f108183.tar.gz
minor pr fixes
Diffstat (limited to 'gn3/computations/correlations.py')
-rw-r--r--gn3/computations/correlations.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py
index 15ee1fa..d95ecee 100644
--- a/gn3/computations/correlations.py
+++ b/gn3/computations/correlations.py
@@ -132,9 +132,16 @@ def fast_compute_all_sample_correlation(this_trait,
for target_trait in target_dataset:
trait_name = target_trait.get("trait_id")
target_trait_data = target_trait["trait_sample_data"]
- processed_values.append((trait_name, corr_method,
- list(zip(*list(filter_shared_sample_keys(
- this_trait_samples, target_trait_data))))))
+
+ try:
+ this_vals, target_vals = list(zip(*list(filter_shared_sample_keys(
+ this_trait_samples, target_trait_data))))
+
+ processed_values.append(
+ (trait_name, corr_method, this_vals, target_vals))
+ except ValueError:
+ continue
+
with closing(multiprocessing.Pool()) as pool:
results = pool.starmap(compute_sample_r_correlation, processed_values)
@@ -173,7 +180,7 @@ def compute_all_sample_correlation(this_trait,
except ValueError:
# case where no matching strain names
- this_vals, target_vals = []
+ continue
sample_correlation = compute_sample_r_correlation(
trait_name=trait_name,