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
