Advertisement
Programmin-in-Python

Converting SDF to CSV using loop

Jan 4th, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. from os import listdir
  2. from rdkit import chem
  3. from rdkit.Chem.ChemUtilsSDFToCSV import convert
  4.  
  5. with open (r'trial.csv', 'a') as csvfile:
  6.     for i in listdir(path):#path => the path of the folder where all the sdf files are present
  7.  
  8.         if i[-1:-4:-1] == 'fds':
  9.             Suppl = chem.SDMolSupplier(i)
  10.             convert(Suppl, csvfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement