Ejemplo n.º 1
0
 def testExtra(self):
     tf = TrackFormat.createInstanceFromPrefixList(['start', 'a', 'b', 'c'], 'float64', 1, 'float64', 1)
     self.assertTrue(tf.hasExtra(specificExtra='a'))
     self.assertFalse(tf.hasExtra(specificExtra='d'))
     
     self.assertEqual(['a','b','c'], tf.getExtraNames())
     
     tfq = TrackFormatReq(interval=False, extra=['a','b'])
     self.assertFalse(tfq.isCompatibleWith(tf))
    def _assertConvertSegmentToPoint(self, targetStarts, sourceTv, converterCls):
        pointFormat = TrackFormatReq(interval=False, dense=False)
        self.assertTrue(converterCls.canHandle(sourceTv.trackFormat, pointFormat))
 
        targetTv = converterCls.convert(sourceTv)
        self.assertTrue(pointFormat.isCompatibleWith(targetTv.trackFormat))
            
        self.assertEqual(targetStarts, [el.start() for el in targetTv])
        for el in targetTv:
            self.assertEqual(el.start() + 1, el.end())
Ejemplo n.º 3
0
    def testWeightTypes(self):
        tf = TrackFormat.createInstanceFromPrefixList(['id', 'edges', 'weights'], 'float64', 1, 'S8', 3)
        
        self.assertTrue(tf.isWeighted(specificWeightType='category_vector'))
        self.assertFalse(tf.isWeighted(specificWeightType='number'))

        self.assertEqual('Vector of categories', tf.getWeightTypeName())
        self.assertEqual('Linked base pairs', tf.getFormatName())
        
        tfq = TrackFormatReq(linked=True, weights='number')
        self.assertFalse(tfq.isCompatibleWith(tf))
Ejemplo n.º 4
0
 def testValTypes(self):
     tf = TrackFormat.createInstanceFromPrefixList(['start', 'val'], 'float128', 2, 'float64', 1)
     
     self.assertTrue(tf.isValued(specificValType='mean_sd'))
     self.assertFalse(tf.isValued(specificValType='number'))
     
     self.assertEqual('Mean and std.dev.', tf.getValTypeName())
     self.assertEqual('Valued points', tf.getFormatName())
     
     tfq = TrackFormatReq(interval=False, val='tc')
     self.assertFalse(tfq.isCompatibleWith(tf))