-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_test.py
46 lines (35 loc) · 1.42 KB
/
run_test.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
import argparse
import os
import shutil
from subprocess import Popen, PIPE, DEVNULL, STDOUT
DEBUG = 1
def execute_command(cmd):
"""Wrapper for executing CLI commands.
Args:
cmd (str): Command to execute.
"""
if (DEBUG):
print(cmd)
process = Popen(cmd, shell=True, stdout=PIPE)
else:
process = Popen(cmd, shell=True, stdout=DEVNULL, stderr=STDOUT)
process.communicate()
return cmd
parser = argparse.ArgumentParser(description='HiCDiffusion test pipeline.')
parser.add_argument('-v', '--val_chr', required=True)
parser.add_argument('-t', '--test_chr', required=True)
parser.add_argument('-f', '--file', required=False)
args = parser.parse_args()
print("Running HiCDiffusion test pipeline. The configuration:")
print(args)
print()
hic_filename = args.file
if not(hic_filename is None):
filename_prefix = "_"+hic_filename
else:
filename_prefix = ""
if not(hic_filename is None):
hic_filename = f"-f {hic_filename}"
else:
hic_filename = ""
execute_command(f"sbatch --dependency=singleton --job-name=HiCDiffusion{filename_prefix}_test_{args.test_chr}_val_{args.val_chr} --output=models/hicdiffusion{filename_prefix}_test_{args.test_chr}_val_{args.val_chr}/test_hicdiffusion.log test_hicdiffusion.slurm -t {args.test_chr} -v {args.val_chr} -m models/hicdiffusion{filename_prefix}_test_{args.test_chr}_val_{args.val_chr}/best_val_loss_hicdiffusion.ckpt {hic_filename}")