@classmethod
def _write_vars_plus_flanks_to_fasta(cls, outfile, vcf_records, ref_seqs,
    flank_length):
    """Given a dict of vcf records made by vcf_file_read.vcf_file_to_dict(),
        and its correcsponding file of reference sequences, writes a new fasta file
        of each ref seq and inferred variant sequence plus flank_length nucleotides added to
        its start and end. Calls each sequence:
            ref_name.start_position.vcf_list_index.allele_number
        where allele_numbers in same order as VCF, with ref seq = allele 0."""
    with open(outfile, 'w') as f:
        for ref_name in sorted(vcf_records):
            for i, vcf_record in enumerate(vcf_records[ref_name]):
                start_position, alleles = (vcf_record.
                    inferred_var_seqs_plus_flanks(ref_seqs[ref_name],
                    flank_length))
                for allele_index, allele_seq in enumerate(alleles):
                    seq_name = '.'.join([ref_name, str(start_position + 1),
                        str(i), str(allele_index)])
                    print('>' + seq_name, allele_seq, sep='\n', file=f)
