Home > Community > Open Source SDF (Chemical Table File) Parser in any language
Upvote

28

Downvote
+ Software
+ Cheminformatics
Posted by
Karen Constable

Open Source SDF (Chemical Table File) Parser in any language

Leliz Lampe  Follow

The free, open-source RDKit chemoinformatics software can read .sdf files. This software is most often used via it's Python API.

You can learn more about RDKit at the project's home page.

I recommend installing it via conda. (If you use python regularly but don't use conda for controlling environments and package distribution, you probably should.) The installation command is conda install -c https://conda.anaconda.org/rdkit rdkit.

The python code to parse an sdf file and write to a csv file is very simple.

import pandas as pdfrom rdkit import Chemfrom rdkit.Chem import PandasToolsmy_sdf_file = '/Users/curt/Desktop/sdf-isothiocyanates.sdf'frame = PandasTools.LoadSDF(my_sdf_file,                            smilesName='SMILES',                            molColName='Molecule',                            includeFingerprints=False)frame.to_csv('/Users/curt/Desktop/excel_isothiocyanates.csv')

More

Upvote

VOTE

Downvote
Arlen Alexander  Follow

The .png below has some stand alone python that will read .sdf files and produce comma separated output. Its come out rather small but should still be readable. You can run the code from Atom on an apple mac or notepad++ on a pc.

sdf python page 1sdf python image 2

More

Upvote

VOTE

Downvote
Bert Murray  Follow

You can also have a look at Bioclipse, which mixes a graphical interface with scripting (JavaScript, Python, and Groovy):

enter image description here

I blogged about an example script for Bioclipse before, which looks like:

hmdbIndex =  molTable.createSDFIndex(    "/WikiPathways/hmdb.sdf");props = new java.util.HashSet();props.add("HMDB_ID");molTable.parseProperties(hmdbIndex, props);idIndex = new java.util.HashMap();molCount = hmdbIndex.getNumberOfMolecules();for (i=0; i

Bioclipse is developed by a team predominantly working on OS/X.

More

Upvote

VOTE

Downvote