pythonforbio.
[WASM idle]
Genomics Basics01/02

DNA to mRNA: Transcription

Starting sandbox…
Beginnerpuzzle3 tests

The Central Dogma, in one function

DNA → RNA → Protein. This puzzle covers the first arrow: transcription.

Given a coding-strand DNA sequence, produce the corresponding mRNA sequence by swapping every T for a U. Biopython's Bio.Seq.Seq class has a .transcribe() method that does exactly this — no complementing, no reversing, just a base substitution.

from Bio.Seq import Seq

coding_strand = Seq("GATGGAACTTGACTACGTAAATT")
coding_strand.transcribe()
# Seq('GAUGGAACUUGACUACGUAAAUU')

Your task

Fill in transcribe_dna so it:

  1. Wraps the input string in a Seq.
  2. Calls .transcribe().
  3. Returns the result as a plain str (the test harness compares strings, not Seq objects).

Your function will be run once per test case with the DNA sequence piped in on stdin, and your printed output is compared line-for-line against the expected mRNA.

Stretch goal

Nucleotide composition is often reported as %GC content:

%GC=G+CA+T+G+C×100\%GC = \frac{G + C}{A + T + G + C} \times 100

Once the puzzle passes, try adding a gc_content(dna: str) -> float helper and printing it to stderr for your own sequences — it won't be graded, but it's good practice for the next lesson on variant calling.

Test cases · 3

#viainputexpected stdout
1stdinGATGGAACTTGACTACGTAAATTGAUGGAACUUGACUACGUAAAUU
2stdinATGCAUGC
3stdinTTTTAAAACCCCGGGGUUUUAAAACCCCGGGG
starter

No output yet — run the code to populate this drawer.

start of pathReading Variants: HGVS Format Validation