Property Prediction and ADMET¶
Finding a molecule that binds tightly to a disease protein in a test tube is only the opening chapter of drug discovery, because most candidates fail later on solubility, metabolism, or toxicity. This file examines ADMET optimisation, drug-likeness scoring, the hidden evaluation traps of random splits and activity cliffs, uncertainty-guided active learning, and molecular foundation models.
Why Potency Alone Never Makes a Medicine¶
-
Imagine hiring the finest heart surgeon in the world, only to discover that their car breaks down before reaching the hospital, security stops them at the front door, and they are allergic to the operating theatre. No matter how brilliant their surgical skill is, the patient never benefits.
-
Drug discovery faces that exact reality. A molecule that binds a target enzyme with nanomolar potency in a glass dish is merely a tool compound, not a medicine. Roughly nine out of ten clinical drug candidates fail in human trials, and a massive share of those failures stem not from weak potency, but from poor ADMET behaviour inside a living body.
-
ADMET stands for the five biological hurdles every candidate must clear simultaneously.
- Absorption determines whether an orally swallowed pill actually dissolves in gut fluid and crosses the intestinal wall into the bloodstream rather than passing straight through.
- Distribution governs where the compound travels once in circulation, including whether it avoids sticking irreversibly to blood plasma proteins and whether it can (or should not) cross the tightly guarded blood-brain barrier (BBB).
- Metabolism tracks how rapidly liver enzymes (especially the cytochrome P450 family) chemically chop up the drug. Break it down too fast and the medicine vanishes before working; inhibit CYP enzymes and the patient suffers dangerous drug-drug interactions.
- Excretion measures how cleanly the kidneys or bile clear the compound and its breakdown products so they do not accumulate to hazardous levels over weeks of dosing.
- Toxicity flags lethal side effects such as blocking cardiac hERG potassium channels (which triggers fatal arrhythmias), damaging liver cells, or mutating DNA.
-
Crucially, ADMET turns molecule design into a brutal multi-objective optimisation gauntlet. A brilliant score on four properties never compensates for failing the fifth. Fixing one flaw often breaks another, because adding greasy carbon rings to boost potency typically ruins aqueous solubility and invites liver enzymes to attack.
Drug-Likeness, Lipinski's Rule of Five, QED, and QSAR¶
-
Before airport security inspects every pocket of your suitcase, a simple steel sizing cage at the gate weeds out bags that clearly will not fit in the overhead bin. Medicinal chemists use lightweight physicochemical filters in the same spirit to discard unlikely oral drugs early.
-
In 1997, Christopher Lipinski analysed thousands of successful oral medicines and noticed a striking pattern known as Lipinski's Rule of Five (named because every threshold is a multiple of five). An orally bioavailable small molecule generally has poor absorption when it violates more than one of four simple limits.
- Molecular weight \(\text{MW} \le 500\text{ Da}\) (small enough to diffuse across cell membranes).
- Octanol-water partition coefficient \(\log P \le 5\) (not too greasy to dissolve in water).
- Hydrogen-bond donors \(\text{HBD} \le 5\) (too many polar OH or NH groups make crossing fatty membranes costly).
- Hydrogen-bond acceptors \(\text{HBA} \le 10\).
-
Lipinski's rules are useful guardrails rather than iron laws of nature. A molecule at \(501\text{ Da}\) does not magically stop working compared with one at \(499\text{ Da}\), and modern therapeutic classes such as macrocycles and targeted protein degraders (PROTACs) routinely succeed "beyond the Rule of Five".
-
To replace brittle pass-or-fail step functions with a smooth score, Bickerton and colleagues introduced QED (Quantitative Estimate of Drug-likeness) in 2012. QED evaluates eight key molecular descriptors (including \(\text{MW}\), \(\log P\), polar surface area, rotatable bonds, aromatic rings, and structural alerts), maps each descriptor \(x_i\) onto a smooth bell-shaped desirability curve \(d_i(x_i) \in (0, 1]\) fitted to approved oral drugs, and combines them through a weighted geometric mean.
-
Because a geometric mean collapses toward zero whenever any single desirability \(d_i\) drops near zero, QED naturally mirrors the multi-objective bottleneck of real drug development.
-
Moving beyond coarse rules to predict exact biological numbers brings us to QSAR (Quantitative Structure-Activity Relationships). Ever since Corwin Hansch correlated herbicide potency with \(\log P\) and electronic constants in the 1960s, QSAR has sought a predictive function \(\hat{y} = f_\theta(\mathbf{x})\) mapping molecular structure to binding affinity (\(p\text{IC}_{50}\) or \(pK_i\)), solubility (\(\log S\)), or toxicity probability. Today's QSAR pipeline spans Morgan fingerprints fed into gradient boosted trees all the way to end-to-end 2D and 3D graph neural networks.
The Evaluation Trap of Random Splits and Activity Cliffs¶
-
Suppose you prepare for a difficult physics exam using a practice sheet, and on exam day the professor hands out the exact same questions with only a couple of numbers nudged by two percent. You walk out with a gleaming 95%, convinced you have mastered physics, until you face a genuinely new problem in the real world and fall flat.
-
That exact illusion is the single biggest evaluation trap in machine learning for chemistry. Pharmaceutical datasets are never uniform random samples of chemical space. They are built by medicinal chemistry teams synthesising tight families of structural analogues, often thirty or fifty molecules sharing the exact same core ring system with tiny substitutions (swapping a chlorine for a fluorine or moving a methyl group one carbon over).
-
If you partition such a dataset with a naive random train/test split, cousins from every analogue series end up on both sides of the divide. A model can score an impressive AUROC of \(0.94\) simply by recognising the familiar core scaffold from the training set without learning generalisable chemistry.
-
To measure genuine out-of-distribution generalisation, cheminformatics benchmarks rely on two much tougher splits.
- Bemis-Murcko scaffold splits strip away peripheral side chains to extract each molecule's core ring-and-linker skeleton (its Bemis-Murcko scaffold), then assign every molecule sharing a scaffold strictly to either train or test. The model is forced to predict properties for chemical cores it has never seen before.
- Temporal (time) splits train strictly on assays recorded before a chosen date and evaluate on compounds synthesised afterwards, mirroring how a pharmaceutical model actually operates when a project evolves into new chemical space.
-
Even on a familiar scaffold, chemistry hides a second surprise that punishes smooth machine learning models, known as activity cliffs. Picture strolling across a gently rolling meadow and suddenly stepping off a vertical canyon wall. In medicinal chemistry, two molecules can look almost identical on paper (sharing a Tanimoto similarity above \(0.90\)) yet differ in biological potency by 100-fold or even 1,000-fold.
-
A classic instance is the magic methyl effect, where adding a single \(-\text{CH}_3\) group twists a flexible bond into the exact bioactive shape or fills a tiny hydrophobic cavity inside the protein, slashing the required dose by two orders of magnitude. Formally, a matched pair \((A, B)\) forms an activity cliff when structural similarity is high yet potency jumps sharply.
- Because standard neural networks and kernel methods carry a strong smoothness bias (mapping nearby inputs to nearby outputs), they routinely blur right across activity cliffs, averaging a potent gem with its inactive neighbour. Dedicated benchmarks like MoleculeACE now track error specifically on cliff molecules alongside global accuracy.
Uncertainty Quantification and Active Learning¶
-
Imagine prospecting for gold across a vast mountain range when drilling every single borehole costs thousands of pounds and takes two weeks. You would never pick spots at random, nor would you keep drilling ten centimetres from your first small nugget forever. You want a probabilistic map showing both your best guess of where rich ore lies and exactly where your ignorance is widest.
-
In real drug discovery, synthesising a single novel compound and running a panel of ADMET assays can cost several thousand dollars and weeks of chemist labour, whereas scoring a virtual library of ten million molecules in silico takes minutes. This extreme cost asymmetry makes uncertainty quantification just as valuable as raw accuracy.
-
Predictive uncertainty splits into two distinct flavours (connecting to probability in chapter 05).
- Aleatoric uncertainty reflects irreducible noise inside the wet-lab measurement itself (for instance, assay replicates routinely vary by \(0.3\) to \(0.5\) log units). Collecting more molecules elsewhere cannot erase it.
- Epistemic uncertainty reflects the model's lack of knowledge in unfamiliar regions of chemical space. As you synthesise and measure molecules inside a new scaffold, epistemic uncertainty shrinks.
-
Cheminformatics teams estimate epistemic uncertainty primarily through deep ensembles (training \(M\) independently initialised GNNs or MLPs and reading their prediction variance \(\sigma^2(\mathbf{x})\) as disagreement) or Gaussian Processes (GPs) equipped with molecular kernels such as the Tanimoto or RBF kernel, which return an exact analytical posterior mean \(\mu(\mathbf{x})\) and standard deviation \(\sigma(\mathbf{x})\) for every unlabelled candidate.
- Pairing a probabilistic surrogate with an acquisition function powers active learning and Bayesian optimisation across the laboratory's Design-Make-Test-Analyse (DMTA) loop. A popular and transparent choice is the Upper Confidence Bound (UCB).
- Here \(\mu(\mathbf{x})\) rewards exploitation (choosing molecules already predicted to be highly active), while \(\beta\,\sigma(\mathbf{x})\) rewards exploration (probing uncertain scaffolds where a hidden breakthrough might sit). Setting \(\beta\) larger early in a campaign maps out unknown chemical space quickly, while shrinking \(\beta\) later focuses synthesis budgets on squeezing out the very best lead candidates. In large virtual screens, active learning routinely discovers the majority of top binders while running fewer than 2% to 5% of the expensive assays or docking calculations.
Molecular Foundation Models¶
-
One stubborn bottleneck haunts ADMET prediction. Unlike web text or internet images, clean wet-lab experimental datasets are tiny, often containing only a few hundred to a few thousand measured compounds per assay. Training a deep neural network from scratch on 400 toxicity measurements invites severe overfitting.
-
Molecular foundation models overcome data scarcity by borrowing the pretrain-then-fine-tune paradigm from natural language processing (chapter 07). Although labelled assay data is scarce, databases like PubChem, ZINC, and Enamine contain hundreds of millions of unlabelled chemical structures. By pretraining on vast unlabelled chemistry first, a model absorbs valences, functional groups, ring strain, and 3D packing geometry before ever seeing a single biological label.
-
Two landmark families illustrate how pretraining adapts to different representations.
- ChemBERTa applies RoBERTa-style masked language modelling to tens of millions of SMILES strings (and later multi-task physicochemical property pretraining). Masking out random atoms or ring tokens forces the transformer to infer chemical context from surrounding functional groups, yielding rich embeddings that fine-tune smoothly on low-data ADMET tasks.
- Uni-Mol pushes self-supervised pretraining directly into 3D geometry. Pretrained on roughly 209 million 3D molecular conformations alongside protein binding pockets, Uni-Mol uses a pair-biased \(SE(3)\)-invariant transformer trained to predict masked atom types and denoise randomly perturbed 3D atomic coordinates back to their equilibrium shape. Because its pretrained representations already understand 3D steric bulk and spatial interactions, Uni-Mol transfers cleanly not only to ADMET and quantum properties, but also to 3D protein-ligand docking.
Take-Home¶
- Potency alone never delivers a safe medicine because every candidate must survive the multi-objective ADMET gauntlet of absorption, distribution, metabolism, excretion, and toxicity.
- Lipinski's Rule of Five gives a quick sanity check for oral drugs, while QED replaces rigid thresholds with a smooth geometric mean of physicochemical desirabilities.
- Random train/test splits leak closely related analogues across sets and artificially inflate accuracy, whereas Bemis-Murcko scaffold splits and temporal splits measure real-world generalisation.
- Activity cliffs occur when tiny single-atom edits swing potency by 100-fold or more, exposing the oversmoothing weakness of standard QSAR models.
- Pairing calibrated uncertainty (Gaussian processes or ensembles) with UCB active learning focuses expensive wet-lab synthesis on high-value compounds, while foundation models like ChemBERTa and Uni-Mol unlock strong transfer learning on small assay datasets.
Coding Tasks (use CoLab or notebook)¶
-
Implement Lipinski's Rule of Five alongside a smooth QED-inspired geometric desirability scorer in JAX over 200 synthetic drug candidates, and plot the multi-objective Pareto trade-off between predicted potency and drug-likeness.
import jax import jax.numpy as jnp import matplotlib.pyplot as plt key = jax.random.PRNGKey(22) k1, k2, k3, k4, k5 = jax.random.split(key, 5) N = 200 # Synthetic library descriptors mw = jax.random.uniform(k1, (N,), minval=220.0, maxval=680.0) logp = jax.random.uniform(k2, (N,), minval=-0.5, maxval=7.0) hbd = jnp.floor(jax.random.uniform(k3, (N,), minval=0.0, maxval=8.0)) hba = jnp.floor(jax.random.uniform(k4, (N,), minval=1.0, maxval=13.0)) # Realistic tension: larger, greasier molecules tend to look more potent in vitro potency_pIC50 = (5.2 + 0.0045 * (mw - 250.0) + 0.32 * logp - 0.12 * hbd + 0.45 * jax.random.normal(k5, (N,))) # Lipinski Rule of Five violations violations = ((mw > 500.0).astype(jnp.int32) + (logp > 5.0).astype(jnp.int32) + (hbd > 5.0).astype(jnp.int32) + (hba > 10.0).astype(jnp.int32)) passes_lipinski = violations <= 1 # Smooth QED-style geometric desirability score in (0, 1] def gauss_desire(x, center, width): return jnp.clip(jnp.exp(-0.5 * ((x - center) / width) ** 2), 1e-4, 1.0) d_mw = gauss_desire(mw, 360.0, 120.0) d_logp = gauss_desire(logp, 2.6, 1.8) d_hbd = gauss_desire(hbd, 1.5, 2.2) d_hba = gauss_desire(hba, 4.5, 3.2) qed_like = jnp.exp(0.25 * (jnp.log(d_mw) + jnp.log(d_logp) + jnp.log(d_hbd) + jnp.log(d_hba))) # Identify Pareto-optimal candidates (maximising both potency and QED-like score) is_pareto = [] for i in range(N): dominated = jnp.any((potency_pIC50 > potency_pIC50[i]) & (qed_like > qed_like[i])) is_pareto.append(not bool(dominated)) is_pareto = jnp.array(is_pareto) print(f"Candidates passing Lipinski (<=1 violation): {int(jnp.sum(passes_lipinski))} / {N}") print(f"Pareto-optimal multi-objective candidates: {int(jnp.sum(is_pareto))}") fig, ax = plt.subplots(figsize=(7.2, 4.5)) ax.scatter(qed_like[~passes_lipinski], potency_pIC50[~passes_lipinski], color="#e74c3c", alpha=0.55, s=28, label="Fails Lipinski (>1 violation)") ax.scatter(qed_like[passes_lipinski], potency_pIC50[passes_lipinski], color="#3498db", alpha=0.65, s=30, label="Passes Lipinski") ax.scatter(qed_like[is_pareto], potency_pIC50[is_pareto], color="#27ae60", edgecolor="#333", s=85, zorder=5, label="Pareto Frontier") ax.set_xlabel("Smooth QED-Like Drug-Likeness Score") ax.set_ylabel("Predicted Binding Potency (pIC50)") ax.set_title("Potency vs Drug-Likeness Multi-Objective Trade-off") ax.legend(loc="lower left") plt.tight_layout() plt.show() -
Reproduce the random-split versus scaffold-split trap (plus an embedded activity cliff) in JAX by generating six distinct chemical scaffolds, fitting a nonlinear ridge surrogate, and measuring how sharply test RMSE jumps when evaluating on genuinely unseen scaffolds.
import jax import jax.numpy as jnp import matplotlib.pyplot as plt key = jax.random.PRNGKey(7) n_scaffolds = 6 per_scaffold = 30 dim = 12 # Create 6 well-separated core scaffold prototypes in descriptor space k_scaf, k_sub, k_noise, k_w, k_perm = jax.random.split(key, 5) scaffold_centers = jax.random.normal(k_scaf, (n_scaffolds, dim)) * 2.4 scaffold_offsets = jnp.array([5.5, 6.2, 7.8, 5.1, 8.4, 6.9]) w_local = jax.random.normal(k_w, (dim,)) * 0.45 X_list, y_list, scaf_ids = [], [], [] sub_keys = jax.random.split(k_sub, n_scaffolds) noise_keys = jax.random.split(k_noise, n_scaffolds) for s in range(n_scaffolds): ks = sub_keys[s] kn = noise_keys[s] subs = jax.random.normal(ks, (per_scaffold, dim)) * 0.35 Xs = scaffold_centers[s][None, :] + subs ys = scaffold_offsets[s] + jnp.dot(subs, w_local) + 0.15 * jax.random.normal(kn, (per_scaffold,)) # Inject a sharp activity cliff (+2.5 log units) on molecule 0 of scaffold 0 if s == 0: ys = jnp.where(jnp.arange(per_scaffold) == 0, ys + 2.5, ys) X_list.append(Xs) y_list.append(ys) scaf_ids.append(jnp.full((per_scaffold,), s)) X = jnp.concatenate(X_list, axis=0) y = jnp.concatenate(y_list, axis=0) scaf_ids = jnp.concatenate(scaf_ids, axis=0) def rbf_kernel(A, B, gamma=0.12): dist_sq = jnp.sum((A[:, None, :] - B[None, :, :]) ** 2, axis=-1) return jnp.exp(-gamma * dist_sq) def eval_krr(X_tr, y_tr, X_te, y_te, reg=0.05): K = rbf_kernel(X_tr, X_tr) + reg * jnp.eye(len(X_tr)) alpha = jnp.linalg.solve(K, y_tr) preds = jnp.dot(rbf_kernel(X_te, X_tr), alpha) rmse = float(jnp.sqrt(jnp.mean((preds - y_te) ** 2))) return preds, rmse # Split A: Random 2/3 train, 1/3 test (leaks analogues across every scaffold) perm = jnp.argsort(jax.random.uniform(k_perm, (len(X),))) split = (2 * len(X)) // 3 tr_r, te_r = perm[:split], perm[split:] preds_rand, rmse_rand = eval_krr(X[tr_r], y[tr_r], X[te_r], y[te_r]) # Split B: Strict scaffold split (train on scaffolds 0..3, test on unseen 4..5) tr_s = scaf_ids < 4 te_s = scaf_ids >= 4 preds_scaf, rmse_scaf = eval_krr(X[tr_s], y[tr_s], X[te_s], y[te_s]) print(f"Random Split RMSE (analogue leakage): {rmse_rand:.3f}") print(f"Scaffold Split RMSE (unseen scaffolds): {rmse_scaf:.3f}") fig, axes = plt.subplots(1, 2, figsize=(11.0, 4.2)) axes[0].scatter(y[te_r], preds_rand, color="#e74c3c", alpha=0.75) axes[0].plot([4.5, 10.0], [4.5, 10.0], "--", color="#333") axes[0].set_title(f"Random Split (RMSE = {rmse_rand:.2f}, Inflated)") axes[0].set_xlabel("True Potency (pIC50)") axes[0].set_ylabel("Predicted Potency") axes[1].scatter(y[te_s], preds_scaf, color="#27ae60", alpha=0.75) axes[1].plot([4.5, 10.0], [4.5, 10.0], "--", color="#333") axes[1].set_title(f"Scaffold Split (RMSE = {rmse_scaf:.2f}, Honest)") axes[1].set_xlabel("True Potency (pIC50)") axes[1].set_ylabel("Predicted Potency") plt.tight_layout() plt.show() -
Build an analytical Gaussian Process active learning loop in JAX over a synthetic 1D chemical space containing a narrow high-potency peak, and compare how quickly UCB acquisition discovers the top compound compared with random wet-lab screening.
import jax import jax.numpy as jnp import matplotlib.pyplot as plt # 1D virtual chemical library of 120 candidate molecules grid_x = jnp.linspace(0.0, 10.0, 120) # True unknown assay landscape with a broad mediocre plateau and a sharp hidden peak true_y = ( 5.0 + 1.1 * jnp.sin(0.9 * grid_x) + 2.8 * jnp.exp(-0.5 * ((grid_x - 7.35) / 0.45) ** 2) + 0.7 * jnp.exp(-0.5 * ((grid_x - 2.2) / 0.7) ** 2) ) global_best = float(jnp.max(true_y)) def gp_predict(x_obs, y_obs, x_cand, lengthscale=0.65, noise_var=0.02): K = jnp.exp(-0.5 * ((x_obs[:, None] - x_obs[None, :]) / lengthscale) ** 2) K = K + noise_var * jnp.eye(len(x_obs)) K_s = jnp.exp(-0.5 * ((x_cand[:, None] - x_obs[None, :]) / lengthscale) ** 2) alpha = jnp.linalg.solve(K, y_obs) mu = jnp.dot(K_s, alpha) v = jnp.linalg.solve(K, K_s.T) var = jnp.maximum(1.0 - jnp.sum(K_s.T * v, axis=0), 1e-6) return mu, jnp.sqrt(var) # Start both strategies from the exact same 3 initial lab assays init_idx = [10, 42, 108] ucb_idx = list(init_idx) ucb_best = [float(jnp.max(true_y[jnp.array(ucb_idx)]))] n_rounds = 12 for _ in range(n_rounds): x_obs = grid_x[jnp.array(ucb_idx)] y_obs = true_y[jnp.array(ucb_idx)] mu, sigma = gp_predict(x_obs, y_obs, grid_x) scores = mu + 2.2 * sigma # Exclude already-tested molecules mask = jnp.array([i in ucb_idx for i in range(len(grid_x))]) scores = jnp.where(mask, -1e9, scores) next_pick = int(jnp.argmax(scores)) ucb_idx.append(next_pick) ucb_best.append(float(jnp.max(true_y[jnp.array(ucb_idx)]))) # Average random screening baseline across 25 seeds rand_curves = [] key = jax.random.PRNGKey(99) for r in range(25): key, subk = jax.random.split(key) pool = [i for i in range(len(grid_x)) if i not in init_idx] perm = jnp.argsort(jax.random.uniform(subk, (len(pool),))) chosen = list(init_idx) curve = [float(jnp.max(true_y[jnp.array(chosen)]))] for step in range(n_rounds): chosen.append(pool[int(perm[step])]) curve.append(float(jnp.max(true_y[jnp.array(chosen)]))) rand_curves.append(curve) rand_mean = jnp.mean(jnp.array(rand_curves), axis=0) print(f"True best molecule potency: {global_best:.2f}") print(f"UCB active learning after 12 picks: {ucb_best[-1]:.2f}") print(f"Random screening mean after 12: {float(rand_mean[-1]):.2f}") # Final GP posterior for plotting mu_f, sig_f = gp_predict(grid_x[jnp.array(ucb_idx)], true_y[jnp.array(ucb_idx)], grid_x) fig, axes = plt.subplots(1, 2, figsize=(11.5, 4.2)) axes[0].plot(grid_x, true_y, "--", color="#333", lw=1.4, label="True Assay Landscape") axes[0].plot(grid_x, mu_f, color="#9b59b6", lw=2, label="GP Mean") axes[0].fill_between(grid_x, mu_f - 2 * sig_f, mu_f + 2 * sig_f, color="#9b59b6", alpha=0.18, label="95% Confidence") axes[0].scatter(grid_x[jnp.array(ucb_idx)], true_y[jnp.array(ucb_idx)], color="#f39c12", edgecolor="#333", s=48, zorder=5, label="Assayed Picks") axes[0].set_xlabel("Chemical Space Coordinate") axes[0].set_ylabel("Potency (pIC50)") axes[0].set_title("GP Surrogate After 12 UCB Active Learning Rounds") axes[0].legend(fontsize=8) rounds = jnp.arange(n_rounds + 1) axes[1].plot(rounds, ucb_best, "o-", color="#27ae60", lw=2.2, label="UCB Active Learning") axes[1].plot(rounds, rand_mean, "s--", color="#e74c3c", lw=2.0, label="Random Screening (25-run mean)") axes[1].axhline(global_best, color="#3498db", ls=":", lw=1.5, label="Global Optimum") axes[1].set_xlabel("Wet-Lab Synthesis Round") axes[1].set_ylabel("Best Discovered Potency") axes[1].set_title("Discovery Speed per Wet-Lab Experiment") axes[1].legend(fontsize=8) plt.tight_layout() plt.show()