def test_get_coverage_stats(self): """ Test the coverage stats object (needs more) """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) self.assertEqual(485, len(stats.means))
def test_create_histogram(self): """ Simple (non null) test of histogram """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) stats = _get_reference_coverage_stats(pls.values()) fig, ax = _create_histogram(stats) self.assertIsNotNone(fig) self.assertIsNotNone(ax)
def test_create_histogram(self): """ Simple (non null) test of histogram """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) stats = _get_reference_coverage_stats(pls.values()) fig, ax = CoverageReport()._create_histogram(stats) self.assertIsNotNone(fig) self.assertIsNotNone(ax)
def test_get_coverage_stats(self): """ Test the coverage stats object (needs more) """ ref = os.path.join(self._data_dir, 'references', 'lambda') tcs = get_top_contigs(ref, 25) als = os.path.join(self._data_dir, 'alignment_summary.lambda.gff') pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) self.assertEqual(485, len(stats.means))
def test_create_histogram(self): """ Simple (non null) test of histogram """ ref = os.path.join(self._data_dir, 'references', 'lambda') tcs = get_top_contigs(ref, 25) als = os.path.join(self._data_dir, 'alignment_summary.lambda.gff') pls = _get_contigs_to_plot(als, tcs) stats = _get_reference_coverage_stats(pls.values()) fig, ax = _create_histogram(stats) self.assertIsNotNone(fig) self.assertIsNotNone(ax)
def test_create_coverage_histo_plot_grp(self): """ Test that plotGroup of the histogram is created as expected """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) stats = _get_reference_coverage_stats(pls.values()) plot_group = _create_coverage_histo_plot_grp(stats, self._output_dir) # only 1 histo self.assertEqual(1, len(plot_group.plots)) self._assert_image_file(plot_group.thumbnail) for plot in plot_group.plots: self._assert_image_file(plot.image)
def test_attributes_high_coverage(self): tcs = get_top_contigs(self.REFERENCE, 25) als = op.join(self._data_dir, "alignment_summary.lambda.gff") pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) att = _get_att_mean_coverage(stats) # This was in coverage.xml for the alignment summary gff used # attribute hidden="true" id="depth_coverage_mean" name="Coverage" # value="2958.16">2958.16</attribute> self.assertAlmostEqual(2958.16, att.value, places=2) att = _get_att_percent_missing(stats) self.assertEqual(0, att.value)
def test_attributes_high_coverage(self): tcs = get_top_contigs(self.REFERENCE, 25) als = op.join(self._data_dir, "alignment_summary.lambda.gff") pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) att = _get_att_mean_coverage(stats) # This was in coverage.xml for the alignment summary gff used # attribute hidden="true" id="depth_coverage_mean" name="Coverage" # value="2958.16">2958.16</attribute> self.assertEqual(2958, int(att.value)) att = _get_att_percent_missing(stats) self.assertEqual(0, att.value)
def test_create_coverage_histo_plot_grp(self): """ Test that plotGroup of the histogram is created as expected """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) stats = _get_reference_coverage_stats(pls.values()) plot_group = CoverageReport()._create_coverage_histo_plot_grp( stats, self._output_dir) # only 1 histo self.assertEqual(1, len(plot_group.plots)) self._assert_image_file(plot_group.thumbnail) for plot in plot_group.plots: self._assert_image_file(plot.image)
def test_attributes(self): """ Test that attribute values match expected """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) att = _get_att_mean_coverage(stats) # This was in coverage.xml for the alignment summary gff used # attribute hidden="true" id="depth_coverage_mean" name="Coverage" # value="2958.16">2958.16</attribute> self.assertAlmostEqual(1.228, att.value, places=3) att = _get_att_percent_missing(stats) self.assertAlmostEqual(58.4, att.value, places=1)
def test_attributes(self): """ Test that attribute values match expected """ tcs = get_top_contigs(self.REFERENCE, 25) als = self.GFF pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) att = _get_att_mean_coverage(stats) # This was in coverage.xml for the alignment summary gff used # attribute hidden="true" id="depth_coverage_mean" name="Coverage" # value="2958.16">2958.16</attribute> self.assertEqual(1, int(att.value)) att = _get_att_percent_missing(stats) self.assertAlmostEqual(0.584, att.value, places=3)
def test_create_coverage_histo_plot_grp(self): """ Test that plotGroup of the histogram is created as expected """ ref = os.path.join(self._data_dir, 'references', 'lambda') tcs = get_top_contigs(ref, 25) als = os.path.join(self._data_dir, 'alignment_summary.lambda.gff') pls = _get_contigs_to_plot(als, tcs) stats = _get_reference_coverage_stats(pls.values()) plot_group = _create_coverage_histo_plot_grp(stats, self._output_dir) # only 1 histo self.assertEqual(1, len(plot_group.plots)) self._assert_image_file(plot_group.thumbnail) for plot in plot_group.plots: self._assert_image_file(plot.image)
def test_attributes(self): """ Test that attribute values match expected """ ref = os.path.join(self._data_dir, 'references', 'lambda') tcs = get_top_contigs(ref, 25) als = os.path.join(self._data_dir, 'alignment_summary.lambda.gff') pls = _get_contigs_to_plot(als, tcs) contig = tcs[0] c_cov = pls[contig.header] stats = _get_reference_coverage_stats(pls.values()) att = _get_att_mean_coverage(stats) # This was in coverage.xml for the alignment summary gff used # attribute hidden="true" id="depth_coverage_mean" name="Coverage" value="2958.16">2958.16</attribute> self.assertEqual(2958.1640346377467, att.value) att = _get_att_percent_missing(stats) self.assertEqual(0, att.value)