Skip to content

Commit 1871f59

Browse files
committed
Add reduce_2field option to csv batch
1 parent 2c58147 commit 1871f59

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

extras/reduce_conf.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"reduce_serology": false,
3131
"reduce_v2": true,
3232
"convert_v2_to_v3": false,
33+
"reduce_2field": true,
3334
"reduce_3field": true,
3435
"reduce_P": true,
3536
"reduce_XX": false,

scripts/pyard-reduce-csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def is_3field(allele: str) -> bool:
4848
return len(allele.split(':')) > 2
4949

5050

51+
def is_2field(allele: str) -> bool:
52+
return len(allele.split(':')) == 2
53+
54+
5155
def is_P(allele: str) -> bool:
5256
if allele.endswith('P'):
5357
fields = allele.split(':')
@@ -68,6 +72,10 @@ def should_be_reduced(allele, locus_allele):
6872
if ard.is_v2(locus_allele):
6973
return True
7074

75+
if ard_config["reduce_2field"]:
76+
if is_2field(locus_allele):
77+
return True
78+
7179
if ard_config["reduce_3field"]:
7280
if is_3field(locus_allele):
7381
return True

0 commit comments

Comments
 (0)