def test_training_info_deallocation(self): p = Pyrodigal(meta=False) with warnings.catch_warnings(): warnings.simplefilter("ignore") p.train(str(self.record.seq)) genes = p.find_genes(str(self.record.seq)) del p # normally should not deallocate training info since it's RC self.assertEqual(genes[0].translate(), str(self.proteins[0].seq))
def test_empty_sequence(self): p = Pyrodigal(meta=False) with warnings.catch_warnings(): warnings.simplefilter("ignore") p.train(str(self.record.seq[:20000])) genes = p.find_genes("") self.assertEqual(len(genes), 0) self.assertRaises(StopIteration, next, iter(genes))
def test_short_sequences(self): seq = "AATGTAGGAAAAACAGCATTTTCATTTCGCCATTTT" p = Pyrodigal(meta=False) with warnings.catch_warnings(): warnings.simplefilter("ignore") p.train(str(self.record.seq[:20000])) for i in range(1, len(seq)): genes = p.find_genes(seq[:i]) self.assertEqual(len(genes), 0) self.assertRaises(StopIteration, next, iter(genes))
def find_genes(cls, seq): p = Pyrodigal(meta=False) with warnings.catch_warnings(): warnings.simplefilter("ignore") p.train(seq) return p.find_genes(seq)