Skip to content

Commit 8eeacb1

Browse files
committed
Fix for serology
- Fix for serology when `ignore_allele_with_suffixes` is on.
1 parent 97e980d commit 8eeacb1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

pyard/ard.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,6 @@ def redux(self, glstring: str, redux_type: VALID_REDUCTION_TYPES = "lgx") -> str
457457
[self.redux(a, redux_type) for a in glstring.split("/")], "/"
458458
)
459459

460-
if self._config["ignore_allele_with_suffixes"]:
461-
_, fields = glstring.split("*")
462-
if fields in self._config["ignore_allele_with_suffixes"]:
463-
return glstring
464-
465460
# Handle V2 to V3 mapping
466461
if self.is_v2(glstring):
467462
glstring = self._map_v2_to_v3(glstring)
@@ -481,7 +476,11 @@ def redux(self, glstring: str, redux_type: VALID_REDUCTION_TYPES = "lgx") -> str
481476
loc_antigen, code = loc_allele[0], loc_allele[1]
482477
else:
483478
if "*" in glstring:
484-
locus, _ = glstring.split("*")
479+
locus, fields = glstring.split("*")
480+
if self._config["ignore_allele_with_suffixes"]:
481+
if fields in self._config["ignore_allele_with_suffixes"]:
482+
return glstring
483+
485484
if locus not in G_GROUP_LOCI:
486485
return glstring
487486
raise InvalidTypingError(

tests/features/allele.feature

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,16 @@ Feature: Alleles
9494
When reducing on the <Level> level in ignore_suffix mode
9595
Then the reduced allele is found to be <Redux Allele>
9696

97-
Examples:
97+
Examples: Ignored alleles
9898
| Allele | Level | Redux Allele |
9999
| DRBX*NNNN | lgx | DRBX*NNNN |
100100
| DRBX*NNNN | G | DRBX*NNNN |
101101
| DRB1*UUUU | lg | DRB1*UUUU |
102102

103+
Examples: Serology works
104+
| Allele | Level | Redux Allele |
105+
| DR17 | lgx | DRB1*03:01/DRB1*03:04/DRB1*03:10/DRB1*03:11/DRB1*03:43 |
106+
103107
Scenario Outline: Allele validation in ignore_suffix mode
104108

105109
DRBX*NNNN is valid in ignore_suffix_mode
@@ -111,3 +115,4 @@ Feature: Alleles
111115
Examples:
112116
| Allele | Validity |
113117
| DRBX*NNNN | Valid |
118+
| DR17 | Valid |

0 commit comments

Comments
 (0)