-
Notifications
You must be signed in to change notification settings - Fork 53
/
BLRunner.py
77 lines (59 loc) · 1.74 KB
/
BLRunner.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
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import yaml
import argparse
import itertools
from collections import defaultdict
from pathlib import Path
import multiprocessing
from multiprocessing import Pool, cpu_count
import concurrent.futures
import yaml
import argparse
import itertools
from collections import defaultdict
from pathlib import Path
import multiprocessing
from multiprocessing import Pool, cpu_count
import concurrent.futures
from typing import Dict, List
from BLRun.runner import Runner
import os
import pandas as pd
import BLRun as br
yaml.warnings({'YAMLLoadWarning': False})
def get_parser() -> argparse.ArgumentParser:
'''
:return: an argparse ArgumentParser object for parsing command
line parameters
'''
parser = argparse.ArgumentParser(
description='Run pathway reconstruction pipeline.')
parser.add_argument('--config', default='config.yaml',
help='Path to config file')
return parser
def parse_arguments():
'''
Initialize a parser and use it to parse the command line arguments
:return: parsed dictionary of command line arguments
'''
parser = get_parser()
opts = parser.parse_args()
return opts
def main():
opts = parse_arguments()
config_file = opts.config
with open(config_file, 'r') as conf:
evaluation = br.ConfigParser.parse(conf)
print(evaluation)
print('Evaluation started')
for idx in range(len(evaluation.runners)):
evaluation.runners[idx].generateInputs()
for idx in range(len(evaluation.runners)):
evaluation.runners[idx].run()
for idx in range(len(evaluation.runners)):
evaluation.runners[idx].parseOutput()
print('Evaluation complete')
if __name__ == '__main__':
main()