Welcome to Project Lovelace! We're still super new so there are still tons of bugs to find and improvements to make. If you have any suggestions, complaints, or any comments at all please let us know on Discourse!

DNA transcription

You will learn about: 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).


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)

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

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


Example

Input DNA: "CCAGGACCAGGCCCCAGGTGGGGCCAGGCCAGGCTC" ────────────────────────────────────────────────── Output RNA: "CCAGGACCAGGCCCCAGGUGGGGCCAGGCCAGGCUC"


 Difficulty  Timesink
 Maximum runtime 60 s  Max. memory usage 250 MiB
 Function signature rna(dna)

Write a function that accepts the input as function parameters and returns the correct output. Make sure to read the description above to produce the correct output in the correct format and use the correct function signature so we can run your code. A good first step is to try reproducing the example(s). Your code must not take longer than the maximum runtime to run and must not use more memory than the allowed limit.




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 view the discussion thread below. Feel free to post your solutions but please do your best to organize and document your code well so others can learn from it.