def profiler(self):
        printtime('Calculating core profiles', self.start)
        for strain in self.corealleles:
            self.coreset.add(tuple(sorted(self.corealleles[strain].items())))
        header = 'ST,{}\n'.format(','.join(sorted(self.geneset)))
        data = ''
        for count, core in sorted(enumerate(self.coreset)):
            count += 1
            data += '{}'.format(count)
            for strain in self.corealleles:
                if tuple(sorted(self.corealleles[strain].items())) == core:
                    self.profiles[strain] = count
            for gene in sorted(core):
                data += ',{}'.format(gene[1])
            data += '\n'
        with open(os.path.join(self.profilelocation, 'profile.txt'), 'w') as profile:
            profile.write(header)
            profile.write(data)
        self.linker()