MolBasis
scaffold-splitbemis-murckordkitheld-out5 min read

The scaffold split with Bemis-Murcko scaffolds, step by step

A scaffold split groups molecules by Bemis-Murcko core and holds out whole groups. How to compute the scaffolds, draw the split and read its molecule count.

Updated November 28, 2026

A scaffold split computes the Bemis-Murcko scaffold of every molecule, groups molecules that share a scaffold, and holds out whole groups. No analogue of a test molecule can then sit in the training set. The MolBasis protocol holds out 25 percent of unique scaffolds with one seed before any fitting. The steps below show how to reproduce such a split in RDKit, why the molecule count of the held-out set is not 25 percent, and what to record so that someone else can draw the same split.

Step one, compute the scaffold of each molecule

Bemis and Murcko defined the scaffold in 1996 as the ring systems plus the linker atoms joining them, with every side chain removed. RDKit implements it directly. Two variants exist. The plain scaffold keeps atom types and bond orders. The generic scaffold replaces every atom with carbon and every bond with a single bond, so that a pyridine core and a benzene core become one group. Pick one and write it down. The plain scaffold is the usual default.

from rdkit import Chem
from rdkit.Chem.Scaffolds import MurckoScaffold

def scaffold_smiles(smiles, generic=False):
    mol = Chem.MolFromSmiles(smiles)
    core = MurckoScaffold.GetScaffoldForMol(mol)
    if generic:
        core = MurckoScaffold.MakeScaffoldGeneric(core)
    return Chem.MolToSmiles(core)

print(scaffold_smiles("CC(=O)Oc1ccccc1C(=O)O"))   # aspirin -> c1ccccc1
print(scaffold_smiles("CCO"))                     # ethanol -> empty string

Aspirin reduces to benzene. Ethanol has no ring and returns an empty scaffold. Every acyclic molecule returns that same empty string, which is the first decision point.

Step two, decide what to do with acyclic molecules

In a drug-like dataset the empty scaffold is a small group. In a solvation or melting-point dataset it can be the largest group by far, holding alkanes, alcohols, ethers, amines and acids that have nothing in common but the absence of a ring. Treating them as one scaffold means that one draw either holds out every acyclic molecule or none of them. Treating each as its own scaffold means the held-out set is dominated by small acyclic molecules whenever the draw favours singletons.

Neither choice is wrong. Both must be stated. A split script that does not say what it did with the empty scaffold cannot be reproduced, which matters for the reasons the guide on reproducing a fit from a record explains.

Step three, draw the held-out scaffolds with a seed

Group the molecules by scaffold string, list the unique scaffolds, and draw 25 percent of them at random with a fixed seed. Every molecule whose scaffold was drawn goes to the held-out set.

import numpy as np
from collections import defaultdict

groups = defaultdict(list)
for i, smi in enumerate(smiles_list):
    groups[scaffold_smiles(smi)].append(i)
scaffolds = sorted(groups)                        # sort first, so the draw is reproducible
rng = np.random.default_rng(2026)
n_held = int(round(0.25 * len(scaffolds)))
held_scaffolds = rng.choice(scaffolds, size=n_held, replace=False)
test_idx = [i for s in held_scaffolds for i in groups[s]]
train_idx = [i for s in scaffolds if s not in set(held_scaffolds) for i in groups[s]]

Sorting the scaffold list before drawing matters. Dictionary order depends on insertion order, and insertion order depends on the order of the input file. The seed alone does not fix the split. The seed, the sort, the random generator and its version, and the rounding rule for 25 percent of an odd count all do. The MolBasis methodology states seed 2026 and one split. The exact code that drew it is not in a repository available for review, so the split itself is reported, not reproduced here.

Why 25 percent of scaffolds is not 25 percent of molecules

Take 20 molecules on 8 scaffolds with group sizes 6, 4, 3, 2, 2, 1, 1 and 1. A quarter of 8 scaffolds is 2 scaffolds. If the draw picks two singletons, the held-out set holds 2 molecules, 10 percent of the data. If it picks the groups of 6 and 4, the held-out set holds 10 molecules, half the data. Both are valid 25 percent scaffold splits.

The molecule count therefore has to be stated next to every held-out figure, which is why each kernel page gives the number of molecules its result rests on. A held-out r on a handful of molecules is an unstable figure, as the guide on small test sets shows, and a reader cannot judge it without the count. The arithmetic also explains why the same protocol gives held-out sets of very different sizes for different kernels. The datasets differ in how their molecules distribute over scaffolds.

What a scaffold split does and does not protect against

It protects against the analogue leak described in the guide on random splits and leakage. A methyl scan around one core cannot straddle the split. It does not protect against two different scaffolds that happen to be close in descriptor space, which for descriptors computed from one DFT calculation per molecule, such as the mfsig descriptors, is common for small polar molecules. It does not protect against duplicates of one molecule drawn with different scaffolds, which can happen when a salt is drawn with its counter-ion ring. And it does not reproduce how a model is used in practice, where new molecules arrive later in time rather than on new scaffolds. The guide on scaffold-blind versus time split weighs that difference.

The split also says nothing about how far a new molecule may sit from the training data before the equation stops applying. That is the job of an applicability domain, covered in the guide on applicability domain for short equations.

What to record with the split

Record the scaffold variant, the treatment of the empty scaffold, the sort order, the seed, the random generator and library version, the rounding rule, the list of held-out scaffold strings and the resulting molecule counts on both sides. With those, anyone can rebuild the split from the same input file. Without them, the words "scaffold split, seed 2026" describe a family of splits rather than one.

Key points

  • Compute Bemis-Murcko scaffolds with RDKit, choose plain or generic, and state the choice.
  • Decide what the empty scaffold means for acyclic molecules before drawing. Solvation datasets have many.
  • Sort the scaffold list, then draw 25 percent with a seed. The seed alone does not define the split.
  • 25 percent of scaffolds can be 10 percent or 50 percent of molecules. Report the held-out molecule count every time.
  • A scaffold split stops analogue leakage. It does not define an applicability domain or mimic a time split.

Questions people ask

What is a Bemis-Murcko scaffold?
It is the part of a molecule that remains when every side chain is removed, leaving the ring systems and the linkers that join them. Bemis and Murcko defined it in 1996 to count the frameworks in known drugs. RDKit computes it with MurckoScaffold.GetScaffoldForMol.
Why hold out 25 percent of scaffolds rather than 25 percent of molecules?
Holding out scaffolds guarantees that no analogue of a test molecule sits in the training set, which a molecule-level split cannot promise. The price is that the molecule share varies with the draw. Two large scaffolds can be half the dataset and three singletons can be almost nothing.
What happens to molecules without a ring?
Their Bemis-Murcko scaffold is empty, so a naive grouping puts every acyclic molecule in one group. Decide in advance whether that group is one scaffold, or whether each acyclic molecule is its own group, and write the choice into the split script. Solvation datasets contain many acyclic molecules, so the choice matters.

Further reading

In practice: The methodology page describes the checks applied to every kernel, scaffold-blind split included, and the limits of those checks. Every kernel page quotes the held-out figure first and the in-sample figure second.

See the kernels themselves

Every kernel is shown with its held-out result, the number of molecules it rests on and what it cannot be trusted for.