def test_make_loading_report_with_sts_xml(self): """ Test the content of the loading report generated from a sts.xml """ sts_xml = data.getStats(0) rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d["tables"][0] c0 = t["columns"][0] c1 = t["columns"][1] c2 = t["columns"][2] c3 = t["columns"][3] c4 = t["columns"][4] self.assertEqual("Collection Context", c0["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "collection_context", c0["id"]) self.assertEqual("NA", c0["values"][0]) self.assertEqual("Productive ZMWs", c1["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productive_zmws", c1["id"]) self.assertEqual(2876, c1["values"][0]) self.assertEqual("Productivity 0 (%)", c2["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productivity_0", c2["id"]) self.assertAlmostEqual(54.798, c2["values"][0], delta=0.0003) self.assertEqual("Productivity 1 (%)", c3["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productivity_1", c3["id"]) self.assertAlmostEqual(31.328, c3["values"][0], delta=0.0003) self.assertEqual("Productivity 2 (%)", c4["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productivity_2", c4["id"]) self.assertAlmostEqual(13.873, c4["values"][0], delta=0.0003)
def test_make_loading_report_with_dataset(self): """ Test the content of the loading report generated from a dataset """ sts_xml = data.getXmlWithStats() rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] self.assertEqual('Collection Context', c0['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('Combined', c0['values'][0]) # Turn these back on when a context is inserted in the testdataset: #self.assertEqual('dummy1', c0['values'][1]) #self.assertEqual('dummy2', c0['values'][2]) self.assertEqual('NA', c0['values'][1]) self.assertEqual('NA', c0['values'][2]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(153168, c1['values'][0]) self.assertEqual(2876, c1['values'][1]) self.assertEqual(150292, c1['values'][2]) self.assertEqual('Productivity 0 (%)', c2['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_0', c2['id']) self.assertAlmostEqual(78.985, c2['values'][0], delta=.0003) self.assertAlmostEqual(54.798, c2['values'][1], delta=.0003) self.assertAlmostEqual(79.447, c2['values'][2], delta=.0003) self.assertEqual('Productivity 1 (%)', c3['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_1', c3['id']) self.assertAlmostEqual(16.402, c3['values'][0], delta=.0003) self.assertAlmostEqual(31.328, c3['values'][1], delta=.0003) self.assertAlmostEqual(16.117, c3['values'][2], delta=.0003) self.assertEqual('Productivity 2 (%)', c4['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_2', c4['id']) self.assertAlmostEqual(4.613, c4['values'][0], delta=.0003) self.assertAlmostEqual(13.873, c4['values'][1], delta=.0003) self.assertAlmostEqual(4.436, c4['values'][2], delta=.0003)
def test_make_loading_report_with_dataset(self): """ Test the content of the loading report generated from a dataset """ sts_xml = data.getXmlWithStats() rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] self.assertEqual('Collection Context', c0['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('Combined', c0['values'][0]) # Turn these back on when a context is inserted in the testdataset: #self.assertEqual('dummy1', c0['values'][1]) #self.assertEqual('dummy2', c0['values'][2]) self.assertEqual('NA', c0['values'][1]) self.assertEqual('NA', c0['values'][2]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(153168, c1['values'][0]) self.assertEqual(2876, c1['values'][1]) self.assertEqual(150292, c1['values'][2]) self.assertEqual('Productivity 0 (%)', c2['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_0', c2['id']) self.assertAlmostEqual(78.985, c2['values'][0], delta=.0003) self.assertAlmostEqual(54.798, c2['values'][1], delta=.0003) self.assertAlmostEqual(79.447, c2['values'][2], delta=.0003) self.assertEqual('Productivity 1 (%)', c3['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_1', c3['id']) self.assertAlmostEqual(16.402, c3['values'][0], delta=.0003) self.assertAlmostEqual(31.328, c3['values'][1], delta=.0003) self.assertAlmostEqual(16.117, c3['values'][2], delta=.0003) self.assertEqual('Productivity 2 (%)', c4['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_2', c4['id']) self.assertAlmostEqual(4.613, c4['values'][0], delta=.0003) self.assertAlmostEqual(13.873, c4['values'][1], delta=.0003) self.assertAlmostEqual(4.436, c4['values'][2], delta=.0003)
def test_make_loading_report_with_sts_xml(self): """ Test the content of the loading report generated from a sts.xml """ try: log.info( TestXMLstatsRpts.test_make_loading_report_with_sts_xml.__doc__) sts_xml = data.getStats(0) rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] self.assertEqual('Collection Context', c0['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('NA', c0['values'][0]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(2876, c1['values'][0]) self.assertEqual('Productivity 0 (%)', c2['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_0', c2['id']) self.assertAlmostEqual(54.80, c2['values'][0], delta=.0003) self.assertEqual('Productivity 1 (%)', c3['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_1', c3['id']) self.assertAlmostEqual(31.33, c3['values'][0], delta=.0003) self.assertEqual('Productivity 2 (%)', c4['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_2', c4['id']) self.assertAlmostEqual(13.87, c4['values'][0], delta=.0003) except: log.error(traceback.format_exc()) raise
def test_make_loading_report_with_dataset(self): """ Test the content of the loading report generated from a dataset """ sts_xml = data.getXmlWithStats() rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d["tables"][0] c0 = t["columns"][0] c1 = t["columns"][1] c2 = t["columns"][2] c3 = t["columns"][3] c4 = t["columns"][4] self.assertEqual("Collection Context", c0["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "collection_context", c0["id"]) self.assertEqual("Combined", c0["values"][0]) # Turn these back on when a context is inserted in the testdataset: # self.assertEqual('dummy1', c0['values'][1]) # self.assertEqual('dummy2', c0['values'][2]) self.assertEqual("NA", c0["values"][1]) self.assertEqual("NA", c0["values"][2]) self.assertEqual("Productive ZMWs", c1["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productive_zmws", c1["id"]) self.assertEqual(153168, c1["values"][0]) self.assertEqual(2876, c1["values"][1]) self.assertEqual(150292, c1["values"][2]) self.assertEqual("Productivity 0 (%)", c2["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productivity_0", c2["id"]) self.assertAlmostEqual(78.985, c2["values"][0], delta=0.0003) self.assertAlmostEqual(54.798, c2["values"][1], delta=0.0003) self.assertAlmostEqual(79.447, c2["values"][2], delta=0.0003) self.assertEqual("Productivity 1 (%)", c3["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productivity_1", c3["id"]) self.assertAlmostEqual(16.402, c3["values"][0], delta=0.0003) self.assertAlmostEqual(31.328, c3["values"][1], delta=0.0003) self.assertAlmostEqual(16.117, c3["values"][2], delta=0.0003) self.assertEqual("Productivity 2 (%)", c4["header"]) self.assertEqual("loading_xml_report.loading_xml_table." "productivity_2", c4["id"]) self.assertAlmostEqual(4.613, c4["values"][0], delta=0.0003) self.assertAlmostEqual(13.873, c4["values"][1], delta=0.0003) self.assertAlmostEqual(4.436, c4["values"][2], delta=0.0003) validate_report_complete(self, rpt)
def test_make_loading_report_with_sts_xml(self): """ Test the content of the loading report generated from a sts.xml """ sts_xml = data.getStats(0) rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] self.assertEqual('Collection Context', c0['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('NA', c0['values'][0]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(2876, c1['values'][0]) self.assertEqual('Productivity 0 (%)', c2['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_0', c2['id']) self.assertAlmostEqual(54.798, c2['values'][0], delta=.0003) self.assertEqual('Productivity 1 (%)', c3['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_1', c3['id']) self.assertAlmostEqual(31.328, c3['values'][0], delta=.0003) self.assertEqual('Productivity 2 (%)', c4['header']) self.assertEqual('loading_xml_report.loading_xml_table.' 'productivity_2', c4['id']) self.assertAlmostEqual(13.873, c4['values'][0], delta=.0003)
def test_make_loading_report_with_sts_xml(self): """ Test the content of the loading report generated from a sts.xml """ sts_xml = data.getStats(0) rpt = make_loading_report(sts_xml) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] self.assertEqual('Collection Context', c0['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('NA', c0['values'][0]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(2876, c1['values'][0]) self.assertEqual('Productivity 0 (%)', c2['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_0', c2['id']) self.assertAlmostEqual(54.798, c2['values'][0], delta=.0003) self.assertEqual('Productivity 1 (%)', c3['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_1', c3['id']) self.assertAlmostEqual(31.328, c3['values'][0], delta=.0003) self.assertEqual('Productivity 2 (%)', c4['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_2', c4['id']) self.assertAlmostEqual(13.873, c4['values'][0], delta=.0003)
def _test_ioerror(): make_loading_report("foo")
def _test_ioerror(): make_loading_report('foo')
def test_make_loading_report_with_merged_dataset(self): """ Test the content of the loading report generated from a dataset with multiple sub-datasets """ ss = get_merged_subreadset() rpt = make_loading_report(ss, self.get_output_dir()) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] c5 = t['columns'][5] c6 = t['columns'][6] c7 = t['columns'][7] self.assertEqual('Collection Context', c0['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('Combined', c0['values'][0]) # Turn these back on when a context is inserted in the testdataset: #self.assertEqual('dummy1', c0['values'][1]) #self.assertEqual('dummy2', c0['values'][2]) self.assertEqual('m54086_160831_230338', c0['values'][1]) self.assertEqual('m54099_160830_232701', c0['values'][2]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(2073466, c1['values'][0]) self.assertEqual(1036722, c1['values'][1]) self.assertEqual(1036744, c1['values'][2]) self.assertEqual('Productivity 0', c2['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_0_n', c2['id']) self.assertEqual(1325603, c2['values'][0]) self.assertEqual(853636, c2['values'][1]) self.assertEqual(471967, c2['values'][2]) self.assertEqual('(%)', c3['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_0_pct', c3['id']) self.assertAlmostEqual(63.932, c3['values'][0], delta=.0003) self.assertAlmostEqual(82.340, c3['values'][1], delta=.0003) self.assertAlmostEqual(45.524, c3['values'][2], delta=.0003) self.assertEqual('Productivity 1', c4['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_1_n', c4['id']) self.assertEqual(743972, c4['values'][0]) self.assertEqual(180176, c4['values'][1]) self.assertEqual(563796, c4['values'][2]) self.assertEqual('(%)', c5['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_1_pct', c5['id']) self.assertAlmostEqual(35.881, c5['values'][0], delta=.0003) self.assertAlmostEqual(17.379, c5['values'][1], delta=.0003) self.assertAlmostEqual(54.381, c5['values'][2], delta=.0003) self.assertEqual('Productivity 2', c6['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_2_n', c6['id']) self.assertEqual(3891, c6['values'][0]) self.assertEqual(2910, c6['values'][1]) self.assertEqual(981, c6['values'][2]) self.assertEqual('(%)', c7['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_2_pct', c7['id']) self.assertAlmostEqual(0.188, c7['values'][0], delta=.0003) self.assertAlmostEqual(0.281, c7['values'][1], delta=.0003) self.assertAlmostEqual(0.095, c7['values'][2], delta=.0003) self.assertTrue( os.path.exists( os.path.join(self.get_output_dir(), 'raw_read_length_plot.png'))) self.assertTrue( os.path.exists( os.path.join(self.get_output_dir(), 'raw_read_length_plot_thumb.png'))) validate_report_complete(self, rpt)
def test_make_loading_report_with_dataset(self): """ Test the content of the loading report generated from a simple SubreadSet """ sts_xml = pbtestdata.get_file("subreads-sequel") rpt = make_loading_report(sts_xml, self.get_output_dir()) d = json.loads(rpt.to_json()) t = d['tables'][0] c0 = t['columns'][0] c1 = t['columns'][1] c2 = t['columns'][2] c3 = t['columns'][3] c4 = t['columns'][4] c5 = t['columns'][5] c6 = t['columns'][6] c7 = t['columns'][7] c8 = t['columns'][8] self.assertEqual('Collection Context', c0['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'collection_context', c0['id']) self.assertEqual('m54006_160504_020705', c0['values'][0]) self.assertEqual('Productive ZMWs', c1['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productive_zmws', c1['id']) self.assertEqual(1035426, c1['values'][0]) self.assertEqual('Productivity 0', c2['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_0_n', c2['id']) self.assertEqual(631530, c2['values'][0]) self.assertEqual('(%)', c3['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_0_pct', c3['id']) self.assertAlmostEqual(60.992, c3['values'][0], delta=.0003) self.assertEqual('Productivity 1', c4['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_1_n', c4['id']) self.assertEqual(394658, c4['values'][0]) self.assertEqual('(%)', c5['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_1_pct', c5['id']) self.assertAlmostEqual(38.116, c5['values'][0], delta=.0003) self.assertEqual('Productivity 2', c6['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_2_n', c6['id']) self.assertEqual(9238, c6['values'][0]) self.assertEqual('(%)', c7['header']) self.assertEqual( 'loading_xml_report.loading_xml_table.' 'productivity_2_pct', c7['id']) self.assertAlmostEqual(0.892, c7['values'][0], delta=.0003) self.assertEqual(c8['values'][0], "Workflow_Magbead.py") self.assertTrue( os.path.exists( os.path.join(self.get_output_dir(), 'raw_read_length_plot.png'))) self.assertTrue( os.path.exists( os.path.join(self.get_output_dir(), 'raw_read_length_plot_thumb.png'))) validate_report_complete(self, rpt)
def _test_ioerror(): make_loading_report('foo', self.get_output_dir())