aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn3/computations/correlations.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py
index 8eaa523..8302afc 100644
--- a/gn3/computations/correlations.py
+++ b/gn3/computations/correlations.py
@@ -1,6 +1,7 @@
"""module contains code for correlations"""
import math
import multiprocessing
+from contextlib import closing
from typing import List
from typing import Tuple
@@ -136,7 +137,7 @@ def fast_compute_all_sample_correlation(this_trait,
processed_values.append((trait_name, corr_method, *list(zip(*list(filter_shared_sample_keys(
this_trait_samples, target_trait_data))))
))
- with multiprocessing.Pool() as pool:
+ with closing(multiprocessing.Pool()) as pool:
results = pool.starmap(compute_sample_r_correlation, processed_values)
for sample_correlation in results: