Guides / QSAR and machine learning

scaffold-splitbemis-murckovalidation

The scaffold split explained, with Bemis-Murcko scaffolds

A scaffold split keeps all molecules that share a Bemis-Murcko core on one side of the split, giving a harder and more honest test. Code included.

Updated 4 min read

A scaffold split assigns every molecule to a group by its Bemis-Murcko scaffold, the ring systems and linkers left when side chains are removed, and then puts whole groups into training, validation or test. No scaffold appears on both sides. The score therefore measures how the model does on core structures it has never seen, which is harder and more realistic than a random split.

What a Bemis-Murcko scaffold is

Bemis and Murcko analysed the frameworks of known drugs in 1996. Their definition keeps every ring and every atom on the shortest path between rings, and removes everything else, including side chains and substituents. Atoms attached to a ring by a double bond, such as a carbonyl oxygen, are kept.

Ibuprofen has one benzene ring with an isobutyl group and a propionic acid group on it. Remove the side chains and the scaffold is benzene, c1ccccc1. Paracetamol, a benzene ring with a hydroxyl and an acetamido group, has the same scaffold. In a scaffold split they would always travel together. Imatinib has several linked rings and so a much larger scaffold, which is more specific and groups with fewer compounds.

A generic scaffold goes one step further. It turns every atom into carbon and every bond into a single bond, so a pyridine and a benzene ring collapse to the same generic framework. Generic scaffolds make larger groups and a stricter split.

Computing scaffolds with RDKit

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

smiles = {
    "ibuprofen": "CC(C)Cc1ccc(cc1)C(C)C(=O)O",
    "paracetamol": "CC(=O)Nc1ccc(O)cc1",
    "cyclohexane": "C1CCCCC1",
    "ethanol": "CCO",
}

for name, smi in smiles.items():
    mol = Chem.MolFromSmiles(smi)
    scaffold = MurckoScaffold.MurckoScaffoldSmiles(mol=mol)
    generic = MurckoScaffold.MakeScaffoldGeneric(MurckoScaffold.GetScaffoldForMol(mol))
    print(name, repr(scaffold), Chem.MolToSmiles(generic))

Ethanol has no ring and returns an empty string. All acyclic molecules share that empty scaffold, so they fall into one large group. Decide beforehand where they go, because that group can be a sizeable share of a data set.

The splitting procedure

The widely used implementation, popularised by MoleculeNet and DeepChem, is deterministic.

  1. Compute the scaffold of every molecule and group molecule indices by scaffold.
  2. Sort the groups from largest to smallest.
  3. Fill training with the biggest groups until it holds the requested fraction, usually 80 percent.
  4. Put the next groups into validation and the remaining small ones into test.
from collections import defaultdict

groups = defaultdict(list)
for i, smi in enumerate(smiles_list):
    mol = Chem.MolFromSmiles(smi)
    groups[MurckoScaffold.MurckoScaffoldSmiles(mol=mol)].append(i)

ordered = sorted(groups.values(), key=len, reverse=True)
n = len(smiles_list)
train, valid, test = [], [], []
for g in ordered:
    if len(train) + len(g) <= 0.8 * n:
        train += g
    elif len(valid) + len(g) <= 0.1 * n:
        valid += g
    else:
        test += g

Because the biggest groups go to training, the test set is filled with rare, singleton scaffolds. That is deliberate. It makes the test the most unusual part of the data. A randomised variant shuffles groups before assigning them and lets you repeat the split with different seeds, which gives an error bar instead of one number.

Strengths and limits

A scaffold split tests generalisation to new cores. That matches the situation of scaffold hopping and of screening an unfamiliar library. It is cheap, has no similarity threshold to defend and can be reproduced from the data alone.

Its limits matter too.

Report which variant you used: plain or generic scaffold, deterministic or randomised, and how acyclic compounds were handled. These choices change the number you quote.

If you are tuning a model or comparing representations, such as descriptors and fingerprints, use the same scaffold split for every candidate so the comparison is fair. Standardise structures first, since a charged form and a neutral form of one compound can have different scaffolds only because of how they were drawn. The guide on tautomers and protonation states shows how that happens.

Reporting a scaffold split

Because the result depends on details, a reader needs enough to reproduce it. State the scaffold definition, the fractions, the handling of acyclic molecules and the library version, since RDKit's behaviour can change between releases. Share the index lists or the three files. If you compare your numbers with a published benchmark, use the identical split, otherwise the comparison says little. Where the data set is small, repeat with a randomised scaffold split over several seeds and report the mean and the spread.

Key points

Questions people ask

What is a Bemis-Murcko scaffold?
It is the core of a molecule made of all its ring systems and the linker atoms that connect them, with every side chain removed. Bemis and Murcko proposed it in 1996 as a way to describe the frameworks found in drugs.
What is a scaffold split?
A scaffold split groups molecules by their scaffold and assigns whole groups to training, validation or test. No scaffold appears on both sides, so the test measures performance on core structures the model has not seen.
Is a scaffold split always better than a random split?
It is harder and usually more realistic for new chemotypes, but it is not always the right match. It can be too pessimistic when two scaffolds differ by one atom, and it cannot split molecules without rings, which all share an empty scaffold.
What is a generic scaffold?
A generic scaffold takes the Bemis-Murcko scaffold and replaces every atom by carbon and every bond by a single bond. It groups molecules whose cores have the same shape but different heteroatoms or bond orders.

Further reading

In practice: Advanced Modeling trains and applies QSAR models; the AI Foundry runs or fine-tunes ChemBERTa, MoLFormer-XL and Chemprop on a CSV, as a preview. Validation is the user's responsibility, and these guides show how.

← All guides