def test_make_coverage_report_no_reference(self):
     """
     Reference must exist
     """
     gff = os.path.join(self._data_dir, 'alignment_summary.gff')
     with self.assertRaises(IOError):
         make_coverage_report(gff, 'foo', 'foo.json', 1, self._output_dir, '1', False)
 def test_make_coverage_report_none_reference(self):
     """
     Reference cannot be null
     """
     gff = os.path.join(self._data_dir, 'alignment_summary.gff')
     with self.assertRaises(PbReportError):
         make_coverage_report(gff, None, 'foo.json', 1, self._output_dir, '1', False)
 def test_make_coverage_report_no_gff(self):
     """
     Gff exists
     """
     with self.assertRaises(IOError):
         make_coverage_report('foo', self.REFERENCE, 'foo.json', 1,
                              self._output_dir)
 def test_make_coverage_report_none_reference(self):
     """
     Reference cannot be null
     """
     with self.assertRaises(PbReportError):
         make_coverage_report(self.GFF, None, 'foo.json', 1,
                              self._output_dir)
 def test_make_coverage_report_no_reference(self):
     """
     Reference must exist
     """
     with self.assertRaises(IOError):
         make_coverage_report(self.GFF, 'foo', 'foo.json', 1,
                              self._output_dir)
 def test_make_coverage_report_none_gff(self):
     """
     Gff cannot be null
     """
     with self.assertRaises(PbReportError):
         make_coverage_report(None, self.REFERENCE, 'foo.json', 1,
                              self._output_dir)
 def test_make_coverage_report_no_gff(self):
     """
     Gff exists
     """
     with self.assertRaises(IOError):
         make_coverage_report('foo', self.REFERENCE, 'foo.json', 1,
                              self._output_dir)
 def test_make_coverage_report_none_reference(self):
     """
     Reference cannot be null
     """
     with self.assertRaises(PbReportError):
         make_coverage_report(
             self.GFF, None, 'foo.json', 1, self._output_dir)
 def test_make_coverage_report_no_reference(self):
     """
     Reference must exist
     """
     with self.assertRaises(IOError):
         make_coverage_report(
             self.GFF, 'foo', 'foo.json', 1, self._output_dir)
 def test_make_coverage_report_none_gff(self):
     """
     Gff cannot be null
     """
     ref = os.path.join(self._data_dir, 'lambda')
     with self.assertRaises(PbReportError):
         make_coverage_report(None, ref, 'foo.json', 1, self._output_dir, '1', False)
 def test_make_coverage_report_none_gff(self):
     """
     Gff cannot be null
     """
     with self.assertRaises(PbReportError):
         make_coverage_report(None, self.REFERENCE, 'foo.json', 1,
                              self._output_dir)
 def test_make_coverage_report_no_gff(self):
     """
     Gff exists
     """
     ref = os.path.join(self._data_dir, 'lambda')
     with self.assertRaises(IOError):
         make_coverage_report('foo', ref, 'foo.json', 1, self._output_dir, '1', False)
 def test_make_report(self):
     rpt = make_coverage_report(self.GFF, self.REFERENCE,
                                report=self.report_out,
                                output_dir=self.tmp_dir,
                                max_contigs_to_plot=25)
     attr = {a.id:a.value for a in rpt.attributes}
     self.assertEqual(attr['missing_bases_pct'], 0.0)
     self.assertAlmostEqual(attr['depth_coverage_mean'], 68.06, places=2)
 def test_make_report(self):
     rpt = make_coverage_report(self.GFF,
                                self.REFERENCE,
                                report=self.report_out,
                                output_dir=self.tmp_dir,
                                max_contigs_to_plot=25)
     attr = {a.id: a.value for a in rpt.attributes}
     self.assertEqual(attr['missing_bases_pct'], 0.0)
     self.assertEqual(int(attr['depth_coverage_mean']), 68)
 def test_make_coverage_report(self):
     """
     Create a report object, do assertions on its properties, then assert that it gets written
     """
     report = make_coverage_report(self.GFF, self.REFERENCE, 25, 'rpt.json',
                                   self._output_dir)
     self.assertEqual(2, len(report.attributes))
     self.assertEqual(0, len(report.tables))
     self.assertEqual(2, len(report.plotGroups))
     self.assertTrue(op.exists(op.join(self._output_dir, 'rpt.json')))
 def test_make_coverage_report(self):
     """
     Create a report object, do assertions on its properties, then assert that it gets written
     """
     report = make_coverage_report(self.GFF, self.REFERENCE, 25, 'rpt.json',
                                   self._output_dir)
     self.assertEqual(2, len(report.attributes))
     self.assertEqual(0, len(report.tables))
     self.assertEqual(2, len(report.plotGroups))
     self.assertTrue(op.exists(op.join(self._output_dir, 'rpt.json')))
     validate_report_complete(self, report)
 def test_plot_file_names(self):
     report = make_coverage_report(self.GFF, self.REFERENCE, 25, 'rpt.json',
                                   self._output_dir)
     n = 0
     for pg in report.plotGroups:
         if pg.id == "coverage_plots":
             for p in pg.plots:
                 if p.id.startswith("coverage_contig"):
                     self.assertEqual(self.PLOT_FILE_NAME,
                                      op.basename(p.image))
                     n += 1
     self.assertEqual(n, 1, "Contig coverage plot not found")
 def test_plot_file_names(self):
     report = make_coverage_report(self.GFF, self.REFERENCE, 25, 'rpt.json',
                                   self._output_dir)
     n = 0
     for pg in report.plotGroups:
         if pg.id == "coverage_plots":
             for p in pg.plots:
                 if p.id.startswith("coverage_contig"):
                     self.assertEqual(self.PLOT_FILE_NAME,
                                      op.basename(p.image))
                     n += 1
     self.assertEqual(n, 1, "Contig coverage plot not found")
    def test_make_coverage_report(self):
        """
        Create a report object, do assertions on its properties, then assert that it gets written
        """
        ref = os.path.join(self._data_dir, 'references', 'lambda')
        gff = os.path.join(self._data_dir, 'alignment_summary.lambda.gff')

        report = make_coverage_report(gff, ref, 25, 'rpt.json', self._output_dir, 60, False)
        self.assertEqual(2, len(report.attributes))
        self.assertEqual(0, len(report.tables))
        self.assertEqual(2, len(report.plotGroups))

        self.assertTrue(os.path.exists(os.path.join(self._output_dir, 'rpt.json')))
Example #20
0
    def _create_coverage_report(self):
        """
        Creates and returns a coverage report
        """
        from pbreports.report.coverage import make_coverage_report
        datadir = os.path.join(ROOT_DATA_DIR, 'coverage')

        log.info(
            'Creating Coverage report using datadir {d}'.format(d=datadir))

        ref = os.path.join(datadir, 'references', 'lambda')
        gff = os.path.join(datadir, 'alignment_summary.lambda.gff')
        max_contigs_to_plot = 25
        dpi = 60
        dumpdata = False
        report_json = 'coverage.json'
        output_json = os.path.join(self._output_dir, report_json)

        make_coverage_report(gff, ref, max_contigs_to_plot, report_json,
                             self._output_dir, dpi, dumpdata)

        return self._deserialize_report(output_json)
    def _create_coverage_report(self):
        """
        Creates and returns a coverage report
        """
        from pbreports.report.coverage import make_coverage_report
        datadir = os.path.join(ROOT_DATA_DIR, 'coverage')

        log.info(
            'Creating Coverage report using datadir {d}'.format(d=datadir))

        ref = os.path.join(datadir, 'references', 'lambda')
        gff = os.path.join(datadir, 'alignment_summary.lambda.gff')
        max_contigs_to_plot = 25
        dpi = 60
        dumpdata = False
        report_json = 'coverage.json'
        output_json = os.path.join(self._output_dir, report_json)

        make_coverage_report(gff, ref, max_contigs_to_plot,
                             report_json, self._output_dir, dpi, dumpdata)

        return self._deserialize_report(output_json)
Example #22
0
 def run_report(args):
     return make_coverage_report(args.gff, args.reference, args.maxContigs,
                              args.report, args.output, args.dpi, args.dumpdata)