Skip to content

Commit 70a2734

Browse files
authored
Merge pull request #52 from pbashyal-nmdp/51_inconsistent_results_with_HLA_prefix
Fix inconsistent results with hla prefix
2 parents f034eb8 + 67af212 commit 70a2734

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

pyard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
from .pyard import ARD
2626

2727
__author__ = """NMDP Bioinformatics"""
28-
__version__ = '0.0.21'
28+
__version__ = '0.0.22'

pyard/pyard.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,14 @@ def redux(self, allele: str, ars_type: str) -> str:
392392
:rtype: str
393393
"""
394394

395-
# PERFORMANCE: precompiled regex
396-
# dealing with leading 'HLA-'
395+
# deal with leading 'HLA-'
397396
if self.HLA_regex.search(allele):
398397
hla, allele_name = allele.split("-")
399-
return "-".join(["HLA", self.redux(allele_name, ars_type)])
398+
redux_allele = self.redux(allele_name, ars_type)
399+
if redux_allele:
400+
return "HLA-" + redux_allele
401+
else:
402+
return redux_allele
400403

401404
# Alleles ending with P or G are valid
402405
if allele.endswith(('P', 'G')):

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 = 0.0.21
2+
current_version = 0.0.22
33
commit = True
44
tag = True
55

setup.py

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

4343
setup(
4444
name='py-ard',
45-
version='0.0.21',
45+
version='0.0.22',
4646
description="ARD reduction for HLA with python",
4747
long_description=readme + '\n\n' + history,
4848
author="CIBMTR",

tests/test_pyard.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,5 @@ def test_redux_gl(self):
7676

7777
def test_mac_G(self):
7878
self.assertEqual(self.ard.redux("A*01:01:01", 'G'), "A*01:01:01G")
79+
self.assertEqual(self.ard.redux_gl("HLA-A*01:AB", "G"), "HLA-A*01:01:01G/HLA-A*01:02")
80+
self.assertEqual(self.ard.redux("HLA-A*01:AB", "G"), "")

0 commit comments

Comments
 (0)