def test_inter(self): fi = gt.FeatureIndexMemory() gt.FeatureStream(gt.CustomStreamExample(self.ins), fi).pull() f = fi.get_features_for_seqid('ctg123') dfi = gt.FeatureNodeIteratorDepthFirst(f[0]) f = dfi.next() types = set([]) while f: types.update([f.type]) f = dfi.next() self.assertTrue('bar' in types, types)
def test_merge(self): fi = gt.FeatureIndexMemory() gt.FeatureStream(gt.MergeFeatureStream(self.ins), fi).pull() f = fi.get_features_for_seqid('seq1') self.assertEqual(len(f), 1) dfi = gt.FeatureNodeIteratorDirect(f[0]) sub = dfi.next() self.assertEqual(None, dfi.next()) self.assertEqual(sub.start, 1000) self.assertEqual(sub.end, 10000)
def test_dup(self): fi = gt.FeatureIndexMemory() gt.FeatureStream(gt.DuplicateFeatureStream(self.ins, "intron", "exon"), fi).pull() f = fi.get_features_for_seqid('ctg123') dfi = gt.FeatureNodeIteratorDepthFirst(f[0]) f = dfi.next() types = set([]) while f: types.update([f.type]) f = dfi.next() self.assertTrue('intron' in types, types)
def setUp(self): fi = gt.FeatureIndexMemory() self.gff_file = op.join(datadir, "U89959_sas.gff3") fi.add_gff3file(self.gff_file) self.fi = fi self.feature = fi.get_features_for_range(25000, 26000, '1877523')[0]
def test_pull(self): add_introns_stream = gt.AddIntronsStream(self.ins) fi = gt.FeatureIndexMemory() gt.FeatureStream(add_introns_stream, fi).pull() self.assertTrue('1877523' in fi.get_seqids())