def testCodonContent(self): """ Codons must only contain the letters A, T, G, C. """ for codons in CODONS.values(): for codon in codons: self.assertTrue(all(letter in 'ACGT' for letter in codon))
def testStopCodonsNotInCodonTable(self): """ The stop codons must not be in the main table. """ for stop in STOP_CODONS: for codons in CODONS.values(): self.assertNotIn(stop, codons)
def testCodonsAreNotAbbrev3s(self): """ No codon can be the same as an amino acid 3-letter abbreviation (or else our find function may not be unambiguous in what it returns). """ for codons in CODONS.values(): self.assertFalse( any(codon.title() in ABBREV3_TO_ABBREV1 for codon in codons))
def testDistinct(self): """ All nucleotide triples must be distinct. """ seen = set() for codons in CODONS.values(): for codon in codons: seen.add(codon) self.assertEqual(61, len(seen))
def testAllCodonsPresent(self): """ All possible codons must be present, as either coding for an AA or as a stop codon. """ combinations = set(''.join(x) for x in product('ACGT', 'ACGT', 'ACGT')) for codons in CODONS.values(): for codon in codons: combinations.remove(codon) # Just the stop codons should be left. self.assertEqual(set(STOP_CODONS), combinations)
def testAllCodonsPresent(self): """ All possible codons must be present, as either coding for an AA or as a stop codon. """ combinations = set( ''.join(x) for x in product('ACGT', 'ACGT', 'ACGT')) for codons in CODONS.values(): for codon in codons: combinations.remove(codon) # Just the stop codons should be left. self.assertEqual(set(STOP_CODONS), combinations)
def testCodonLength(self): """ All codons must be three bases long. """ for codons in CODONS.values(): self.assertTrue(all(len(codon) == 3 for codon in codons))
def testNumberCodons(self): """ The table must contain 61 codons. This is 4^3 - 3. I.e., all possible combinations of 3 bases minus the three stop codons. """ self.assertEqual(61, sum(len(codons) for codons in CODONS.values()))
def testNumberCodons(self): """ The table must contain the right number of codons. """ self.assertEqual(44, sum(len(codons) for codons in CODONS.values()))