-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluation_pipeline.py
97 lines (91 loc) · 2.87 KB
/
evaluation_pipeline.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import os
import subprocess
import pandas as pd
import argparse
parser = argparse.ArgumentParser(description="Run GRNformer evaluation pipeline")
parser.add_argument("--dataset_file", type=str, required=True, help="Path to the CSV file containing input parameters")
parser.add_argument("--output_dir", type=str, required=True, help="Path to the output directory")
args = parser.parse_args()
output_dir = args.output_dir
df = pd.read_csv(args.dataset_file)
for i, row in df.iterrows():
arg1 = row["expression"]
arg2 = row["network"]
arg3 = row["geneorder"]
arg4 = row["tffile"]
arg5 = row["includetf"]
arg6 = row["numgenes"]
arg7 = row["outprefix"]
arg8 = os.path.basename(arg7)
try:
## Run the /root/miniforge3/envs/grnformer/bin/python script with arguments from the CSV row
#if [ "$arg5" -eq 1 ]; then
if arg5 == 1:
result = subprocess.run(
[
"/root/miniforge3/envs/grnformer/bin/python",
"GenerateInput.py",
"--expFile",
arg1,
"--netFile",
arg2,
"--geneOrderingFile",
arg3,
"--TFFile",
arg4,
"--TFs",
"--numGenes",
arg6,
"--outPrefix",
arg7
],
check=True,
# timeout=900,
# capture_output=True,
text=True
)
else:
result = subprocess.run(
[
"/root/miniforge3/envs/grnformer/bin/python",
"GenerateInput.py",
"--expFile",
arg1,
"--netFile",
arg2,
"--geneOrderingFile",
arg3,
"--TFFile",
arg4,
"--numGenes",
arg6,
"--outPrefix",
arg7
],
check=True,
# timeout=900,
# capture_output=True,
text=True
)
arg8 = os.path.basename(arg7)
result = subprocess.run(
[
"/root/miniforge3/envs/grnformer/bin/python",
"eval_grn.py",
"--exp_file",
output_dir+"/"+arg8+"/ExpressionData.csv",
"--tf_file",
output_dir+"/"+arg8+"/TFs.csv",
"--net_file",
output_dir+"/"+arg8+"/refNetwork.csv",
"--output_file",
output_dir+"/"+arg8+"/predictedNetwork.csv",
],
check=True,
# timeout=900,
# capture_output=True,
text=True
)
except Exception as e:
print("Failed to process:", arg7)
print(e)