def reprofiler(self, header, genome, sample):
        """
        Creates and appends new profiles as required
        :param header:
        :param genome:
        :param sample:
        """
        # Iterate through mlstseqtype - it contains genomes with partial matches to current reference profiles
        # Reset :newprofile
        newprofile = ""
        # Find the last profile entry in the dictionary of profiles
        # Opens uses the command line tool 'tail' to look at the last line of the file (-1). This last line
        # is split on tabs, and only the first entry (the sequence type number) is captured
        if sample[self.analysistype].supplementalprofile != 'NA':
            if os.path.isfile(sample[self.analysistype].supplementalprofile):
                try:
                    lastentry = int(
                        subprocess.check_output(['tail', '-1', sample[self.analysistype].supplementalprofile])
                        .split("\t")[0]) + 1
                except ValueError:
                    lastentry = 1000000
            else:
                open(sample[self.analysistype].supplementalprofile, 'w').close()
                lastentry = 1000000
            # As there can be multiple profiles in MLSTSeqType, this loop only needs to be performed once.
            seqcount = 0
            # Go through the sequence types
            try:
                sequencetype = list(self.mlstseqtype[genome].keys())[0]
            except IndexError:
                sequencetype = ''
                seqcount = 1
            # Only do this once
            if seqcount == 0:
                # Set the :newprofile string to start with the new profile name (e.g. 1000000_CFIA)
                newprofile = str(lastentry)
                # The number of matches to the reference profile
                nummatches = list(self.mlstseqtype[genome][sequencetype].keys())[0]
                # The genes in geneList - should be in the correct order
                for gene in sorted(sample[self.analysistype].allelenames):
                    # The allele for each gene in the query genome
                    allele = list(self.mlstseqtype[genome][sequencetype][nummatches][gene].keys())[0]
                    # Append the allele to newprofile
                    newprofile += '\t{}'.format(allele)
                    # Add the MLST results for the query genome as well as the new profile data
                    # to resultProfile
                    self.resultprofile[genome]['{}(new)'.format(str(lastentry))][header][gene][allele] = \
                        list(self.mlstseqtype[genome][sequencetype][nummatches][gene][allele].values())[0]
                seqcount += 1
                sample[self.analysistype].mismatchestosequencetype = 'NA'
                sample[self.analysistype].matchestosequencetype = header
            # Only perform the next loop if :newprofile exists
            if newprofile:
                # Open the profile file to append
                with open(sample[self.analysistype].supplementalprofile, 'a') as appendfile:
                    # Append the new profile to the end of the profile file
                    appendfile.write('{}\n'.format(newprofile))
                # Re-run profiler with the updated files
                self.profiler()
        else:
            sample[self.analysistype].mismatchestosequencetype = 'NA'
            sample[self.analysistype].matchestosequencetype = 'NA'
Creates and appends new profiles as required
        :param header:
        :param genome:
        :param sample: