def split_into_snps(self):
allele_lengths = set([len(x) for x in self.ALT])<EOL>allele_lengths.add(len(self.REF))<EOL>if len(allele_lengths) > <NUM_LIT:1> or allele_lengths == {<NUM_LIT:1>}:<EOL><INDENT>return [self]<EOL><DEDENT>if self.FORMAT is not None and '<STR_LIT>' in self.FORMAT:<EOL><INDENT>has_gt = True<EOL>genotype_alleles = set([int(x) for x in self.FORMAT['<STR_LIT>'].split('<STR_LIT:/>')])<EOL><DEDENT>else:<EOL><INDENT>has_gt = False<EOL><DEDENT>new_snps = {}<EOL>for allele_index, allele in enumerate(self.ALT):<EOL><INDENT>for i in range(len(self.REF)):<EOL><INDENT>if self.REF[i] != allele[i]:<EOL><INDENT>if i not in new_snps:<EOL><INDENT>new_snps[i] = {'<STR_LIT>': self.REF[i], '<STR_LIT>': {}}<EOL><DEDENT>assert new_snps[i]['<STR_LIT>'] == self.REF[i]<EOL>if allele[i] not in new_snps[i]['<STR_LIT>']:<EOL><INDENT>new_snps[i]['<STR_LIT>'][allele[i]] = set()<EOL><DEDENT>if has_gt:<EOL><INDENT>new_snps[i]['<STR_LIT>'][allele[i]].update(genotype_alleles.intersection({allele_index + <NUM_LIT:1>}))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>new_vcfs = []<EOL>for position_in_REF, allele_dict in sorted(new_snps.items()):<EOL><INDENT>new_vcfs.append(VcfRecord('<STR_LIT:\t>'.join([<EOL>self.CHROM,<EOL>str(self.POS + position_in_REF + <NUM_LIT:1>),<EOL>'<STR_LIT:.>',<EOL>allele_dict['<STR_LIT>'],<EOL>'<STR_LIT:U+002C>'.join(sorted(list(allele_dict['<STR_LIT>'].keys()))),<EOL>'<STR_LIT:.>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>])))<EOL>if has_gt:<EOL><INDENT>if genotype_alleles == {<NUM_LIT:0>}:<EOL><INDENT>gt = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>x = [len(allele_dict['<STR_LIT>'][x]) for x in sorted(allele_dict['<STR_LIT>'])]<EOL>matching_alleles = set([i+<NUM_LIT:1> for i in range(len(x)) if x[i] > <NUM_LIT:0>])<EOL>if len(matching_alleles) == <NUM_LIT:0>:<EOL><INDENT>gt = '<STR_LIT>'<EOL><DEDENT>elif len(matching_alleles) == <NUM_LIT:1>:<EOL><INDENT>allele = matching_alleles.pop()<EOL>if len(genotype_alleles) == <NUM_LIT:1>:<EOL><INDENT>gt = str(allele) + '<STR_LIT:/>' + str(allele)<EOL><DEDENT>else:<EOL><INDENT>gt = '<STR_LIT>' + str(allele)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>assert len(matching_alleles) == <NUM_LIT:2><EOL>gt = '<STR_LIT:/>'.join(sorted([str(x) for x in matching_alleles]))<EOL><DEDENT><DEDENT>new_vcfs[-<NUM_LIT:1>].set_format_key_value('<STR_LIT>', gt)<EOL><DEDENT><DEDENT>return new_vcfs<EOL>
Returns list of vcf_records. Tries to split
        this record into separate SNPs. eg if
        REF=ACGT and ALT=AGGA, then two SNPs
        C->G and T->A. Throws away all information in the
        INFO and FORMAT fields, except outputs the
        correct genotype (GT) if present in the input