def test_write(self): """Reporter: can write to a text file """ self._make_working_dir() reporter = Reporter() reporter.add("Test Document",title=True) reporter.add("Lorem ipsum") report_file = os.path.join(self.wd,"report.txt") reporter.write(filen=report_file) self.assertTrue(os.path.isfile(report_file)) expected_contents = """Test Document ============= Lorem ipsum """ self.assertTrue(os.path.exists(report_file)) self.assertEqual(open(report_file,'r').read(), expected_contents)
def test_write(self): """Reporter: can write to a text file """ self._make_working_dir() reporter = Reporter() reporter.add("Test Document",title=True) reporter.add("Lorem ipsum") report_file = os.path.join(self.wd,"report.txt") reporter.write(filen=report_file) self.assertTrue(os.path.isfile(report_file)) expected_contents = """Test Document ============= Lorem ipsum """ self.assertTrue(os.path.exists(report_file)) self.assertEqual(open(report_file,'r').read(), expected_contents)
mismatches=opts.mismatches, reporter=reporter) else: for lane in lanes: if lane not in counts.lanes: logging.error("Requested analysis for lane %d but " "only have counts for lanes %s" % (lane, ','.join([str(l) for l in counts.lanes]))) sys.exit(1) report_barcodes(counts, lane=lane, cutoff=cutoff, sample_sheet=opts.sample_sheet, mismatches=opts.mismatches, reporter=reporter) if opts.report_file is not None: print "Writing report to %s" % opts.report_file reporter.write(filen=opts.report_file) else: reporter.write() if opts.xls_file is not None: print "Writing XLS to %s" % opts.xls_file reporter.write_xls(opts.xls_file) if opts.html_file is not None: print "Writing HTML to %s" % opts.html_file reporter.write_html(opts.html_file) # Output counts if requested if opts.counts_file_out is not None: counts.write(opts.counts_file_out)
report_barcodes(counts, cutoff=cutoff, sample_sheet=opts.sample_sheet, mismatches=opts.mismatches, reporter=reporter) else: for lane in lanes: if lane not in counts.lanes: logging.error("Requested analysis for lane %d but " "only have counts for lanes %s" % (lane, ','.join([str(l) for l in counts.lanes]))) sys.exit(1) report_barcodes(counts, lane=lane, cutoff=cutoff, sample_sheet=opts.sample_sheet, mismatches=opts.mismatches, reporter=reporter) if opts.report_file is not None: print "Writing report to %s" % opts.report_file reporter.write(filen=opts.report_file) else: reporter.write() if opts.xls_file is not None: print "Writing XLS to %s" % opts.xls_file reporter.write_xls(opts.xls_file) # Output counts if requested if opts.counts_file_out is not None: counts.write(opts.counts_file_out)