liveBook · Manning

Combinatorial enumeration

As explained in Build AI Drug Discovery Pipelines

Combinatorial enumeration is the generation of all permitted combinations of molecular fragments subject to chemical and structural constraints.

Combinatorial enumeration generates permitted molecular-fragment combinations while respecting attachment sites, reaction types, and chemical rules. It supports combinatorial library design when exploring new scaffolds or varying R-groups. section 7.2.2

A practical enumeration workflow is:

  • Define fragments spanning chemical functionalities and structural motifs. section 7.2.2
  • Specify attachment sites and reactions, then generate combinations under those constraints. section 7.2.2
  • Filter and prioritize candidates for drug-likeness, synthetic feasibility, or diversity. section 7.2.2
Listing 7.5 Combinatorial Library Construction
from rdkit.Chem.Scaffolds import MurckoScaffold
from rdkit.Chem import AllChem
import random
 
cores, frags = [], []
data['mols'] = data['SMILES'].apply(Chem.MolFromSmiles)
for mol in data['mols']:
    if mol is None:
        continue
 
    bms = MurckoScaffold.GetScaffoldForMol(mol)    #A
    core = Chem.ReplaceSidechains(mol, bms)
    rgroups = Chem.ReplaceCore(mol, bms)    #A
    if core is None:
        continue
    cores.append(Chem.MolToSmiles(core))
    if rgroups:
        frags.extend(Chem.MolToSmiles(rgroups).split('.'))
 
reaction_smarts = "[*:1][#0].[#0][*:2]>>[*:1][*:2]"
rxn = AllChem.ReactionFromSmarts(reaction_smarts)
 
new_mols = []
EXPANSION_FACTOR = 5
MAX_STEPS = 20
for core_smi in cores:    #B
    for _ in range(EXPANSION_FACTOR):
        current_smi = core_smi
        steps = 0
        while "[*]" in current_smi and steps < MAX_STEPS:
            steps += 1
            random_index = random.randint(0, len(frags) - 1)
            products = rxn.RunReactants((
                Chem.MolFromSmiles(current_smi),
                Chem.MolFromSmiles(frags[random_index]),
            ))
            if len(products) == 0:    #C
                break    #C
            product_index = random.randint(0, len(products) - 1)
            current_smi = Chem.MolToSmiles(products[product_index][0])
        mol = Chem.MolFromSmiles(current_smi)
        if mol:
            AllChem.Compute2DCoords(mol)
            new_mols.append(mol)

An RDKit workflow extracts Bemis–Murcko cores and R-groups, then applies reaction SMARTS to expand candidate molecules. section 7.2.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Explains fragment selection, reaction constraints, enumeration, filtering, and an RDKit implementation, while stopping short of full library evaluation.
Examples
Uses Bemis–Murcko core extraction, reaction-based recombination, and RDKit-generated molecular libraries as concrete examples.
What you can do after
Builds enumerated molecular libraries with RDKit while applying reaction constraints and basic chemical validation.
How it connects
Links scaffold hopping, R-groups, Bemis–Murcko scaffolds, reaction SMARTS, and drug-likeness filtering.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.