From 6dac9c4bf1d405cfcc4e2a84fcd7c401e175173e Mon Sep 17 00:00:00 2001 From: pbashyal-nmdp Date: Wed, 9 Sep 2020 09:22:08 -0500 Subject: [PATCH 1/2] Fix Inconsistent results with `HLA-` prefix --- pyard/pyard.py | 9 ++++++--- tests/test_pyard.py | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyard/pyard.py b/pyard/pyard.py index be23f42..cc23aee 100644 --- a/pyard/pyard.py +++ b/pyard/pyard.py @@ -392,11 +392,14 @@ def redux(self, allele: str, ars_type: str) -> str: :rtype: str """ - # PERFORMANCE: precompiled regex - # dealing with leading 'HLA-' + # deal with leading 'HLA-' if self.HLA_regex.search(allele): hla, allele_name = allele.split("-") - return "-".join(["HLA", self.redux(allele_name, ars_type)]) + redux_allele = self.redux(allele_name, ars_type) + if redux_allele: + return "HLA-" + redux_allele + else: + return redux_allele # Alleles ending with P or G are valid if allele.endswith(('P', 'G')): diff --git a/tests/test_pyard.py b/tests/test_pyard.py index 5b665fa..f2c707b 100644 --- a/tests/test_pyard.py +++ b/tests/test_pyard.py @@ -76,3 +76,5 @@ def test_redux_gl(self): def test_mac_G(self): self.assertEqual(self.ard.redux("A*01:01:01", 'G'), "A*01:01:01G") + self.assertEqual(self.ard.redux_gl("HLA-A*01:AB", "G"), "HLA-A*01:01:01G/HLA-A*01:02") + self.assertEqual(self.ard.redux("HLA-A*01:AB", "G"), "") From 67af21233accf4286fea65bab9235f4ba7781a41 Mon Sep 17 00:00:00 2001 From: pbashyal-nmdp Date: Wed, 9 Sep 2020 09:22:15 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Bump=20version:=200.0.21=20=E2=86=92=200.0.?= =?UTF-8?q?22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyard/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyard/__init__.py b/pyard/__init__.py index cb7e264..60ff9e3 100644 --- a/pyard/__init__.py +++ b/pyard/__init__.py @@ -25,4 +25,4 @@ from .pyard import ARD __author__ = """NMDP Bioinformatics""" -__version__ = '0.0.21' +__version__ = '0.0.22' diff --git a/setup.cfg b/setup.cfg index be5a281..4152a3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.21 +current_version = 0.0.22 commit = True tag = True diff --git a/setup.py b/setup.py index 0671864..3ecf3a1 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( name='py-ard', - version='0.0.21', + version='0.0.22', description="ARD reduction for HLA with python", long_description=readme + '\n\n' + history, author="CIBMTR",