Skip to content

Commit b16c2f8

Browse files
committed
Fix for little g as input (WIP)
1 parent 965d409 commit b16c2f8

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

pyard/ard.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,14 @@ def _redux_allele(
204204
# C*12:02:02 => C*12:02:01G
205205
# C*12:02 => C*12:02:01G
206206

207+
# Remove little 'g' before processing
208+
# if allele.endswith('g'):
209+
# allele = allele[:-1]
210+
207211
if allele.endswith(("P", "G")):
208212
if redux_type in ["lg", "lgx", "G"]:
209213
allele = allele[:-1]
214+
210215
if self._config["ping"] and re_ping:
211216
# ping: alleles that are in P group but not in G groups are defined
212217
# for 2-field alleles. If not already in 2-field form, reduce it to
@@ -810,6 +815,10 @@ def _is_valid_allele(self, allele):
810815
@param allele:
811816
@return:
812817
"""
818+
# Alleles ending with little 'g' are valid_alleles
819+
if allele.endswith("g"):
820+
# remove the 'g' character
821+
allele = allele[:-1]
813822
# Alleles ending with P or G are valid_alleles
814823
if allele.endswith(("P", "G")):
815824
# remove the last character

tests/features/allele.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,17 @@ Feature: Alleles
8888
| MICA*040 | lgx | MICA*040 |
8989
| MICB*006 | lgx | MICB*006 |
9090
| MICB*029 | lgx | MICB*029 |
91+
92+
93+
Scenario Outline: Alleles with little 'g'
94+
95+
Alleles that are little 'g' are valid alleles.
96+
97+
Given the allele as <Allele>
98+
When reducing on the <Level> level
99+
Then the reduced allele is found to be <Redux Allele>
100+
101+
Examples:
102+
| Allele | Level | Redux Allele |
103+
| A*30:02g | lgx | A*30:02 |
104+
| HLA-A*01:01g | G | HLA-A*01:01:01G |

tests/features/p_g_group.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Feature: P and G Groups
2323

2424
Examples:
2525
| Allele | Level | Redux Allele |
26+
| DQA1*03:03:09 | lg | DQA1*03:03g |
2627
| C*06:17 | lgx | C*06:02 |
2728

2829
Examples: DRB4*01s

0 commit comments

Comments
 (0)