Sha256: d3ce56a21ea43c00ba21473fe102a2fecf0a713658efb49365400eadfb2d9415
Contents?: true
Size: 793 Bytes
Versions: 108
Compression:
Stored size: 793 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: %s' % codon) return CODONS[codon] def of_rna(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
108 entries across 108 versions & 1 rubygems