Skip to content

Commit 0be9cf8

Browse files
authored
Update SR counting and genotyping (#553)
1 parent 2fdf7af commit 0be9cf8

File tree

9 files changed

+453
-264
lines changed

9 files changed

+453
-264
lines changed

src/sv-pipeline/03_variant_filtering/scripts/rewrite_SR_coords.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,23 @@
1515
def rewrite_SR_coords(record, metrics, pval_cutoff, bg_cutoff):
1616
row = metrics.loc[record.id]
1717
if row.SR_sum_log_pval >= pval_cutoff and row.SR_sum_bg_frac >= bg_cutoff:
18-
record.pos = int(row.SR_posA_pos)
19-
record.stop = int(row.SR_posB_pos)
20-
if record.info['SVTYPE'] == 'INV':
21-
record.pos, record.stop = sorted([record.pos, record.stop])
18+
posA = int(row.SR_posA_pos)
19+
posB = int(row.SR_posB_pos)
20+
if record.info['SVTYPE'] == 'INS':
21+
# posA is always (+) strand and posB (-) strand; need to set order so pos <= end
22+
if posB < posA:
23+
record.pos = int(posB)
24+
record.stop = int(posA)
25+
record.info['STRANDS'] = '-+'
26+
else:
27+
record.pos = int(posA)
28+
record.stop = int(posB)
29+
record.info['STRANDS'] = '+-'
30+
elif record.info['SVTYPE'] == 'INV':
31+
record.pos, record.stop = sorted([posA, posB])
32+
else:
33+
record.pos = posA
34+
record.stop = posB
2235
if record.info['SVTYPE'] not in 'INS BND'.split():
2336
record.info['SVLEN'] = record.stop - record.pos
2437

0 commit comments

Comments
 (0)