aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/rust_correlation.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/gn3/computations/rust_correlation.py b/gn3/computations/rust_correlation.py
index a3802ae..e739382 100644
--- a/gn3/computations/rust_correlation.py
+++ b/gn3/computations/rust_correlation.py
@@ -4,10 +4,30 @@ from gn3.settings import CORRELATION_COMMAND
from gn3.settings import TMPDIR
-def run_correlation(file_name: & str, outputdir: str = TMPDIR):
+def run_correlation(file_name: str, outputdir: str = TMPDIR):
command_list = [CORRELATION_COMMAND, file_name, outputdir]
results = subprocess.run(command_list, check=True)
return results
+
+
+def parse_correlation_output(result_file: str):
+
+ corr_results = []
+
+ with open(result_file, "r") as file_reader:
+
+ for line in file_reader:
+
+ (trait_name, corr_coeff, p_val) = line.rstrip().split(",")
+ corr_data = {
+ "trait_name": trait_name,
+ "corr_coeff": corr_coeff,
+ "p_val": p_val
+ }
+
+ corr_results.append(corr_data)
+
+ return corr_results