From 2332b92e319ea9fd691dbc914bdc106eaafaa4a0 Mon Sep 17 00:00:00 2001 From: Jared Simpson Date: Thu, 8 Dec 2022 09:48:05 -0500 Subject: [PATCH] skip multi-allelic ambiguity codes instead of failing --- workflow/scripts/mixture_check.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workflow/scripts/mixture_check.py b/workflow/scripts/mixture_check.py index 885e90e..693217c 100755 --- a/workflow/scripts/mixture_check.py +++ b/workflow/scripts/mixture_check.py @@ -109,6 +109,9 @@ def calculate(sample_a, sample_b, variants, counts): # if A is an IUPAC code, resolve to the non-B allele allele_a = resolve_iupac(allele_a, allele_b) + if allele_a == None: + continue + # skip non-informative positions if allele_a == allele_b: continue @@ -180,7 +183,6 @@ def resolve_iupac(code, fixed_base): elif b == fixed_base: return a else: - assert(False) return None else: return None @@ -204,6 +206,9 @@ def load_msa_alleles(alleles_fn): continue aa = resolve_iupac(ca, ra) + if aa == None: + continue + v = Variant("contig", int(row['pos']), ra, aa) out[sample][v] = ca return out