def test_make_filter_stats_report_sts_xml(self):
        """
        Test the content of the filter report generated from an sts.xml
        """
        sts_xml = pbtestdata.get_file("stats-xml")
        rpt = make_filter_report(sts_xml, self.get_output_dir())
        d = json.loads(rpt.to_json())
        self._compare_attribute_values(
            report_d=d,
            expected_d={
                Constants.A_NBASES: 1672335649,
                Constants.A_NREADS: 394658,
                Constants.A_READ_N50: 7750,
                Constants.A_READ_LENGTH: 4237,
            },
        )
        self.assertTrue(os.path.exists(os.path.join(self.get_output_dir(), "readLenDist0.png")))
        # self.assertTrue(os.path.exists(os.path.join(
        #    self.get_output_dir(),
        #    'readQualDist0.png')))

        # these are from a raw STS file
        self.assertEqual(len(rpt._dataset_uuids), 0, "Incorrect report datasets uuids")
        print pformat(rpt.to_dict())
        validate_report_complete(self, rpt)
    def test_make_filter_stats_report_sts_xml(self):
        """
        Test the content of the filter report generated from an sts.xml
        """
        sts_xml = pbtestdata.get_file("stats-xml")
        rpt = make_filter_report(sts_xml, self.get_output_dir())
        d = json.loads(rpt.to_json())
        self._compare_attribute_values(report_d=d,
                                       expected_d={
                                           Constants.A_NBASES: 1672335649,
                                           Constants.A_NREADS: 394658,
                                           Constants.A_READ_N50: 7750,
                                           Constants.A_READ_LENGTH: 4237
                                       })
        self.assertTrue(
            os.path.exists(
                os.path.join(self.get_output_dir(), 'readLenDist0.png')))
        # self.assertTrue(os.path.exists(os.path.join(
        #    self.get_output_dir(),
        #    'readQualDist0.png')))

        # these are from a raw STS file
        self.assertEqual(len(rpt._dataset_uuids), 0,
                         "Incorrect report datasets uuids")
        print pformat(rpt.to_dict())
        validate_report_complete(self, rpt)
    def test_make_filter_stats_report_dataset(self):
        """
        Test the content of the filter report generated from a dataset
        """
        try:
            log.info(
                TestXMLstatsRpts.test_make_filter_stats_report_dataset.__doc__)
            sts_xml = data.getXmlWithStats()

            rpt = make_filter_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]
            self.assertEqual('Metrics', c0['header'])
            self.assertEqual('filtering_stats_xml_report.filter_xml_table.'
                             'filter_names_column', c0['id'])
            self.assertEqual('Polymerase Read Bases', c0['values'][0])
            self.assertEqual('Polymerase Reads', c0['values'][1])
            self.assertEqual('Polymerase Read N50', c0['values'][2])
            self.assertEqual('Polymerase Read Length', c0['values'][3])
            self.assertEqual('Polymerase Read Quality', c0['values'][4])

            self.assertEqual('Values', c1['header'])
            self.assertEqual('filtering_stats_xml_report.filter_xml_table.'
                             'filter_stats_column', c1['id'])
            self.assertEqual(393167212.65, c1['values'][0])
            self.assertEqual(25123, c1['values'][1])
            self.assertEqual(21884, c1['values'][2])
            self.assertEqual(15649.69, c1['values'][3])
            self.assertEqual(0.86, c1['values'][4])
            self.assertTrue(os.path.exists(os.path.join(
                self.get_output_dir(),
                'readLenDist0.png')))
            self.assertTrue(os.path.exists(os.path.join(
                self.get_output_dir(),
                'readQualDist0.png')))
            self.assertTrue(os.path.exists(os.path.join(
                self.get_output_dir(),
                'readLenDist1.png')))
            self.assertTrue(os.path.exists(os.path.join(
                self.get_output_dir(),
                'readQualDist1.png')))

        except:
            log.error(traceback.format_exc())
            raise
 def test_make_filter_stats_report_dataset_multiple_chips(self):
     sts_xml = data.getXmlWithStats()
     rpt = make_filter_report(sts_xml, self.get_output_dir())
     d = json.loads(rpt.to_json())
     self._compare_attribute_values(
         report_d=d,
         expected_d={
             Constants.A_NBASES: 342348413,
             Constants.A_NREADS: 25123,
             Constants.A_READ_N50: 21884,
             Constants.A_READ_LENGTH: 13627,
         },
     )
     self.assertTrue(os.path.exists(os.path.join(self.get_output_dir(), "readLenDist0.png")))
     self.assertTrue(os.path.exists(os.path.join(self.get_output_dir(), "readLenDist1.png")))
    def test_make_filter_stats_report_sts_xml(self):
        """
        Test the content of the filter report generated from an sts.xml
        """
        try:
            log.info(
                TestXMLstatsRpts.test_make_filter_stats_report_sts_xml.__doc__)
            sts_xml = data.getStats(0)

            rpt = make_filter_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]
            self.assertEqual('Metrics', c0['header'])
            self.assertEqual('filtering_stats_xml_report.filter_xml_table.'
                             'filter_names_column', c0['id'])
            self.assertEqual('Polymerase Read Bases', c0['values'][0])
            self.assertEqual('Polymerase Reads', c0['values'][1])
            self.assertEqual('Polymerase Read N50', c0['values'][2])
            self.assertEqual('Polymerase Read Length', c0['values'][3])
            self.assertEqual('Polymerase Read Quality', c0['values'][4])

            self.assertEqual('Values', c1['header'])
            self.assertEqual('filtering_stats_xml_report.filter_xml_table.'
                             'filter_stats_column', c1['id'])
            self.assertEqual(4464266.29, c1['values'][0])
            self.assertEqual(901, c1['values'][1])
            self.assertEqual(6570, c1['values'][2])
            self.assertEqual(4954.79, c1['values'][3])
            self.assertEqual(0.83, c1['values'][4])
            self.assertTrue(os.path.exists(os.path.join(
                self.get_output_dir(),
                'readLenDist0.png')))
            self.assertTrue(os.path.exists(os.path.join(
                self.get_output_dir(),
                'readQualDist0.png')))

            # these are from a raw STS file
            self.assertEqual(len(rpt._dataset_uuids), 0,
                             "Incorrect report datasets uuids")

        except:
            log.error(traceback.format_exc())
            raise
 def test_make_filter_stats_report_dataset_multiple_chips(self):
     sts_xml = data.getXmlWithStats()
     rpt = make_filter_report(sts_xml, self.get_output_dir())
     d = json.loads(rpt.to_json())
     self._compare_attribute_values(report_d=d,
                                    expected_d={
                                        Constants.A_NBASES: 342348413,
                                        Constants.A_NREADS: 25123,
                                        Constants.A_READ_N50: 21884,
                                        Constants.A_READ_LENGTH: 13627
                                    })
     self.assertTrue(
         os.path.exists(
             os.path.join(self.get_output_dir(), 'readLenDist0.png')))
     self.assertTrue(
         os.path.exists(
             os.path.join(self.get_output_dir(), 'readLenDist1.png')))
    def test_make_filter_stats_report_dataset(self):
        """
        Test the content of the filter report generated from a dataset
        """
        sts_xml = pbtestdata.get_file("subreads-sequel")
        rpt = make_filter_report(sts_xml, self.get_output_dir())
        d = json.loads(rpt.to_json())
        self._compare_attribute_values(
            report_d=d,
            expected_d={
                Constants.A_NBASES: 1672335649,
                Constants.A_NREADS: 394658,
                Constants.A_READ_N50: 7750,
                Constants.A_READ_LENGTH: 4237,
            },
        )

        self.assertTrue(os.path.exists(os.path.join(self.get_output_dir(), "readLenDist0.png")))
예제 #8
0
    def test_make_filter_stats_report_dataset(self):
        """
        Test the content of the filter report generated from a dataset
        """
        sts_xml = pbtestdata.get_file("subreads-sequel")
        rpt = make_filter_report(sts_xml, self.get_output_dir())
        d = json.loads(rpt.to_json())
        self._compare_attribute_values(report_d=d,
                                       expected_d={
                                           Constants.A_NBASES: 1672335649,
                                           Constants.A_NREADS: 394658,
                                           Constants.A_READ_N50: 7750,
                                           Constants.A_READ_LENGTH: 4237
                                       })

        self.assertTrue(
            os.path.exists(
                os.path.join(self.get_output_dir(), 'readLenDist0.png')))