Beispiel #1
0
    def test_back_translate(self):
        prot = "ACDEFGHIKLMNPQRSTVWY*"
        t = GeneticCode.std()
        t.table["CGA"]
        s = t.back_translate(prot)
        self.assertEqual(prot, str(t.translate(s)))

        GeneticCode.std().back_table
Beispiel #2
0
    def test_translate_std(self):
        dna = "GCCATTGTAATGGGCCGCTGAAAGGGTGCCCGA"
        t = GeneticCode.std()
        s = t.translate(dna)
        self.assertEqual(str(s), "AIVMGR*KGAR")

        for t in GeneticCode.std_list():
            t.translate(dna)
Beispiel #3
0
    def test_translate(self):
        # Ref: http://lists.open-bio.org/pipermail/biopython/2006-March/002960.html

        cft = (
            ("Vertebrate Mitochondrial", 'GCCATTGTAATGGGCCGCTGAAAGGGTGCCCGA',
             'AIVMGRWKGAR'),
            (11, 'CAAGGCGTCGAAYAGCTTCAGGAACAGGAC', 'QGVE?LQEQD'),
            (1, 'GCCATTGTAATGGGCCGCTGAAAGGGTGCCCGA', 'AIVMGR*KGAR'),
        )

        for code, dna, protein in cft:
            c = GeneticCode.by_name(code)
            trans = c.translate(dna)
            self.assertEqual(str(trans), protein)

        self.assertRaises(ValueError, GeneticCode.by_name, 'not_a_name')
Beispiel #4
0
 def test_repr(self):
     for t in GeneticCode.std_list():
         r = repr(t)
         gc = eval(r)
         self.assertEqual(r, repr(gc))
         self.assertEqual(str(gc), str(t))