-
Notifications
You must be signed in to change notification settings - Fork 1
/
yconvert.py
30 lines (24 loc) · 1.31 KB
/
yconvert.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
import os
import sys
from pyymir import *
DIRNAME = os.path.dirname(sys.argv[0])
DIRNAME = DIRNAME if DIRNAME else "./"
if __name__ == "__main__":
ap = default_ymir_ap()
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--input", nargs = "+", help = "input file (text or gzipped) or a folder with input files (of the same format) or a list of space-separated files and/or folders in any combinations", type = str, default = "")
ap.add_argument("-f", "--format", help = "format of input files (tcR, MiTCR, MiGEC, etc.) as an alias or as a Python 3 class from your module linked to the '$YMIR_HOME/converters' package. For a list of possible input formats and their aliases in this Ymir distribution run $python3 pyymir.py -f", type = str, default = "")
args = ap.parse_args()
files, input_check = parse_input(args)
converter, format_check = parse_format(args)
print()
if input_check and format_check:
for i in range(len(files)):
print(i + 1, " / ", len(files), ":")
conv_file, convert_flag = convert(files[i], converter)
if convert_flag:
print("Successfully converted.")
else:
print("Convertation failed, skipping the file.")
else:
print("Can't process further, too many errors for me! x_x")