From Project ROSALIND: Translating RNA into Protein http://rosalind.info/problems/prot/ Version History 2020-04-12 — David M. Ng — Initial version. 2020-04-13 — David M. Ng — Updated Project Page.
Funny Scratch problem: You will see the word "am*no" with a * as if the spelled-out word is a bad word. But with “acid”, this is merely the monomer of proteins. This is what Scratch told me: "Hmm...the bad word detector thinks there is a problem with your text. Please change it and remember to be respectful." Implemented by starting from https://scratch.mit.edu/projects/336800166/: 1. Added 1-letter am*no acid (AA) codes in addition to existing 3-letter codes. Also had to eliminate the space character between AA codes. 2. Removed code irrelevant for this specific problem (e.g., transcription), except the code for 3-letter codes has been retained (for future possible use). Implementation notes 1. To translate each codon: 1. Variable “codon” contains the three mRNA base letters extracted from the mRNA sequence. 2. Search CodonTable for a match to the codon. This is a “linear” search: start at the first item in the table and check each entry in order. 3. Use the same match position from CodonTable to access the AminoAcidTable for the am*no acid corresponding to the codon. This technique is called “parallel arrays” or “parallel lists” (and is used because Scratch does not have the “struct” or “record” data structure). 4. Note: There are (potentially) faster search methods than linear search, but the savings in time is not worth the time or effort. First, it would take longer to implement faster code than any time savings! And second, who really cares how fast this code runs? 2. If the translation code were to be incorporated into another program, “local” variables, input parameters, and output result variables would need to be renamed to avoid naming conflicts. This would best be done by following a naming convention. (This is required because Scratch does not support name scoping.)