Simulation: N distinct 300-bp blocks; each transcript is 2–5 blocks, so transcripts share blocks and a read from a shared block is multi-mapped. Transcript fractions pt are uniform random; a read picks a transcript in proportion to pt·lt and a position along it (uniform, or exponential from one end with mean 300 bp). All reads with the same hit pattern δ (hits per transcript) collapse into one line count: δ1,…,δn. EM: start by giving each transcript 1/k of every read that hits k transcripts, so qt(0) = (Σi δit/Σsδis) / R (exact already when no read is multi-mapped), then repeat qt(k+1) = (1/R) Σi δitqt(k)/lt ⁄ Σsδisqs(k)/ls (E-step: split each read among the transcripts it hits by per-base abundance; M-step: average). The transcript fraction is pt ∝ qt/lt and TPM = 106·pt. Edit the pattern lines to run EM on your own counts. Keys: → step, ← back, f run all, r reset, s re-simulate.