Skip to content

Commit b8717e2

Browse files
committed
- Add -v option also shows the py-ard version
- if `-r` isn't provided, it shows reductions for all types
1 parent e5baf42 commit b8717e2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/pyard

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import argparse
2525
import sys
2626

2727
import pyard
28+
from pyard.exceptions import InvalidAlleleError
2829

2930

3031
def get_imgt_version(imgt_version):
@@ -77,6 +78,7 @@ if __name__ == "__main__":
7778
if args.version:
7879
version = ard.get_db_version()
7980
print(f"IPD-IMGT/HLA version:", version)
81+
print(f"py-ard version:", pyard.__version__)
8082
sys.exit(0)
8183

8284
if args.splits:
@@ -85,5 +87,17 @@ if __name__ == "__main__":
8587
print(f"{mapping[0]} = {'/'.join(mapping[1])}")
8688
sys.exit(0)
8789

88-
print(ard.redux_gl(args.gl_string, args.redux_type))
90+
try:
91+
if args.redux_type:
92+
print(ard.redux_gl(args.gl_string, args.redux_type))
93+
else:
94+
for redux_type in pyard.pyard.reduction_types:
95+
redux_type_info = f"Reduction Method: {redux_type}"
96+
print(redux_type_info)
97+
print("-" * len(redux_type_info))
98+
print(ard.redux_gl(args.gl_string, redux_type))
99+
except InvalidAlleleError as e:
100+
print("Error:", e)
101+
102+
# Remove ard and close db connection
89103
del ard

0 commit comments

Comments
 (0)