Skip to content

Commit 8ec005e

Browse files
authored
Merge pull request nmdp-bioinformatics#244 from pbashyal-nmdp/pyard_cli
Add `--cwd` and `--validate` options to pyard command
2 parents 8354471 + a9cde44 commit 8ec005e

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL MAINTAINER="Pradeep Bashyal"
44

55
WORKDIR /app
66

7-
ARG PY_ARD_VERSION=1.0.0
7+
ARG PY_ARD_VERSION=1.0.1
88

99
COPY requirements.txt /app
1010
RUN pip install --no-cache-dir --upgrade pip && \

api-spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.0.3
22
info:
33
title: ARD Reduction
44
description: Reduce to ARD Level
5-
version: "1.0.0"
5+
version: "1.0.1"
66
servers:
77
- url: 'http://localhost:8080'
88
tags:

pyard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from .misc import get_imgt_db_versions as db_versions
2828

2929
__author__ = """NMDP Bioinformatics"""
30-
__version__ = "1.0.0"
30+
__version__ = "1.0.1"
3131

3232

3333
def init(

scripts/pyard

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import sys
2626

2727
from pyard.constants import VALID_REDUCTION_TYPES
2828
import pyard.misc
29-
from pyard.exceptions import InvalidAlleleError
29+
from pyard.exceptions import InvalidAlleleError, InvalidTypingError
3030
from pyard.misc import get_data_dir, get_imgt_version
3131

3232
if __name__ == "__main__":
@@ -63,6 +63,13 @@ if __name__ == "__main__":
6363
help="Reduction Method",
6464
)
6565
parser.add_argument("--splits", dest="splits", help="Find Broad and Splits")
66+
parser.add_argument(
67+
"--validate",
68+
dest="validate",
69+
action="store_true",
70+
help="Validate the provided GL String",
71+
)
72+
parser.add_argument("--cwd", dest="cwd", help="Perform CWD redux")
6673

6774
args = parser.parse_args()
6875

@@ -83,6 +90,15 @@ if __name__ == "__main__":
8390
sys.exit(0)
8491

8592
try:
93+
if args.validate:
94+
ard.validate(args.cwd)
95+
if args.cwd:
96+
if args.validate:
97+
ard.validate(args.cwd)
98+
cwd_redux = ard.cwd_redux(args.cwd)
99+
print(cwd_redux)
100+
sys.exit(0)
101+
86102
if args.redux_type:
87103
print(ard.redux(args.gl_string, args.redux_type))
88104
else:
@@ -93,7 +109,12 @@ if __name__ == "__main__":
93109
print(ard.redux(args.gl_string, redux_type))
94110
print()
95111
except InvalidAlleleError as e:
96-
print("Error:", e)
97-
98-
# Remove ard and close db connection
99-
del ard
112+
print("Allele Error:", e.message, file=sys.stderr)
113+
sys.exit(1)
114+
except InvalidTypingError as e:
115+
print("Typing Error:", e.message, file=sys.stderr)
116+
sys.exit(2)
117+
else:
118+
# Remove ard and close db connection
119+
print("Removing")
120+
del ard

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.0
2+
current_version = 1.0.1
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
setup(
3838
name="py-ard",
39-
version="1.0.0",
39+
version="1.0.1",
4040
description="ARD reduction for HLA with Python",
4141
long_description=readme,
4242
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)