Skip to content

Commit 8fc34f3

Browse files
authored
Merge pull request #47 from pbashyal-nmdp/issue39_P_and_G_group
G and P alleles
2 parents 73e372f + ff34c71 commit 8fc34f3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pyard/pyard.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,15 @@ def redux(self, allele: str, ars_type: str) -> str:
393393
"""
394394

395395
# PERFORMANCE: precompiled regex
396-
# dealing with leading HLA-
397-
396+
# dealing with leading 'HLA-'
398397
if self.HLA_regex.search(allele):
399398
hla, allele_name = allele.split("-")
400399
return "-".join(["HLA", self.redux(allele_name, ars_type)])
401400

401+
# Alleles ending with P or G are valid
402+
if allele.endswith(('P', 'G')):
403+
allele = allele[:-1]
404+
402405
if ars_type == "G" and allele in self._G:
403406
if allele in self.dup_g:
404407
return self.dup_g[allele]
@@ -498,6 +501,9 @@ def isvalid(self, allele: str) -> bool:
498501
if not ismac(allele):
499502
# PERFORMANCE: use hash instead of allele in "list"
500503
# return allele in self.valid
504+
# Alleles ending with P or G are valid
505+
if allele.endswith(('P', 'G')):
506+
allele = allele[:-1]
501507
return self.valid_dict.get(allele, False)
502508
return True
503509

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.19',
45+
version='0.0.20',
4646
description="ARD reduction for HLA with python",
4747
long_description=readme + '\n\n' + history,
4848
author="CIBMTR",

0 commit comments

Comments
 (0)