Creates sistr reports

def report(self):
        """Creates sistr reports"""
        # Initialise strings to store report data
        header = '\t'.join(self.headers) + '\n'
        data = ''
        for sample in self.metadata:
            if sample.general.bestassemblyfile != 'NA':
                # Each strain is a fresh row
                row = ''
                try:
                    # Read in the output .json file into the metadata
                    sample[self.analysistype].jsondata = json.load(open(sample[self.analysistype].jsonoutput, 'r'))
                    # Set the name of the report.
                    # Note that this is a tab-separated file, as there can be commas in the results
                    sample[self.analysistype].report = os.path.join(sample[self.analysistype].reportdir,
                                                                    '{}.tsv'.format(sample.name))
                    # Iterate through all the headers to use as keys in the json-formatted output
                    for category in self.headers:
                        # Tab separate all the results
                        row += '{}\t'.format(sample[self.analysistype].jsondata[0][category])
                        # Create attributes for each category
                        setattr(sample[self.analysistype], category,
                                str(sample[self.analysistype].jsondata[0][category]))
                    # End the results with a newline
                    row += '\n'

                    data += row
                    # Create and write headers and results to the strain-specific report
                    with open(sample[self.analysistype].report, 'w') as strainreport:
                        strainreport.write(header)
                        strainreport.write(row)
                except (KeyError, AttributeError):
                    pass
            # Create and write headers and cumulative results to the combined report
            with open(os.path.join(self.reportdir, 'sistr.tsv'), 'w') as report:
                report.write(header)
                report.write(data)