DNA to mRNA: Transcription
The Central Dogma, in one function
The central dogma of molecular biology describes the flow of genetic information from DNA to RNA to functional protein. This exercise implements the first transformation: 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 provides a dedicated .transcribe() method that performs this base conversion directly on the coding strand without sequence reversal or complementation.
Seq('GAUGGAACUUGACUACGUAAAUU')
Your task
Fill in transcribe_dna so it:
- Wraps the input string in a
Seq. - Calls
.transcribe(). - Returns the result as a plain
str(the test harness compares strings, notSeqobjects).
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:
Upon completing the primary exercise, consider implementing a gc_content(dna: str) -> float helper to calculate nucleotide composition metrics for downstream analysis.
Test cases · 3
| # | via | input | expected stdout |
|---|---|---|---|
| 1 | stdin | GATGGAACTTGACTACGTAAATT | GAUGGAACUUGACUACGUAAAUU |
| 2 | stdin | ATGC | AUGC |
| 3 | stdin | TTTTAAAACCCCGGGG | UUUUAAAACCCCGGGG |