Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --cwd and --validate options to pyard command #244

Merged
merged 2 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL MAINTAINER="Pradeep Bashyal"

WORKDIR /app

ARG PY_ARD_VERSION=1.0.0
ARG PY_ARD_VERSION=1.0.1

COPY requirements.txt /app
RUN pip install --no-cache-dir --upgrade pip && \
Expand Down
2 changes: 1 addition & 1 deletion api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: ARD Reduction
description: Reduce to ARD Level
version: "1.0.0"
version: "1.0.1"
servers:
- url: 'http://localhost:8080'
tags:
Expand Down
2 changes: 1 addition & 1 deletion pyard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from .misc import get_imgt_db_versions as db_versions

__author__ = """NMDP Bioinformatics"""
__version__ = "1.0.0"
__version__ = "1.0.1"


def init(
Expand Down
31 changes: 26 additions & 5 deletions scripts/pyard
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import sys

from pyard.constants import VALID_REDUCTION_TYPES
import pyard.misc
from pyard.exceptions import InvalidAlleleError
from pyard.exceptions import InvalidAlleleError, InvalidTypingError
from pyard.misc import get_data_dir, get_imgt_version

if __name__ == "__main__":
Expand Down Expand Up @@ -63,6 +63,13 @@ if __name__ == "__main__":
help="Reduction Method",
)
parser.add_argument("--splits", dest="splits", help="Find Broad and Splits")
parser.add_argument(
"--validate",
dest="validate",
action="store_true",
help="Validate the provided GL String",
)
parser.add_argument("--cwd", dest="cwd", help="Perform CWD redux")

args = parser.parse_args()

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

try:
if args.validate:
ard.validate(args.cwd)
if args.cwd:
if args.validate:
ard.validate(args.cwd)
cwd_redux = ard.cwd_redux(args.cwd)
print(cwd_redux)
sys.exit(0)

if args.redux_type:
print(ard.redux(args.gl_string, args.redux_type))
else:
Expand All @@ -93,7 +109,12 @@ if __name__ == "__main__":
print(ard.redux(args.gl_string, redux_type))
print()
except InvalidAlleleError as e:
print("Error:", e)

# Remove ard and close db connection
del ard
print("Allele Error:", e.message, file=sys.stderr)
sys.exit(1)
except InvalidTypingError as e:
print("Typing Error:", e.message, file=sys.stderr)
sys.exit(2)
else:
# Remove ard and close db connection
print("Removing")
del ard
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.0
current_version = 1.0.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

setup(
name="py-ard",
version="1.0.0",
version="1.0.1",
description="ARD reduction for HLA with Python",
long_description=readme,
long_description_content_type="text/markdown",
Expand Down