Skip to content

Commit 49c135a

Browse files
committed
Fix for HFE alleles
1 parent a667748 commit 49c135a

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

pyard/ard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def is_v2(self, allele: str) -> bool:
540540
self._config["reduce_v2"]
541541
and "*" in allele
542542
and ":" not in allele
543-
and allele.split("*")[0] not in ["MICA", "MICB"]
543+
and allele.split("*")[0] not in ["MICA", "MICB", "HFE"]
544544
and allele != self._map_v2_to_v3(allele)
545545
)
546546

pyard/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
VALID_REDUCTION_TYPES = ("G", "P", "lg", "lgx", "W", "exon", "U2", "S")
2929
expression_chars = ("N", "Q", "L", "S")
3030
# List of P and G characters
31-
PandG_chars = ["P", "G"]
31+
P_and_G_chars = ("P", "G")
3232

3333
# Loci with G group data
3434
# Retrieved from lgx_group

pyard/misc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import tempfile
2525
from typing import List
2626

27-
from pyard.constants import VALID_REDUCTION_TYPES, expression_chars, PandG_chars
27+
from pyard.constants import VALID_REDUCTION_TYPES, expression_chars, P_and_G_chars
2828

2929

3030
def get_n_field_allele(allele: str, n: int, preserve_expression=False) -> str:
@@ -47,15 +47,15 @@ def get_n_field_allele(allele: str, n: int, preserve_expression=False) -> str:
4747

4848
def get_3field_allele(a: str) -> str:
4949
last_char = a[-1]
50-
if last_char in PandG_chars:
50+
if last_char in P_and_G_chars:
5151
a = a[:-1]
5252

5353
return get_n_field_allele(a, 3)
5454

5555

5656
def get_2field_allele(a: str) -> str:
5757
last_char = a[-1]
58-
if last_char in PandG_chars:
58+
if last_char in P_and_G_chars:
5959
a = a[:-1]
6060
return get_n_field_allele(a, 2)
6161

@@ -76,7 +76,7 @@ def is_2_field_allele(allele: str) -> bool:
7676
def get_G_name(a: str) -> str:
7777
a = a.split("/")[0]
7878
last_char = a[-1]
79-
if last_char in PandG_chars + expression_chars:
79+
if last_char in P_and_G_chars + expression_chars:
8080
a = a[:-1]
8181
if len(a.split(":")) == 2:
8282
return ":".join([a, "01"]) + "G"
@@ -88,7 +88,7 @@ def get_G_name(a: str) -> str:
8888
def get_P_name(a: str) -> str:
8989
a = a.split("/")[0]
9090
last_char = a[-1]
91-
if last_char in PandG_chars + expression_chars:
91+
if last_char in P_and_G_chars + expression_chars:
9292
a = a[:-1]
9393
return ":".join(a.split(":")[0:2]) + "P"
9494

tests/features/allele.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Feature: Alleles
8383

8484
Examples:
8585
| Allele | Level | Redux Allele |
86+
| HFE*002 | lgx | HFE*002 |
8687
| MICA*040 | lgx | MICA*040 |
8788
| MICB*006 | lgx | MICB*006 |
8889
| MICB*029 | lgx | MICB*029 |

0 commit comments

Comments
 (0)