Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -380,21 +380,27 @@ def generate_specificity(confident_alleles, bead_hla_map):
|
|
| 380 |
if sero:
|
| 381 |
sero_groups.setdefault(sero, set()).add(ag)
|
| 382 |
|
| 383 |
-
# 排序
|
|
|
|
| 384 |
def sort_key(s):
|
| 385 |
if s.startswith('A'):
|
| 386 |
-
|
| 387 |
elif s.startswith('B'):
|
| 388 |
-
|
| 389 |
elif s.startswith('Cw'):
|
| 390 |
-
|
| 391 |
elif s.startswith('DR'):
|
| 392 |
-
|
| 393 |
elif s.startswith('DQ'):
|
| 394 |
-
|
| 395 |
elif s.startswith('DP'):
|
| 396 |
-
|
| 397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
|
| 399 |
parts = []
|
| 400 |
|
|
|
|
| 380 |
if sero:
|
| 381 |
sero_groups.setdefault(sero, set()).add(ag)
|
| 382 |
|
| 383 |
+
# 排序: 按 locus 再按數字
|
| 384 |
+
import re as _re
|
| 385 |
def sort_key(s):
|
| 386 |
if s.startswith('A'):
|
| 387 |
+
locus = 0
|
| 388 |
elif s.startswith('B'):
|
| 389 |
+
locus = 1
|
| 390 |
elif s.startswith('Cw'):
|
| 391 |
+
locus = 2
|
| 392 |
elif s.startswith('DR'):
|
| 393 |
+
locus = 0
|
| 394 |
elif s.startswith('DQ'):
|
| 395 |
+
locus = 1
|
| 396 |
elif s.startswith('DP'):
|
| 397 |
+
locus = 2
|
| 398 |
+
else:
|
| 399 |
+
locus = 9
|
| 400 |
+
# 提取數字排序
|
| 401 |
+
m = _re.search(r'(\d+)', s)
|
| 402 |
+
num = int(m.group(1)) if m else 0
|
| 403 |
+
return (locus, num, s)
|
| 404 |
|
| 405 |
parts = []
|
| 406 |
|