Sha256: e6dd356979d62610f127c0bf9ebaded6b3016395b59d1c4fd2f62fc41b01506d
Contents?: true
Size: 801 Bytes
Versions: 105
Compression:
Stored size: 801 Bytes
Contents
CODONS = {'AUG': "Methionine", 'UUU': "Phenylalanine", 'UUC': "Phenylalanine", 'UUA': "Leucine", 'UUG': "Leucine", 'UCU': "Serine", 'UCC': "Serine", 'UCA': "Serine", 'UCG': "Serine", 'UAU': "Tyrosine", 'UAC': "Tyrosine", 'UGU': "Cysteine", 'UGC': "Cysteine", 'UGG': "Tryptophan", 'UAA': "STOP", 'UAG': "STOP", 'UGA': "STOP"} def of_codon(codon): if codon not in CODONS: raise ValueError('Invalid codon: {}'.format(codon)) return CODONS[codon] def proteins(strand): proteins = [] for codon in map(of_codon, _chunkstring(strand, 3)): if codon == 'STOP': break proteins.append(codon) return proteins def _chunkstring(string, n): return (string[i:n + i] for i in range(0, len(string), n))
Version data entries
105 entries across 105 versions & 1 rubygems