def _create_variants_report(self): """ Creates and returns a variants report. """ from pbreports.report.variants import make_variants_report from test_pbreports_report_variants import VARIANTS_DATA as datadir log.info( 'Creating variants report using datadir {d}'.format(d=datadir)) als = os.path.join(datadir, 'alignment_summary.gff') variants = os.path.join(datadir, 'variants.gff.gz') ref = os.path.join(datadir, 'ecoliK12_pbi_March2013') make_variants_report(als, variants, ref, 25, 'variants.json', self._output_dir, 60, False) return self._deserialize_report(os.path.join(self._output_dir, 'variants.json'))
def _create_variants_report(self): """ Creates and returns a variants report. """ from pbreports.report.variants import make_variants_report from test_pbreports_report_variants import VARIANTS_DATA as datadir log.info( 'Creating variants report using datadir {d}'.format(d=datadir)) als = os.path.join(datadir, 'alignment_summary.gff') variants = os.path.join(datadir, 'variants.gff.gz') ref = os.path.join(datadir, 'ecoliK12_pbi_March2013') make_variants_report(als, variants, ref, 25, 'variants.json', self._output_dir, 60, False) return self._deserialize_report( os.path.join(self._output_dir, 'variants.json'))
def test_make_variants_report(self): """ Create a report object, do assertions on its properties, then assert that it gets written """ report = make_variants_report(self.ALIGNMENT_SUMMARY, self.VARIANTS_GFF, self.REFERENCE, 25, 'rpt.json', self._output_dir, 60, False) self.assertEqual(5, len(report.attributes)) self.assertEqual(1, len(report.tables)) self.assertEqual(1, len(report.plotGroups)) self.assertIsNotNone(report.plotGroups[0].legend) self.assertTrue(op.exists(op.join(self._output_dir, 'rpt.json')))
def test_make_variants_report_invalid_input_files(self): """ inputs cannot be null or non-existent """ # als tests with self.assertRaises(PbReportError): make_variants_report(None, self.VARIANTS_GFF, self.REFERENCE, 'foo.json', 1, self._output_dir, '1', False) with self.assertRaises(IOError): make_variants_report('foo', self.VARIANTS_GFF, self.REFERENCE, 'foo.json', 1, self._output_dir, '1', False) # variants tests with self.assertRaises(PbReportError): make_variants_report(self.ALIGNMENT_SUMMARY, None, self.REFERENCE, 'foo.json', 1, self._output_dir, '1', False) with self.assertRaises(IOError): make_variants_report(self.ALIGNMENT_SUMMARY, 'foo', self.REFERENCE, 'foo.json', 1, self._output_dir, '1', False) # ref tests with self.assertRaises(PbReportError): make_variants_report(self.ALIGNMENT_SUMMARY, self.VARIANTS_GFF, None, 'foo.json', 1, self._output_dir, '1', False) with self.assertRaises(IOError): make_variants_report(self.ALIGNMENT_SUMMARY, self.VARIANTS_GFF, 'foo', 'foo.json', 1, self._output_dir, '1', False)
def run_report(args): return make_variants_report(args.aln_summ_gff, args.variants_gff, args.reference, args.maxContigs, args.report, args.output, args.dpi, args.dumpdata)