gelbench

Run an agarose gel before you pour one

gelbench is a physics engine for DNA gel electrophoresis. It is written in Rust, compiled to WebAssembly and runs entirely in your browser — no install, no account. Change the field or the agarose and the gel is recomputed, not looked up.

wells · − cathode ↑illustrationanode + ↓

Teaching scenarios

Ten ways a gel goes wrong — and why

Each scenario asks you to predict where the bands will land, runs the engine, then shows what you got wrong and the physics behind it.

  1. First gelA 100 bp – 23 kb ladder: separation comes from the gel's sieve, not from charge.
  2. Plasmid prepOne 4 kb plasmid, three bands — supercoiled, linear and nicked run at different speeds.
  3. Salty sample50 mM NaCl in the well lowers the local field, and that lane lags behind.
  4. No runThe ammeter reads zero and nothing moves: the buffer is below the bridges.
  5. Buffer overfillCurrent above nominal, bands slow — the buffer over the gel acts as a shunt.
  6. Overheating250 V "to go faster": Joule heating pushes the gel past ~65 °C within ~15 min.
  7. Overloaded well30 µL into an 18 µL well spills into the neighbours as ghost bands.
  8. Wavy castingThe same ladder in six lanes finishes on a wave because the gel was poured unevenly.
  9. Floating sampleLeftover ethanol floats the sample out of the well — pale bands, right depth.
  10. Small fragments ran offA 90-minute run on a 7 cm gel: stop by the dye front, not by the clock.

Plus a sandbox with every control unlocked.

What the engine computes

Mechanisms, not a lookup table

Scope: double-stranded DNA in agarose under a constant field. The goal is to get the relationships and the regimes right; every constant is traced to a source or marked as a placeholder.

Migration

Ogston sieving and biased reptation with field orientation, blended across the crossover. Plasmid forms I, II and III, with EtBr unwinding.

Band broadening

Diffusion in the gel after Pluen et al. (1999) and field-driven dispersion after Meistermann & Tinland (1998), both temperature-dependent.

Heat and circuit

Temperature-dependent conductivity; voltage, current or power mode; Joule heating across the gel width, from which the "smile" emerges.

Buffer chemistry

Local pH from charge balance, ionic-strength screening, electrolysis at the electrodes and buffer depletion in each reservoir.

Dyes and stain

Bromophenol blue and xylene cyanol fronts; EtBr binding by a McGhee–von Hippel isotherm, its migration and its drag on DNA.

The bench

Buffer level, well capacity and overflow, sample density and float-out, uneven casting, fragments leaving the gel.

Deterministic everywhere

The same scenario gives a bit-identical result natively on Linux and Windows and as WebAssembly in the browser. CI checks this on every change.

Fast enough to play with

About 2.5 ms per simulation step in the browser, so most scenarios compute in a few seconds.

Validation

Checked against published measurements

Some data sets were used to calibrate the model; others were held out and only compared against. The difference is marked.

SourceWhat is comparedAgreement
Holmes & Stellwagen 1990 calibrationAbsolute DNA mobilityRMS 4.2 %
Rill 2002 calibrationMobility at 5.0 and 3.5 V/cmRMS 4.7–4.9 %
Rill 2002 held outOther agarose concentrationsRMS 10–13 %
Van Winkle 2002 held outSize curve, 200 bp – 12 kb at 1 %within 15 %
Stellwagen 1997 held outFree-solution mobility−1.9 %
Sigmon 1996 calibrationEtBr retardation of DNAwithin 0.5 pp

Known limits

The simulator shows these caveats on the gel itself whenever a run touches one of them.

Contact

Using it in a class or a lab?

If you teach electrophoresis, have measurements the model gets wrong, or want to try it with students — write.

hello@gelbench.com