I am not a chemist, I come from a computer science background. Bung et al. [1] say in the Data preprocessing part that they used Python RDKit to remove stereochemistry, salts, and molecules with undesirable atoms or groups.

I was looking for a way to do so in the RDKit documentation but couldn't find any. Can anyone give a code example to achieve this?


  1. Bung, N.; Krishnan, S. R.; Bulusu, G.; Roy, A. De Novo design of new chemical entities for SARS-CoV-2 using artificial intelligence. Future Med. Chem. 2021, 13 (6), 575–585. DOI: 10.4155/fmc-2020-0262. (Free Access)

1 Answer 1


Here's the code in Python

from rdkit import Chem
from rdkit.Chem.SaltRemover import SaltRemover

smiles = "Cl.C[C@@]1(O)CCCN1"
mol = Chem.MolFromSmiles( smiles )

print( Chem.MolToSmiles( mol  ) ) # mol
#>>> C[C@@]1(O)CCCN1.Cl

# remove salt
# remover = SaltRemover( defnData="[Cl,Br]" ) # define custom list, No spaces allowed
remover = SaltRemover() # use default saltremover
stripped = remover.StripMol( mol ) # strip salts
print( Chem.MolToSmiles( stripped ) ) #  mol w/o salt
#>>> C[C@@]1(O)CCCN1

# remove stereo
Chem.RemoveStereochemistry( stripped ) 
print( Chem.MolToSmiles( stripped ) ) # mol w/o salt & stereo
#>>> CC1(O)CCCN1

# check for specific atom
atomlist =  [ atom.GetAtomicNum() for atom in stripped.GetAtoms() ]
print( 8 in atomlist ) # check for atom for removal
#>>> True

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.