SKILL.md
Version Compatibility
Reference examples tested with: RDKit 2024.03+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Reaction Enumeration
"Generate a combinatorial library from my building blocks" → Enumerate virtual compound libraries by applying reaction SMARTS transformations to sets of building-block molecules, producing and validating all product combinations for a defined synthetic route.
- Python:
AllChem.ReactionFromSmarts(),rxn.RunReactants()(RDKit)
Generate virtual compound libraries using reaction SMARTS.
Reaction SMARTS Basics
from rdkit import Chem
from rdkit.Chem import AllChem
# Define reaction (reactants >> products with atom mapping)
# Amide coupling: carboxylic acid + amine -> amide
amide_rxn = AllChem.ReactionFromSmarts(
'[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]'
)
# Validate reaction definition
n_errors = amide_rxn.Validate()
if n_errors[0] == 0:
print('Reaction is valid')
# Run reaction
acid = Chem.MolFromSmiles('CC(=O)O')
amine = Chem.MolFromSmiles('CCN')
products = amide_rxn.RunReactants((acid, amine))
# products is a tuple of tuples: ((product1,), (product2,), ...)
for prod_set in products:
for prod in prod_set:
Chem.SanitizeMol(prod)
print(Chem.MolToSmiles(prod))
Common Reaction SMARTS
REACTIONS = {
'amide_coupling': '[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]',
'reductive_amination': '[C:1]=O.[N:2]>>[C:1][N:2]',
'suzuki': '[c:1][Br].[c:2][B](O)O>>[c:1][c:2]',
'buchwald': '[c:1][Br].[N:2]>>[c:1][N:2]',
'ester_formation': '[C:1](=[O:2])O.[O:3]>>[C:1](=[O:2])[O:3]',
'michael_addition': '[C:1]=[C:2]C(=O).[C:3]>>[C:1][C:2]([C:3])C(=O)',
}
