plokmii commited on
Commit
ffe66f7
·
verified ·
1 Parent(s): 17abc88

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +14 -8
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
- return (0, s)
387
  elif s.startswith('B'):
388
- return (1, s)
389
  elif s.startswith('Cw'):
390
- return (2, s)
391
  elif s.startswith('DR'):
392
- return (0, s)
393
  elif s.startswith('DQ'):
394
- return (1, s)
395
  elif s.startswith('DP'):
396
- return (2, s)
397
- return (9, s)
 
 
 
 
 
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