Skip to content

Commit 8096ea2

Browse files
committed
Filter out loci with no Serology mappings.
Add Test
1 parent 0fdce35 commit 8096ea2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pyard/ard.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,11 @@ def _sorted_unique_gl(self, gls: List[str], delim: str) -> str:
328328

329329
if delim == "+":
330330
# No need to make unique. eg. homozygous cases are valid for SLUGs
331+
non_empty_gls = filter(lambda s: s != "", gls)
331332
return delim.join(
332-
sorted(gls, key=functools.cmp_to_key(self.smart_sort_comparator))
333+
sorted(
334+
non_empty_gls, key=functools.cmp_to_key(self.smart_sort_comparator)
335+
)
333336
)
334337

335338
# generate a unique list over a delimiter

tests/features/serology_redux.feature

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ Feature: Serology Reduction
2424
| B*15:01/B*15:02/B*15:03/B*15:04 | S | B15/B62/B70/B72/B75 |
2525
| B*15:10 | S | B15/B70/B71 |
2626
| A*24:03/A*24:10/A*24:23/A*24:33/A*24:374 | S | A9/A24/A2403 |
27+
28+
29+
Examples: Skip Loci that don't have Serology mappings
30+
| Allele | Level | Redux Serology |
31+
| A*01:01+A*01:01^B*08:ASXJP+B*07:02^C*02:02+C*07:HTGM^DPB1*28:01:01G+DPB1*296:01 | S | A1+A1^B7+B8^Cw2+Cw7 |

0 commit comments

Comments
 (0)