blob: e7393829d3cdfb3319de9c22f0d000b5e220fcc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import subprocess
from gn3.settings import CORRELATION_COMMAND
from gn3.settings import 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
|