C.W.K.
Stream
Lesson 02 of 05 · published

DNA is code — the four-letter alphabet that runs life

~30 min · dna, code, compilation

Level 0Curious Beginner
0 XP0/43 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

The simplest view of the most complex thing

DNA is a long string of just four letters: A, T, C, G (adenine, thymine, cytosine, guanine). That's it. The entire genome of every living thing — every plant, every animal, every microbe — is a sequence of those four letters, billions of letters long.

You can write the same alphabet in software:

genome = "ATCGGTAGCTAATCG..."

The string of As, Ts, Cs, Gs is, structurally, a program. It's not metaphorically a program. It's literally a sequence that gets read by molecular machinery and executed to produce proteins, which then build everything else.

The compilation step

How does a string of four letters become a leg, an eye, a kidney? The answer is the most beautiful compile/execute pipeline in the universe.

  1. Read. A region of DNA is *transcribed* into RNA (a similar string, with U replacing T). RNA is the working copy.
  2. Compile. Each three-letter chunk of RNA (a *codon*) maps to one of 20 amino acids. AUG means "start, also methionine." UAA means "stop." The mapping is a fixed lookup table called the genetic code, identical across nearly all life on Earth.
  3. Execute. The amino acids string together into a protein. The protein folds into a 3D shape. The shape determines the function. Function determines what happens in the cell.

The 20-amino-acid alphabet, compiled from a 4-letter source, building proteins which assemble into cells which assemble into organs which assemble into you. It's a stack of compilers all the way up.

The shared genetic code is the spine-tingler

Here's the part that should give you pause. The mapping from codons to amino acids — the genetic code — is nearly identical in every living thing on Earth. From bacteria to whales to oak trees. AUG means methionine and "start" in your cells. It means the same in a tomato. It means the same in a tardigrade.

This means every living thing on Earth shares a common ancestor — a single cell, a few billion years ago — and we've been remixing the same code base ever since. You and a redwood share a compiler. Different inputs, different outputs, same stack.

What this opens for the next lesson

If DNA is code and the genetic code is shared, then evolution is just changes in the source over time, with natural selection acting as a brutal QA pass. That's the next lesson — evolution as inheritance with override.

Code

DNA as a literal string·python
# DNA is structurally a string in a four-letter alphabet.
genome_fragment = "ATGGCCATCAGT"  # would be billions of letters in full

# Reading 3-letter codons maps each to one of 20 amino acids
genetic_code = {
    "ATG": "Met (start)", "GCC": "Ala", "ATC": "Ile", "AGT": "Ser",
    # ... 64 codons total, mapping to 20 amino acids + start/stop
}

for i in range(0, len(genome_fragment), 3):
    codon = genome_fragment[i:i+3]
    print(codon, "->", genetic_code.get(codon, "?"))

External links

Exercise

Look up your favorite animal's genome size. Compare to your own (~3 billion letters). Notice how close almost every animal genome is in size, and how much of the underlying instruction set is shared. The differences between species are mostly *which sections are read when* — different reads of similar code.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.