for key, value in genotype_dict.items(): if value == "HET": het_list.append(key) if value == "ALT_HOM": hom_list.append(key) return het_list, hom_list vcf = VCF(vcf_file) samples = vcf.samples tot_alleles = 2 * len(samples) CSQ_description = vcf.get_header_type(key="CSQ").get("Description") CSQ_format = CSQ_description.split("Format: ")[-1] CSQ_keys = CSQ_format.split("|") print(vcf.raw_header, end="") for record in vcf: svlen = record.INFO.get("SVLEN") if svlen is None: svlen = record.INFO["END"] - record.POS genotypes = parse_genotype(record, samples) het_list, hom_list = get_alt_samples(genotypes) num_alleles = len(het_list) + 2 * len(hom_list)