Exemplo n.º 1
0
    def test_write_html(self):
        """Reporter: can write to a HTML file
        """
        self._make_working_dir()
        reporter = Reporter()
        reporter.add("This is a Test",title=True)
        reporter.add("Lorem ipsum")
        reporter.add("Column1\tColumn2",heading=True)
        reporter.add("1\t2")
        reporter.add("3\t4")
        reporter.add("Lorem more ipsum")
        report_html = os.path.join(self.wd,"report.html")
        reporter.write_html(report_html,
                            title="Test Document",
                            no_styles=True)
        self.assertTrue(os.path.isfile(report_html))
        expected_contents = """<html>
<head>
<title>Test Document</title>
</head>
<body>
<h1>Test Document</h1>
<div id='toc'>
<h2>Contents</h2>
<ul><li><a href='#This_is_a_Test'>This is a Test</a></li></ul>
</div>
<div id='This_is_a_Test'>
<h2>This is a Test</h2>
<p>Lorem ipsum</p>
</div>
<div>
<table>
<tr><th>Column1</th><th>Column2</th></tr>
<tr><td>1</td><td>2</td></tr>
<tr><td>3</td><td>4</td></tr>
</table>
</div>
<div>
<p>Lorem more ipsum</p>
</div></body>
</html>
"""
        for expected,actual in zip(expected_contents.split('\n'),
                                   open(report_html,'r').read().split('\n')):
            self.assertEqual(expected,actual)
Exemplo n.º 2
0
                            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)