Skip to content

Commit 59fd7f1

Browse files
committed
Retain gt and gq vals in dragen std
1 parent 860ce2a commit 59fd7f1

2 files changed

Lines changed: 39 additions & 20 deletions

File tree

src/svtk/svtk/standardize/std_dragen.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ def standardize_info(self, std_rec, raw_rec):
151151

152152
return std_rec
153153

154+
def standardize_format(self, std_rec, raw_rec):
155+
"""
156+
Retain GT and GQ.
157+
"""
158+
159+
for sample, std_sample in zip(raw_rec.samples, self.std_sample_names):
160+
gt = raw_rec.samples[sample]['GT']
161+
gq = raw_rec.samples[sample]['GQ']
162+
if self.call_null_sites:
163+
if gt == (None, None):
164+
gt = (0, 1)
165+
if gt == (None,):
166+
gt = (1,)
167+
168+
std_rec.samples[std_sample]['GT'] = gt
169+
std_rec.samples[std_sample]['GQ'] = gq
170+
171+
return std_rec
172+
154173
def standardize_alts(self, std_rec, raw_rec):
155174
"""
156175
Standardize Dragen ALT field.

src/svtk/svtk/standardize/std_dragen_cnv.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,7 @@ def standardize_info(self, std_rec, raw_rec):
7373
std_rec.qual = raw_rec.qual
7474

7575
return std_rec
76-
77-
def standardize_alts(self, std_rec, raw_rec):
78-
"""
79-
Standardize Dragen CNV ALT field.
80-
81-
Replace with N and SVTYPE.
82-
"""
83-
84-
# Set ALT to SVTYPE tag
85-
svtype = std_rec.info['SVTYPE']
86-
simple_alt = f'<{svtype}>'
87-
std_rec.alts = (simple_alt, )
88-
89-
# Set REF to null
90-
stop = std_rec.stop
91-
std_rec.ref = 'N'
92-
std_rec.stop = stop
93-
94-
return std_rec
95-
76+
9677
def standardize_format(self, std_rec, raw_rec):
9778
"""
9879
Parse ./1 GTs for DUPs into 1/1.
@@ -118,3 +99,22 @@ def standardize_format(self, std_rec, raw_rec):
11899
std_rec.samples[std_sample][source] = 0
119100

120101
return std_rec
102+
103+
def standardize_alts(self, std_rec, raw_rec):
104+
"""
105+
Standardize Dragen CNV ALT field.
106+
107+
Replace with N and SVTYPE.
108+
"""
109+
110+
# Set ALT to SVTYPE tag
111+
svtype = std_rec.info['SVTYPE']
112+
simple_alt = f'<{svtype}>'
113+
std_rec.alts = (simple_alt, )
114+
115+
# Set REF to null
116+
stop = std_rec.stop
117+
std_rec.ref = 'N'
118+
std_rec.stop = stop
119+
120+
return std_rec

0 commit comments

Comments
 (0)