Exemple #1
0
 def test_combine_metrics(self):
     """Test combining metrics"""
     amsa = AMa.category()
     mlist = list(zip([DMa],[IMa],[amsa],[HMa]))
     colnames = [c for sublist in [m.metrics.colnames for mtup in mlist for m in mtup] for c in sublist]
     cnt = Counter(colnames)
     
     # Merge colnames
     pm = combine_metrics(mlist)
     self.assertEqual((len(cnt)), pm.metrics.dim[1])
     # Make colnames unique
     pm = combine_metrics(mlist, uniquify=True)
     self.assertEqual((len(colnames)), pm.metrics.dim[1])
Exemple #2
0
def setUp():
    """Set up test fixtures"""

    global mlist, Sample, pm

    Sample = namedtuple('Sample', ['sample_id', 'project_id', 'pm'])
    
    metricsroot = os.path.join(os.path.abspath(os.curdir),
                               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 = [x for x in metricsfiles if x.endswith('align_metrics')]
    hs_metrics = [x for x in metricsfiles if x.endswith('hs_metrics')]
    insert_metrics = [x for x in metricsfiles if x.endswith('insert_metrics')]
    dup_metrics = [x for x in metricsfiles if x.endswith('dup_metrics')]

    mlist =(list(
        zip(
            [AlignMetrics(filename=x).category() for x in align_metrics],
            [InsertMetrics(filename=x) for x in insert_metrics],
            [DuplicationMetrics(filename=x) for x in dup_metrics],
            [HsMetrics(filename=x) for x in hs_metrics]
        )
    ))
    pm = combine_metrics(mlist)
Exemple #3
0
 def test_combine_multiple_metrics(self):
     """Test combining multiple metrics"""
     mlist =(list(
         zip(
             [AlignMetrics(filename=x).category() for x in align_metrics],
             [InsertMetrics(filename=x) for x in insert_metrics],
             [DuplicationMetrics(filename=x) for x in dup_metrics],
             [HsMetrics(filename=x) for x in hs_metrics]
         )
     ))
     pm = combine_metrics(mlist)
     self.assertTupleEqual(pm.metrics.dim, (2,91))
     self.assertListEqual(pm.summary(raw=True).split("\n")[1].split("\t")[:25], [v for k,v in AMa.metrics.data[2].items()])