예제 #1
0
 def test_picard_read_metrics(self):
     """Test function _read_picard_metrics"""
     (metrics, hist) = _read_picard_metrics(align_metrics[0])
     self.assertIsNone(hist)
     self.assertEqual(len(metrics), 4)
     (metrics, hist) = _read_picard_metrics(insert_metrics[0])
     self.assertListEqual(sorted(hist[0]), sorted(['insert_size', 'All_Reads.fr_count']))
     self.assertEqual(metrics[1][0], 156)
예제 #2
0
def setUp():
    """Set up test fixtures for metrics test"""

    global PM, PH, AMa, IMa, DMa, HMa, AMf, IMf, DMf, HMf, align_metrics, dup_metrics, insert_metrics, hs_metrics, alnmet, insmet, dupmet, hsmet, inshist, duphist, Adf, Idf, Idfh, Ddf, Ddfh, Hdf

    metricsroot = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                               os.pardir, 'data', 'metrics', 'J.Doe_00_01')
    metricsfiles = []
    for root, dirs, files in os.walk(metricsroot):
        metricsfiles += [os.path.join(root, x) for x in files if x.endswith('metrics')]

    align_metrics = sorted([x for x in metricsfiles if x.endswith('align_metrics')])
    hs_metrics = sorted([x for x in metricsfiles if x.endswith('hs_metrics')])
    insert_metrics = sorted([x for x in metricsfiles if x.endswith('insert_metrics')])
    dup_metrics = sorted([x for x in metricsfiles if x.endswith('dup_metrics')])

    (alnmet, _) = _read_picard_metrics(align_metrics[0])
    (insmet, inshist) = _read_picard_metrics(insert_metrics[0])
    (hsmet, _) = _read_picard_metrics(hs_metrics[0])
    (dupmet, duphist) = _read_picard_metrics(dup_metrics[0])

    PM = PicardMetrics(identifier="PM", filename=align_metrics[0])
    PH = PicardHistMetrics(identifier="PH", filename=insert_metrics[0])
    AMf = AlignMetrics(identifier="AM", filename=align_metrics[0])
    IMf = InsertMetrics(identifier="IM", filename=insert_metrics[0])
    HMf = HsMetrics(identifier="HM", filename=hs_metrics[0])
    DMf = DuplicationMetrics(identifier="DM", filename=dup_metrics[0])

    AMa = AlignMetrics(*alnmet, identifier="AM")
    IMa = InsertMetrics(*insmet, hist=inshist, identifier="IM")
    HMa = HsMetrics(*hsmet, identifier="HM")
    DMa = DuplicationMetrics(*dupmet, hist=duphist, identifier="DM")

    Adf = DataFrame(*alnmet)
    Idf = DataFrame(*insmet)
    Idfh = DataFrame(*inshist)
    Ddf = DataFrame(*dupmet)
    Ddfh = DataFrame(*duphist)
    Hdf = DataFrame(*hsmet)