def test_para_with_mixture_of_types(self):
     img = Img("picture.png")
     ahref = Link("http://example.com")
     p = Para("Beautiful picture:", img, "See more at", ahref)
     self.assertEqual(
         p.html(), "<p>Beautiful picture: "
         "<img src='picture.png' /> "
         "See more at "
         "<a href='http://example.com'>"
         "http://example.com</a></p>")
 def test_img_with_href(self):
     img = Img('picture.png', href="http://awesome.pix.com/")
     self.assertEqual(
         img.html(), "<a href='http://awesome.pix.com/'>"
         "<img src='picture.png' /></a>")
 def test_img_with_title(self):
     img = Img('picture.png', title="An awesome picture")
     self.assertEqual(
         img.html(), "<img src='picture.png' "
         "title='An awesome picture' />")
 def test_img_with_alt_text(self):
     img = Img('picture.png', alt="An awesome picture")
     self.assertEqual(
         img.html(), "<img src='picture.png' "
         "alt='An awesome picture' />")
 def test_img_with_name(self):
     img = Img('picture.png', name="awesome-picture")
     self.assertEqual(img.html(), "<img id='awesome-picture' "
                      "src='picture.png' />")
 def test_img_with_height_and_width(self):
     img = Img('picture.png', height=100, width=150)
     self.assertEqual(
         img.html(), "<img src='picture.png' "
         "height='100' width='150' />")
 def test_img(self):
     img = Img('picture.png')
     self.assertEqual(img.html(), "<img src='picture.png' />")
Esempio n. 8
0
    plot_filen = os.path.join(out_dir, "reads_per_stage.png")
    reads_per_stage = \
        pd.Series([data.total_reads,],
                  ['Nreads_initial',]).append(
                      df[cols].sum())
    print reads_per_stage
    fig = plt.figure()
    plot = reads_per_stage.plot.bar(figsize=(6, 4))
    labels = ['Initial', 'Assigned', 'Quality filtered', 'Trimmed']
    if contaminant_filtered:
        labels.append('Uncontaminated')
    plot.set_xticklabels(labels, rotation=45)
    plot.set_ylabel("#read pairs")
    plot.get_figure().savefig(plot_filen, bbox_inches='tight')
    general_info.add(
        Img(os.path.relpath(plot_filen, os.path.dirname(out_file))))
    general_info.add(reads_per_stage.to_frame().to_html(header=False))
    toc_list.add_item(Link(general_info.title, general_info))

    # Low read counts
    low_read_threshold = data.total_assigned_reads / data.total_barcodes / 10
    read_counts = report.add_section("Read counts", name="read_counts")
    low_read_count = df[['Barcode', 'Nreads']].query(
        "Nreads < %d" % low_read_threshold).query("Nreads > 0")
    low_reads = len(low_read_count)
    no_reads = len(df.query("Nreads == 0"))
    tbl = Table(columns=('name', 'value'))
    tbl.no_header()
    data_items = (('Mean read count per barcode', 'mean_read_count'),
                  ('Median read count per barcode', 'median_read_count'))
    for item in data_items: