def primers(self):
        """
        Read in the primer file, and create a properly formatted output file that takes any degenerate bases
        into account
        """
        with open(self.formattedprimers, 'w') as formatted:
            for record in SeqIO.parse(self.primerfile, 'fasta'):
                # from https://stackoverflow.com/a/27552377 - find any degenerate bases in the primer sequence, and
                # create all possibilities as a list
                degenerates = Seq.IUPAC.IUPACData.ambiguous_dna_values
                try:
                    primerlist = list(map("".join, product(*map(degenerates.get, str(record.seq)))))
                except TypeError:
                    print("Invalid Primer Sequence: {seq}".format(seq=str(record.seq)))
                    sys.exit()
                # As the record.id is being updated in the loop below, set the name of the primer here so that will
                # be able to be recalled when setting the new record.ids
                primername = record.id
                # Iterate through all the possible primers created from any degenerate bases
                for index, primer in enumerate(primerlist):
                    # Update the primer name with the position in the list to keep the name unique
                    record.id = primername + '_{index}'.format(index=index)
                    # Clear the description, as, otherwise, it will be added, and there will be duplicate information
                    record.description = ''
                    # Create a seqrecord from the primer sequence
                    record.seq = Seq.Seq(primer)
                    # Write the properly-formatted records to file
                    SeqIO.write(record, formatted, 'fasta')
                    # Populate a dictionary to store the length of the primers - will be used in determining whether
                    # BLAST hits are full-length
                    self.faidict[record.id] = len(str(record.seq))
                    # Ensure that the kmer length used in the initial baiting is no larger than the shorted primer
                    if len(str(record.seq)) < self.klength:
                        self.klength = len(str(record.seq))