示例#1
0
    def test_add_empty(self):
        interval_metadata = IntervalMetadata()
        interval_metadata.add(Feature(gene='sagA'))
        feats = interval_metadata.query(gene='sagA')
        self.assertEqual(feats, [Feature(gene='sagA')])

        interval_metadata.add(Feature(gene='sagB'), ())
        feats = interval_metadata.query(gene='sagB')
        self.assertEqual(feats, [Feature(gene='sagB')])
示例#2
0
    def test_add(self):
        interval_metadata = IntervalMetadata()
        interval_metadata.add(Feature(gene='sagA'), 1, (4, 7))
        interval_metadata.add(Feature(gene='sagB'), (3, 5))

        # Relies on the test_query method to work
        feats = interval_metadata.query((1, 2))
        self.assertEqual(feats, [Feature(gene='sagA')])

        feats = interval_metadata.query(gene='sagB')
        self.assertEqual(feats, [Feature(gene='sagB')])
示例#3
0
    def test_query(self):
        interval_metadata = IntervalMetadata(features={
                           Feature(gene='sagA'): [(0, 2), (4, 7)],
                           Feature(gene='sagB'): [(3, 5)]
                       })

        feats = interval_metadata.query((1, 2))
        self.assertEqual(feats, [Feature(gene='sagA')])

        feats = interval_metadata.query(gene='sagB')
        self.assertEqual(feats, [Feature(gene='sagB')])