Skip to content

Commit fb44a71

Browse files
authored
Merge pull request #3 from jiaan-yu/master
Fix bug in extract_strelka_somatic_DP_AF.py
2 parents 16ef234 + cfc343c commit fb44a71

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vcf_utils/extract_strelka_somatic_DP_AF.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,8 @@
5858
refCounts = int(variant.format[vtype]["TAR"].split(",")[0])
5959
altCounts = int(variant.format[vtype]["TIR"].split(",")[0])
6060
variant.format[vtype]["AD"] = str(refCounts) + "," + str(altCounts)
61-
variant.format[vtype]["AF"] = str(round(altCounts / float(refCounts + altCounts), 2))
61+
if refCounts + altCounts != 0:
62+
variant.format[vtype]["AF"] = str(round(altCounts / float(refCounts + altCounts), 2))
63+
else:
64+
variant.format[vtype]["AF"] = "0.00"
6265
f_vcf_out.write(variant.write(somatic=True))

0 commit comments

Comments
 (0)