-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmparser_cli.py
38 lines (33 loc) · 1.62 KB
/
mparser_cli.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
# -*- coding: utf-8 -*-
"""
mparser_cli.py
Command Line Interface
Reads a metabolic network
Performs the requested conversion
"""
from mparser import OutputFormatType, InputFormatType
from mparser import convert
from argparse import ArgumentParser
import sys
parser = ArgumentParser()
parser.add_argument('informat', type=InputFormatType, choices=list(InputFormatType), help='Input format type')
parser.add_argument('infile', help='Input file name')
parser.add_argument('outformat', type=OutputFormatType, choices=list(OutputFormatType), help='Output format type')
parser.add_argument('outfile', help='Output file name')
parser.add_argument('--compression-dict', help='Compression correspondance dict file name')
parser.add_argument('--compress', help='Enables metabolic network compression', action='store_true')
parser.add_argument('--target-reactions', help='Target reactions for computing Minimal Cut Sets', default=[])
parser.add_argument('--ballerstein', help='Enables Ballerstein formulation for Minimal Cut Sets', action='store_true')
parser.add_argument('--to-dual-mcs', action='store_true', help='Convert to dual network for computing Minimal Cut Sets')
opts = parser.parse_args()
in_format = opts.informat
in_name = opts.infile
out_format = opts.outformat
out_name = opts.outfile
compress = opts.compress
compression_dict = opts.compression_dict
to_dual_mcs = opts.to_dual_mcs
ballerstein = opts.ballerstein
target_reactions = opts.target_reactions
if target_reactions: target_reactions = target_reactions.split(',')
convert(in_format, in_name, out_format, out_name, compress, compression_dict, to_dual_mcs, target_reactions, ballerstein)