+1 vote
in Programming Languages by (74.2k points)
I want to read an SDF file to get all the molecules in it. How can I use the RDkit package in Python for it?

1 Answer

+1 vote
by (351k points)
selected by
 
Best answer

You can read an SDF file using the SDMolSupplier() function of the rdkit.Chem module to get the list of molecules.

Here is an example:

from rdkit import Chem
supplier = Chem.SDMolSupplier('supplier_file.sdf')
mols = [mol for mol in supplier if mol is not None]

In the above code, you need to replace 'supplier_file.sdf' with your SDF file.


...