-
Notifications
You must be signed in to change notification settings - Fork 2
/
convLION.py
65 lines (51 loc) · 1.75 KB
/
convLION.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
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016-2019 SysMedOs_team @ AG Bioanalytik, University of Leipzig:
# SysMedOs_team: Zhixu Ni, Georgia Angelidou, Mike Lange, Maria Fedorova
#
# For more info please contact:
# Developer Zhixu Ni zhixu.ni@uni-leipzig.de
import getopt
import os.path
import sys
from epilion.libLION.DefaultParams import abbr_cfg_path, logger
from epilion.libLION.Converter import Converter
# required to perform multiprocessing
# import multiprocessing
def main(argv):
"""
:param argv: -i <input epiLION abbreviation file in .txt format>
"""
in_file = ''
out_file = ''
is_output = False
try:
opts, args = getopt.getopt(argv, "hi:o:", ["infile=", "outfile="])
logger.debug(f'User input: {opts}, {args}')
except getopt.GetoptError:
logger.info('epiLIONConverter.py -i <input_file> -o <output_file>')
return is_output
for opt, arg in opts:
if opt == '-h':
logger.info('epiLIONConverter.py -i <input_file> -o <output_file>')
return is_output
elif opt in ("-i", "--infile"):
in_file = arg
elif opt in ("-o", "--outfile"):
out_file = arg
if os.path.isfile(in_file):
logger.info(f'Load input file: {in_file}')
converter = Converter(abbr_cfg_path)
converter.convert_table(in_file, out_file)
logger.info(f'Save output file: {out_file}')
logger.info('FINISHED')
is_output = True
logger.info(f'is_output {is_output}')
else:
logger.error(f'Can NOT open input file:')
logger.error(in_file)
logger.error('!!! FAILED to PROCESS !!!')
return is_output
if __name__ == "__main__":
# multiprocessing.freeze_support()
main(sys.argv[1:])