For CS students crossing into biology

DNA forengineers.

DNA is a polymer that stores information in a 4-symbol alphabet. Cells read it, copy it, and execute it. Engineers now write it too.

A T C G 2 bits per base. ~3.1 Gbp per haploid human genome ≈ 770 MB.

Part IThe molecule
01

Chemistry, and why 5′→3′ is not a convention

A nucleotide is a sugar with a phosphate on one side and a base on the other. The sugar's carbons are numbered 1′ to 5′ ("prime"). Two of them matter.

5′ carbon carries the phosphate

This is the "input" end of a nucleotide.

3′ carbon carries a free hydroxyl (–OH)

The next nucleotide's phosphate bonds here. That link is a phosphodiester bond.

So a strand has a direction

One end has a free 5′ phosphate, the other a free 3′ –OH. Polymerases can only add to the 3′ end. Everything downstream (replication, transcription, sequencing chemistry) follows from this.

Deoxy = missing one oxygen

DNA's sugar lacks the 2′-OH that RNA has. That makes DNA far more stable: good for storage. RNA's 2′-OH makes it reactive and short-lived: good for a working copy.

P 5′ CH₂ O 1′2′3′4′ Base (A) H 3′ –OH P phosphodiester bond 3′-OH of unit 1 → phosphate → 5′ of unit 2 5′ CH₂ O Base (C) 3′ –OH ← next nucleotide adds here 5′3′ strand grows this way
02

Bases and pairing

Two ring-classes. A big base always pairs with a small one, so every rung is the same width (~1.08 nm between C1′ atoms). Click a base.

A
AdeninePurine · 2 rings · pairs T
G
GuaninePurine · 2 rings · pairs C
T
ThyminePyrimidine · 1 ring · pairs A · U in RNA
C
CytosinePyrimidine · 1 ring · pairs G
Common misconception: hydrogen bonds are not what mainly holds the helix together. Base stacking (flat rings piled face-to-face, hydrophobic and van der Waals) contributes more. H-bonds mostly provide specificity. GC-rich DNA still melts at a higher temperature (Tm), which matters for primer design.
03

Helix geometry

Two antiparallel strands, bases inside, sugar-phosphate backbone outside. The twist creates two grooves of unequal width.

Antiparallel

One strand runs 5′→3′ top to bottom, the other 3′→5′. Required for the bases to face each other.

Major and minor groove

The strands are not 180° apart around the axis. That leaves a wide groove and a narrow one. Proteins (transcription factors, Cas9) read the sequence from the major groove without unzipping the helix: each base pair exposes a distinct pattern of H-bond donors and acceptors there.

Right-handed, B-form

The form in cells at normal hydration. A-form (RNA duplexes, dehydrated DNA) is wider and squatter; Z-form is left-handed and rare.

Negatively charged

Every phosphate carries a −1 charge. That's why DNA moves toward the + electrode in gel electrophoresis, and why Mg²⁺ is in every enzyme buffer.

2 nm

helix diameter

0.34 nm

rise per base pair

10.5 bp

per full turn (3.4 nm pitch)

2.2 / 1.2 nm

major / minor groove width

04

Packing 2 metres into a 6 µm nucleus

A hierarchy of coiling. Each level multiplies compaction. The final chromosome is ~10,000× shorter than the naked DNA.

Why engineers care: packing is not just storage. Tightly wound regions (heterochromatin) are silent; loose regions (euchromatin) are readable. Chemical tags on histones and on DNA itself (methylation) control this: the epigenome. Same sequence, different program, per cell type.
Part IIThe code
05

The genome as data

The human reference genome, in numbers an engineer can use.

3.1 Gbp

haploid genome. 2 bits/base ≈ 770 MB raw. Compressible far below that; most of it repeats.

2 × 23

chromosomes: 22 autosome pairs + XX or XY. Each cell holds ~6.2 Gbp total.

~20,000

protein-coding genes, only ~1.5% of the sequence. Roughly the count in a worm.

~45%

transposable elements: ancient copy-paste sequences. Mostly inert.

0.1%

difference between two people: ~3–4 million single-nucleotide variants (SNVs).

~50 Mbp

to 250 Mbp per chromosome. One continuous double helix each.

Sizes for scale: E. coli 4.6 Mbp, 4,300 genes, one circular chromosome. Yeast 12 Mbp. A typical plasmid 3–10 kbp. A bacteriophage 5–50 kbp. SARS-CoV-2 (RNA) 30 kb. A single gene: from ~1 kbp to 2.4 Mbp (dystrophin), mostly introns.
06

Anatomy of a gene

A gene is not just the coding letters. It's a region with control elements, and (in eukaryotes) the coding parts are split by introns that get cut out.

Promoter

Upstream sequence where RNA polymerase and transcription factors bind. In eukaryotes often a TATA box ~25 bp before the start. Engineers swap promoters to control how strongly a gene is expressed.

Exons / introns

Exons are kept; introns are spliced out. Alternative splicing lets one gene yield many proteins: ~20k genes, >100k proteins.

UTRs

Untranslated regions flank the coding sequence in the mRNA. They regulate stability, localisation, and translation rate.

Enhancers, silencers

Control elements that can sit thousands of bases away and loop over in 3D. Gene regulation is a graph, not a line.

07

Transcription and translation

DNA → RNA → protein. The one diagram that clears up most confusion: which strand gets read, and which one the mRNA looks like.

Transcription (nucleus)

RNA polymerase unwinds ~15 bp, reads the template strand 3′→5′, and builds mRNA 5′→3′. The mRNA therefore matches the coding strand, with U for T. Then: 5′ cap, splicing, poly-A tail. Export to cytoplasm.

Translation (ribosome)

The ribosome scans for the first AUG, then reads 3 bases at a time. Each tRNA carries an anticodon and one amino acid. Stops at UAA, UAG, or UGA. Chain folds into a protein.

Rates

RNA pol: ~40 nt/s (human), ~50–90 nt/s (E. coli). Ribosome: ~5 aa/s human, ~20 aa/s bacteria. Bacteria translate while still transcribing; eukaryotes cannot (nuclear membrane).

Reverse flow exists

Retroviruses (HIV) run RNA → DNA with reverse transcriptase. Labs use the same enzyme to turn mRNA into cDNA for sequencing (RNA-seq).

08

The codon table

64 codons map onto 20 amino acids plus stop. The code is degenerate: most amino acids have several codons, usually differing at the 3rd position ("wobble"). Click any cell.

Nonpolar / hydrophobic (buried inside proteins)
Polar, uncharged
Positively charged (basic)
Negatively charged (acidic)
Stop
Click a codon.

Rows: 1st base. Columns: 2nd base. Inside each cell, top to bottom: 3rd base U, C, A, G. Standard code (NCBI table 1). Mitochondria and some microbes use slight variants. Shown in RNA (U); in DNA read T for U.

09

Replication

Semi-conservative: each daughter helix keeps one old strand. The machinery is constrained by one rule: polymerase only extends a 3′ end.

Helicase

Unzips the parent duplex at the fork. Single-strand binding proteins keep it open; topoisomerase relieves the overwinding ahead.

Primase

Polymerase cannot start from nothing. Primase lays a ~10-nt RNA primer with a 3′-OH to extend from.

DNA polymerase

Adds nucleotides 5′→3′. Also proofreads: a 3′→5′ exonuclease removes a wrong base before moving on. ~1 error per 10⁷; after mismatch repair, ~1 per 10⁹.

Leading strand

Runs toward the fork, so it is synthesised continuously.

Lagging strand

Runs away from the fork, so it is made backwards in Okazaki fragments (~150 nt eukaryote, ~1500 nt bacteria). Primers are removed, gaps filled, and ligase seals the nicks.

End problem

The last primer on the lagging strand leaves an unfilled gap. Chromosomes shorten each division unless telomerase extends the repeat cap (TTAGGG)ₙ.

10

Mutations

A change in sequence. What it does depends on where it lands and whether it shifts the reading frame. Pick a base, then edit it.

Original open reading frame (coding strand)
Replace selected with or
Result, read in codons
Substitution (SNV)

Silent: same amino acid (thanks to wobble). Missense: different amino acid (sickle cell: one A→T in β-globin). Nonsense: new stop codon, truncated protein.

Indel

Insertion or deletion. If the length is not a multiple of 3, every downstream codon shifts: a frameshift, usually fatal to the protein. Multiples of 3 add or drop whole amino acids.

Sources

Replication errors, UV (thymine dimers), chemicals, radiation, transposons. Most are repaired. Germline mutations are inherited; somatic ones are not.

Larger events

Copy-number variants, inversions, translocations, whole-gene duplication (the raw material for new genes).

Part IIIThe tools
11

Reading DNA: PCR and sequencing

You cannot see a single molecule. So first you copy it a billion times, then you read it.

PCR: exponential copying

Three temperatures, cycled ~30 times. Two short primers (18–25 nt) define which region gets copied. A heat-stable polymerase (Taq) survives the cycling.

Denature95 °C · strands separateAnneal50–65 °C · primers bind (set by Tm)Extend72 °C · polymerase copiesYield2ⁿ copies after n cycles → 30 cycles ≈ 10⁹

Sequencing: three generations

MethodRead lengthErrorUse
Sanger (1977)~800 bp~0.1%Verifying a plasmid or a single gene
Illumina (short-read)2 × 150 bp~0.1–1%Whole genomes, RNA-seq. Massive parallel; cheap per base
Nanopore / PacBio (long-read)10 kb – 1 Mb~1–5% raw, corrected by depthAssembly, structural variants, direct methylation

All produce short strings with per-base confidence. Coverage (how many reads overlap each base, e.g. 30×) is what makes the consensus reliable.

The file you'll actually get: FASTQ

@SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=36
GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACC
+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIII9IG9IC
4 lines per read

Header, sequence, +, quality string of equal length.

Phred quality

Q = −10·log₁₀(perror), stored as ASCII (char − 33). I = 40 → 1 error in 10,000. 9 = 24 → 1 in 250.

Related formats

FASTA (sequence only, >header), SAM/BAM (reads aligned to a reference), VCF (variants vs. reference), GenBank/GFF (annotated features).

12

Writing and editing DNA

Three techniques cover most of bioengineering: cut with restriction enzymes, carry on plasmids, and edit in place with CRISPR.

Restriction enzymes

Bacterial scissors that cut at a specific 4–8 bp site, usually a palindrome (reads the same 5′→3′ on both strands). Staggered cuts leave sticky ends that base-pair with any matching end, so fragments from different sources can be joined by ligase.

Plasmids

Small circular DNA (3–10 kb) that bacteria copy on their own. The standard vehicle: ori for replication, a promoter driving your gene, a selection marker (antibiotic resistance) so only cells that took it up survive. Modern assembly (Gibson, Golden Gate) joins many parts in one reaction.

CRISPR-Cas9

A programmable nuclease. A 20-nt guide RNA base-pairs with the target; Cas9 cuts both strands 3 bp upstream of a PAM (NGG). The cell repairs the break: sloppily by NHEJ (knockouts via indels) or precisely by HDR if you supply a template (knock-ins). Base and prime editors avoid the double-strand break entirely.

Synthesis: you can order any sequence up to a few kb, made chemically ~1 base at a time (phosphoramidite chemistry, ~99.5% per step, which is why long oligos are error-prone). Enzymatic synthesis and DNA data storage (~10¹⁸ bytes per mm³ theoretical) build on this.
13

Sequence toolkit

Paste raw bases or a FASTA record. Everything below is computed in the page; view source to see the algorithms.

0

bases

GC content

Tm estimate (°C)

bits · MW (kDa, dsDNA)

Complement (3′→5′) and reverse complement (5′→3′)
mRNA (transcript of this coding strand)
Translation in the three forward frames · M start · * stop
Open reading frames (ATG … stop, ≥ 5 codons, both strands)
    Restriction sites

      Tm: Wallace rule (2·AT + 4·GC) under 14 nt, else 64.9 + 41·(GC − 16.4)/N. Good enough for primer sanity checks; use nearest-neighbour models for real work.

      14

      CS ↔ Bio map

      The concepts you already have, and what they're called on the other side.

      string over Σ = {A,C,G,T}Sequence. Always written 5′→3′.
      reverse(map(complement, s))Reverse complement. The other strand, read in its own 5′→3′. A gene can sit on either strand.
      edit distance, DP O(nm)Alignment. Needleman–Wunsch (global), Smith–Waterman (local), with substitution matrices and affine gap penalties.
      seed-and-extend heuristicBLAST. Index short k-mer seeds, extend hits. The search engine of biology.
      Burrows–Wheeler + FM-indexRead mapping (BWA, Bowtie). Aligns 10⁹ short reads to a 3 Gbp reference in hours.
      k-mers, de Bruijn graph, Eulerian pathGenome assembly from reads with no reference (SPAdes, Velvet).
      hidden Markov modelGene finding, profile HMMs for protein families (HMMER, Pfam).
      Hamming distance = 1SNV. Point mutation. Indels are Levenshtein edits.
      compiler / interpreterRibosome, with the codon table as the instruction set. Promoters ≈ function entry points; transcription factors ≈ conditionals.
      version control, replication factor 2Diploidy. Two copies of each chromosome. Heterozygous = the copies differ at that locus.
      error-correcting codeDegeneracy + proofreading + mismatch repair. Net ~10⁻⁹ per base per division.
      storage medium, 2 bits/symbolDNA data storage. Encode bytes to bases (avoid homopolymers, balance GC), synthesise, sequence, decode. Currently ~$1000/MB to write.
      Libraries to start with: Biopython (parsing, alignment, translation), samtools/bcftools (BAM/VCF), BLAST+, minimap2 (alignment), Snakemake or Nextflow (pipelines). Data: NCBI GenBank, Ensembl, UniProt, SRA (raw reads).
      15

      Check yourself

      16

      Glossary

      NucleotidePhosphate + deoxyribose + base. The monomer.
      Phosphodiester bondCovalent link 3′-OH → phosphate → 5′. Forms the backbone.
      AntiparallelThe two strands run in opposite 5′→3′ directions.
      Coding / template strandmRNA matches the coding strand; polymerase reads the template.
      CodonThree bases → one amino acid or stop. 64 total.
      ORFOpen reading frame: ATG … stop with no stop in between.
      Exon / intronKept / removed during splicing.
      PromoterSequence upstream of a gene where transcription starts.
      ChromatinDNA + histones. Its packing state controls gene access.
      HistoneProtein spool; 147 bp wrap each octamer to form a nucleosome.
      Genome / exome / transcriptomeAll DNA / just exons / all RNA present in a sample.
      SNV / SNPSingle-nucleotide variant; polymorphism if common in a population.
      AlleleOne version of a gene or locus. You carry two.
      LocusA position on a chromosome, e.g. chr11:5,225,464.
      Homolog / orthologRelated by descent / same gene in different species.
      TmMelting temperature: half the duplexes are single-stranded.
      PrimerShort oligo that gives polymerase a 3′ end to start from.
      OligoShort synthetic DNA, typically 15–100 nt.
      VectorDNA carrier (plasmid, virus) used to deliver a sequence into cells.
      Coverage / depthAverage number of reads spanning each base.
      Contig / scaffoldAssembled contiguous sequence / contigs ordered with gaps.
      EpigeneticsHeritable changes in expression without sequence change.
      MethylationCH₃ on cytosine (CpG) or histones. Usually silences.
      PAMProtospacer-adjacent motif; NGG for SpCas9. Required next to the cut site.