def test_segmetrics(self): """The 'segmetrics' command.""" cnarr = cnvlib.read("formats/amplicon.cnr") segarr = cnvlib.read("formats/amplicon.cns") for func in ( lambda x: metrics.confidence_interval_bootstrap(x, 0.05, 100), lambda x: metrics.prediction_interval(x, 0.05), ): lo, hi = commands._segmetric_interval(segarr, cnarr, func) self.assertEqual(len(lo), len(segarr)) self.assertEqual(len(hi), len(segarr)) sensible_segs_mask = (np.asarray(segarr['probes']) > 3) means = segarr[sensible_segs_mask, 'log2'] los = lo[sensible_segs_mask] his = hi[sensible_segs_mask] self.assertTrue((los < means).all()) self.assertTrue((means < his).all())
def test_segmetrics(self): """The 'segmetrics' command.""" cnarr = cnvlib.read("formats/amplicon.cnr") segarr = cnvlib.read("formats/amplicon.cns") for func in ( lambda x: metrics.confidence_interval_bootstrap(x, 0.05, 100), lambda x: metrics.prediction_interval(x, 0.05), ): lo, hi = commands._segmetric_interval(segarr, cnarr, func) self.assertEqual(len(lo), len(segarr)) self.assertEqual(len(hi), len(segarr)) sensible_segs_mask = (np.asarray(segarr['probes']) > 3) means = segarr[sensible_segs_mask, 'log2'] los = lo[sensible_segs_mask] his = hi[sensible_segs_mask] self.assertTrue((los < means).all()) self.assertTrue((means < his).all())