コード例 #1
0
 def test_short_sequences(self):
     seq = "AATGTAGGAAAAACAGCATTTTCATTTCGCCATTTT"
     p = Pyrodigal(meta=True)
     for i in range(1, len(seq)):
         genes = p.find_genes(seq[:i])
         self.assertEqual(len(genes), 0)
         self.assertRaises(StopIteration, next, iter(genes))
コード例 #2
0
ファイル: test_pyrodigal.py プロジェクト: jianshu93/pyrodigal
 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))
コード例 #3
0
 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))
コード例 #4
0
 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))
コード例 #5
0
def run_prodigal(seqrecord):
    id = seqrecord.id
    nuclen = len(str(seqrecord.seq))
    p = Pyrodigal(meta=True)
    #p.train(str(seqrecord.seq))
    genes = p.find_genes(str(seqrecord.seq))

    table_11 = [gene.translate(translation_table=11) for gene in genes]
    table_4 = [gene.translate(translation_table=4) for gene in genes]
    table_15 = [gene.translate(translation_table=15) for gene in genes]

    #Chooses best translation table (highest coding density)
    all_lens = find_max(table_4, table_11, table_15)
    table_densities = [float(x) / float(nuclen) for x in all_lens]

    return [id] + table_densities
コード例 #6
0
ファイル: test_pyrodigal.py プロジェクト: jianshu93/pyrodigal
 def test_overflow(self):
     # > 180195.SAMN03785337.LFLS01000089
     seq = """
     AACCAGGGCAATATCAGTACCGCGGGCAATGCAACCCTGACTGCCGGCGGTAACCTGAAC
     AGCACTGGCAATCTGACTGTGGGCGGTGTTACCAACGGCACTGCTACTACTGGCAACATC
     GCACTGACCGGTAACAATGCGCTGAGCGGTCCGGTCAATCTGAATGCGTCGAATGGCACG
     GTGACCTTGAACACGACCGGCAATACCACGCTCGGTAACGTGACGGCACAAGGCAATGTG
     ACGACCAATGTGTCCAACGGCAGTCTGACGGTTACCGGCAATACGACAGGTGCCAACACC
     AACCTCAGTGCCAGCGGCAACCTGACCGTGGGTAACCAGGGCAATATCAGTACCGCAGGC
     AATGCAACCCTGACGGCCGGCGACAACCTGACGAGCACTGGCAATCTGACTGTGGGCGGC
     GTCACCAACGGCACGGCCACCACCGGCAACATCGCGCTGACCGGTAACAATGCACTGGCT
     GGTCCTGTCAATCTGAACGCGCCGAACGGCACCGTGACCCTGAACACAACCGGCAATACC
     ACGCTGGGTAATGTCACCGCACAAGGCAATGTGACGACTAATGTGTCCAACGGCAGCCTG
     ACAGTCGCTGGCAATACCACAGGTGCCAACACCAACCTGAGTGCCAGCGGCAATCTGACC
     GTGGGCAACCAGGGCAATATCAGTACCGCGGGCAATGCAACCCTGACTGCCGGCGGTAAC
     CTGAGC
     """
     p = Pyrodigal(meta=True, closed=False)
     genes = p.find_genes(textwrap.dedent(seq).replace("\n", ""))
     self.assertEqual(len(genes), 1)
     self.assertEqual(genes[0].start_type, "Edge")
     self.assertTrue(genes[0].partial_begin)
     self.assertTrue(genes[0].partial_end)
コード例 #7
0
 def find_genes(cls, seq):
     p = Pyrodigal(meta=True)
     return p.find_genes(seq)
コード例 #8
0
ファイル: test_pyrodigal.py プロジェクト: jianshu93/pyrodigal
 def find_genes(cls, seq):
     p = Pyrodigal(meta=False)
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         p.train(seq)
     return p.find_genes(seq)
コード例 #9
0
 def test_empty_sequence(self):
     p = Pyrodigal(meta=True)
     genes = p.find_genes("")
     self.assertEqual(len(genes), 0)
     self.assertRaises(StopIteration, next, iter(genes))