diff --git a/src/python/lib/grm/vcfgraph/vcfgraph.py b/src/python/lib/grm/vcfgraph/vcfgraph.py index 23f2763..db3b2af 100644 --- a/src/python/lib/grm/vcfgraph/vcfgraph.py +++ b/src/python/lib/grm/vcfgraph/vcfgraph.py @@ -174,8 +174,17 @@ def add_record(self, vcf, allele_graph, varId, ins_info_key): if "<" in alt: if alt == "": if ins_info_key not in vcf.info: - raise Exception( - f"Missing key {ins_info_key} for at {self.chrom}:{vcf.pos}; ") + if "RIGHT_SVINSSEQ" in vcf.info and "LEFT_SVINSSEQ" in vcf.info: + l = vcf.info["LEFT_SVINSSEQ"] + r = vcf.info["RIGHT_SVINSSEQ"] + if isinstance(l, (tuple, list)): + l = l[0] + if isinstance(r, (tuple, list)): + r = r[0] + vcf.info[ins_info_key] = l + ('N' * 200) + r + else: + raise Exception( + f"Missing key {ins_info_key} for at {self.chrom}:{vcf.pos}; ") ins_seq = vcf.info[ins_info_key].upper() if re.search(r'[^ACGTNXacgtnx]', ins_seq): raise Exception("Illegal character in INS sequence: %s" % ins_seq)