Skip to content

Commit 8ca45a5

Browse files
authored
Merge pull request #226 from pbashyal-nmdp/batch_sero_bug
Batch reduce fixes
2 parents 91e9eac + 405c684 commit 8ca45a5

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL MAINTAINER="Pradeep Bashyal"
44

55
WORKDIR /app
66

7-
ARG PY_ARD_VERSION=1.0.0rc5
7+
ARG PY_ARD_VERSION=1.0.0rc6
88

99
COPY requirements.txt /app
1010
RUN pip install --no-cache-dir --upgrade pip && \

api-spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.0.3
22
info:
33
title: ARD Reduction
44
description: Reduce to ARD Level
5-
version: "1.0.0rc5"
5+
version: "1.0.0rc6"
66
servers:
77
- url: 'http://localhost:8080'
88
tags:

pyard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from .misc import get_imgt_db_versions as db_versions
2828

2929
__author__ = """NMDP Bioinformatics"""
30-
__version__ = "1.0.0rc5"
30+
__version__ = "1.0.0rc6"
3131

3232

3333
def init(

scripts/pyard-reduce-csv

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def remove_locus_name(reduced_allele):
106106
return "/".join(map(lambda a: a.split("*")[1], reduced_allele.split("/")))
107107

108108

109-
def reduce(allele, locus, column_name):
109+
def redux(allele, locus, column_name):
110110
# Does the allele name have the locus in it ?
111111
if allele == "":
112112
return allele
@@ -115,7 +115,13 @@ def reduce(allele, locus, column_name):
115115
elif ard_config.get("locus_in_allele_name"):
116116
locus_allele = allele
117117
else:
118-
locus_allele = f"{locus}*{allele}"
118+
if allele.startswith(locus):
119+
locus_allele = allele
120+
else:
121+
if ":" in allele:
122+
locus_allele = f"{locus}*{allele}"
123+
else:
124+
locus_allele = f"{locus}{allele}" # serology
119125

120126
# Check the config if this allele should be reduced
121127
if should_be_reduced(allele, locus_allele):
@@ -162,9 +168,9 @@ def clean_locus(allele: str, locus: str, column_name: str = "Unknown") -> str:
162168
allele = white_space_regex.sub("", allele)
163169
# If the allele comes in as an allele list, apply reduce to all alleles
164170
if "/" in allele:
165-
return "/".join(map(reduce, allele.split("/"), locus, column_name))
171+
return "/".join([redux(a, locus, column_name) for a in allele.split("/")])
166172
else:
167-
return reduce(allele, locus, column_name)
173+
return redux(allele, locus, column_name)
168174
return allele
169175

170176

@@ -189,7 +195,9 @@ def reduce_locus_columns(df, ard_config, locus_column_mapping, verbose):
189195
df.insert(
190196
new_column_index,
191197
new_column_name,
192-
df[column].apply(clean_locus, locus=locus, column_name=column),
198+
df[column].apply(
199+
clean_locus, locus=locus.upper(), column_name=column
200+
),
193201
)
194202
locus_columns[locus_columns.index(column)] = new_column_name
195203
else:

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.0rc5
2+
current_version = 1.0.0rc6
33
commit = True
44
tag = True
55

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
setup(
3838
name="py-ard",
39-
version="1.0.0rc5",
39+
version="1.0.0rc6",
4040
description="ARD reduction for HLA with Python",
4141
long_description=readme,
4242
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)