From f2446915e4f4b7da25ac09d74005b366bc1806f3 Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Wed, 22 Feb 2023 15:39:39 +0100 Subject: [PATCH] fix: enforce ploidy in GATK gCNV ploidy calling wrapper (#377) --- .../wrappers/gcnv/contig_ploidy_case_mode/wrapper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/snappy_wrappers/wrappers/gcnv/contig_ploidy_case_mode/wrapper.py b/snappy_wrappers/wrappers/gcnv/contig_ploidy_case_mode/wrapper.py index a9c77d51e..5ce977e9a 100644 --- a/snappy_wrappers/wrappers/gcnv/contig_ploidy_case_mode/wrapper.py +++ b/snappy_wrappers/wrappers/gcnv/contig_ploidy_case_mode/wrapper.py @@ -59,7 +59,9 @@ line = call_lines[i] arr = line.split("\t") chrom = arr[0].lower() - if "x" in chrom or "y" in chrom: + if chrom.startswith("@") or chrom == "contig": + pass # noop + elif "x" in chrom or "y" in chrom: ploidy = int(arr[1]) if "x" in arr[0].lower(): if ploidy != ploidy_x[sample_sex]: @@ -69,6 +71,11 @@ if ploidy != ploidy_y[sample_sex]: arr[1] = str(ploidy_y[sample_sex]) arr[2] = f"42.000{ploidy}" # magic marker + else: + ploidy = int(arr[1]) + if ploidy != 2: + arr[1] = "2" + arr[2] = f"42.000{ploidy}" # magic marker call_lines[i] = "\t".join(arr) with path_call.open("wt") as outputf: for line in call_lines: