Skip to content

Commit

Permalink
Merge pull request #47 from pbashyal-nmdp/issue39_P_and_G_group
Browse files Browse the repository at this point in the history
G and P alleles
  • Loading branch information
mmaiers-nmdp committed Sep 8, 2020
2 parents 73e372f + ff34c71 commit 8fc34f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pyard/pyard.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,15 @@ def redux(self, allele: str, ars_type: str) -> str:
"""

# PERFORMANCE: precompiled regex
# dealing with leading HLA-

# dealing with leading 'HLA-'
if self.HLA_regex.search(allele):
hla, allele_name = allele.split("-")
return "-".join(["HLA", self.redux(allele_name, ars_type)])

# Alleles ending with P or G are valid
if allele.endswith(('P', 'G')):
allele = allele[:-1]

if ars_type == "G" and allele in self._G:
if allele in self.dup_g:
return self.dup_g[allele]
Expand Down Expand Up @@ -498,6 +501,9 @@ def isvalid(self, allele: str) -> bool:
if not ismac(allele):
# PERFORMANCE: use hash instead of allele in "list"
# return allele in self.valid
# Alleles ending with P or G are valid
if allele.endswith(('P', 'G')):
allele = allele[:-1]
return self.valid_dict.get(allele, False)
return True

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

setup(
name='py-ard',
version='0.0.19',
version='0.0.20',
description="ARD reduction for HLA with python",
long_description=readme + '\n\n' + history,
author="CIBMTR",
Expand Down

0 comments on commit 8fc34f3

Please sign in to comment.