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/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/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", 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"), "")