Skip to content

Commit 63dec4d

Browse files
committed
l_merge.py preserves per-sample SU (support) in SULIST property.
Ideally would output per-sample metadata, but until then, this at least preserves per-sample SU.
1 parent a0ca2d8 commit 63dec4d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/l_merge.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def print_var_line(l):
6969
PRPOS = m['PREND']
7070
PREND = m['PRPOS']
7171
SNAME = m['SNAME']
72+
SULIST = m.get('SULIST', m['SU']) # Fall back to single SU as default
7273
EVENT = A[2]
7374

7475
A[4] = ALT
@@ -85,6 +86,7 @@ def print_var_line(l):
8586
'PRPOS=' + str(PRPOS),
8687
'PREND=' + str(PREND),
8788
'SNAME=' + str(SNAME),
89+
'SULIST=' + str(SULIST),
8890
'EVENT=' + str(EVENT)])
8991

9092
# reconstruct the line
@@ -124,6 +126,7 @@ def print_var_line(l):
124126
PRPOS = m['PREND']
125127
PREND = m['PRPOS']
126128
SNAME = m['SNAME']
129+
SULIST = m.get('SULIST', m['SU']) # Fall back to single SU as default
127130
EVENT = A[2]
128131
SECONDARY = 'SECONDARY'
129132
MATEID=A[2] + '_1'
@@ -142,6 +145,7 @@ def print_var_line(l):
142145
'PRPOS=' + str(PRPOS),
143146
'PREND=' + str(PREND),
144147
'SNAME=' + str(SNAME),
148+
'SULIST=' + str(SULIST),
145149
'EVENT=' + str(EVENT),
146150
'MATEID=' + str(MATEID)])
147151

@@ -459,6 +463,8 @@ def merge(BP, sample_order, v_id, use_product):
459463

460464
gt_list = []
461465

466+
su_list = []
467+
462468
#for g_i in c:
463469
for b_i in c:
464470
#A = G[g_i].b.l.rstrip().split('\t')
@@ -482,10 +488,14 @@ def merge(BP, sample_order, v_id, use_product):
482488

483489
gt_list += A[9:]
484490

491+
su_list.append(m['SU'])
492+
485493
SNAME=','.join(s_name_list)
486494

487495
GTS = '\t'.join(gt_list)
488496

497+
SULIST = ','.join(su_list)
498+
489499
strand_types_counts = []
490500
for strand in strand_map:
491501
strand_types_counts.append(strand + ':' + str(strand_map[strand]))
@@ -517,7 +527,8 @@ def merge(BP, sample_order, v_id, use_product):
517527
'PRPOS=' + str(PRPOS),
518528
'PREND=' + str(PREND),
519529
'ALG=' + str(ALG),
520-
'SNAME=' + str(SNAME)]
530+
'SNAME=' + str(SNAME),
531+
'SULIST=' + str(SULIST)]
521532

522533
if BP[c[0]].sv_type == 'BND':
523534
I.append('EVENT=' + str(ID))

0 commit comments

Comments
 (0)