Inspired by this blog post by the lovely Kate, I’ve been doing some BRICS decomposing of molecules myself. Like the structure-based goblin that I am, though, I’ve been applying it to 3D structures of molecules, rather than using the smiles approach she detailed. I thought it may be helpful to share the code snippets I’ve been using for this: unsurprisingly, it can also be done with RDKit!
I’ll use the same example as in the original blog post, propranolol.

First, I import RDKit and load the ligand in question:
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import BRICS
ligand = Chem.MolFromMolFile('propranolol.sdf')
Then I use BRICS.BreakBRICSBonds to generate an RDKit molecule with the BRICS bonds removed, and then Chem.GetMolFrags to separate the substructures into individual RDKit molecules:
ligand_broken = BRICS.BreakBRICSBonds(ligand) brics_bits = Chem.GetMolFrags(ligand_broken, asMols=True)
You can either write these directly to SDF files using Chem.SDWriter, or remove the dummy atoms first. I followed this post to do this as follows:
w = Chem.SDWriter('propranolol_brics.sdf')
dummy = Chem.MolFromSmiles('*')
hydrogen = Chem.MolFromSmiles('[H]')
for mol in brics_bits:
for atom in mol.GetAtoms():
atom.SetIsotope(0)
rmv_dummy = AllChem.ReplaceSubstructs(mol,dummy,hydrogen,True)[0]
final_mol = Chem.RemoveHs(rmv_dummy)
w.write(final_mol)
The final molecules loaded into PyMOL look like this:
Happy decomposing!

