Welcome to Project Lovelace! We're still in early development so there are still tons of bugs to find and improvements to make. If you have any suggestions, complaints, or comments please let us know on Discourse, Discord, or GitHub!

DNA transcription

You will learn about: genetics and strings.

DNA (deoxyribonucleic acid) is the molecule that carries the genetic information of all known living organisms (life on exoplanets might be totally different!). The genetic information is stored as a sequence of nucleotides of which there are four: adenine (A), cytosine (C), guanine (G), and thymine (T). So a DNA sequence can be stored on a computer as a string of ATCG characters.


Certain DNA sequences contain the information required to syntheize proteins, and the first step in the process is to transcribe the DNA sequence into a ribonucleic acid (RNA) sequence. The transcription process is biochemically complex, however the resulting RNA sequence is simple: it's equal to the DNA sequence with all instances of T replaced with a U (uracil) and the sequence is reversed.


Given the DNA string as input, return the transcribed RNA string. Keep in mind that these sequences can be very long (the human genome is 3,088,286,401 characters or base pairs long!).

Comparison of DNA and RNA with their corresponding nucleotides. (Wikimedia Commons / CC BY-SA 3.0)

Once you've solved this problem check out RNA translation to learn how to translate RNA into amino acids.

Input: A string of ATCG characters representing a DNA sequence.

Output: The RNA sequence corresponding to the input DNA sequence.

Example

Input DNA: "CCTAGGACCAGGTT" Output RNA: "UUGGACCAGGAUCC"
 Difficulty  Timesink
 Function rna(dna)

You must be logged in to view your submissions.

Notes

  • The central dogma of molecular biology is commonly stated as "DNA makes RNA and RNA makes protein" so we are looking at the first half of it here where DNA gets transcribed into RNA.
  • CrashCourse has an excellent YouTube series on biology with videos on DNA Structure and Replication and DNA, Hot Pockets, & The Longest Word Ever which explains how DNA is transcribed to RNA in real life.
  • The Walter and Eliza Hall Institute of Medical Research makes molecular visualizations of DNA (also in HD with creepy sound effects!) which show in amazing detail how DNA is stored so compactly and how it's replicated and transcribed.
  • The human body has around 10 trillion cells, each of which has 1.8 meters of DNA. If you could stretch out all that DNA it would be 18 billion kilometers long, enough to wrap around the Earth's equator 450,000 times or cover the distance from the Sun to Pluto once or twice (depending on Pluto's current distance)!

Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.