Translate RNA sequences into proteins.
RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so:
RNA: "AUGUUUUCU"
=> translates to
Codons: "AUG", "UUU", "UCU"
=> which become a polypeptide with the following sequence =>
Protein: "Methionine", "Phenylalanine", "Serine"
There are 64 codons which in turn correspond to 20 amino acids; however, all of the codon sequences and resulting amino acids are not important in this exercise. If it works for one codon, the program should work for all of them. However, feel free to expand the list in the test suite to include them all.
There are also three terminating codons (also known as 'STOP' codons); if any of these codons are encountered (by the ribosome), all translation ends and the protein is terminated.
All subsequent codons after are ignored, like this:
RNA: "AUGUUUUCUUAAAUG"
=>
Codons: "AUG", "UUU", "UCU", "UAA", "AUG"
=>
Protein: "Methionine", "Phenylalanine", "Serine"
Note the stop codon "UAA"
terminates the translation and the final methionine is not translated into the protein sequence.
Below are the codons and resulting Amino Acids needed for the exercise.
Codon | Protein |
---|---|
AUG | Methionine |
UUU, UUC | Phenylalanine |
UUA, UUG | Leucine |
UCU, UCC, UCA, UCG | Serine |
UAU, UAC | Tyrosine |
UGU, UGC | Cysteine |
UGG | Tryptophan |
UAA, UAG, UGA | STOP |
Learn more about protein translation on Wikipedia
Please refer to the installation and learning help pages.
To run the test suite, execute the following command:
stack test
No .cabal file found in directory
You are probably running an old stack version and need to upgrade it.
No compiler found, expected minor version match with...
Try running "stack setup" to install the correct GHC...
Just do as it says and it will download and install the correct compiler version:
stack setup
If you want to play with your solution in GHCi, just run the command:
stack ghci
The exercism/haskell repository on GitHub is the home for all of the Haskell exercises.
If you have feedback about an exercise, or want to help implementing a new one, head over there and create an issue. We'll do our best to help you!
Tyler Long
It's possible to submit an incomplete solution so you can see how others have completed the exercise.