1

I'm looking to parse a large .sdf file and put it into a CSV.

The only software I could find that parses .sdf files is OpenBabel's Pybel, but it won't properly install for my El Capitan, for either python2.7 or 3.+ (it's an open issue, and might hopefully be fixed with the next release).

Are there any other languages/OSS that can easily parse this file? As well, if there aren't, is there a recommended operating system I could spin up with VirtualBox that will easily run OpenBabel/Pybel?

1 Answer 1

1

The OpenEyes library supports reading from MOD SD Files and writing to .csv files as you can see here along with a large number of others of course.

#!/usr/bin/env python
from openeye.oechem import *

ifs = oemolistream()
ofs = oemolostream()

ifs.SetFormat(OEFormat_SDF)
ofs.SetFormat(OEFormat_CSV)

for mol in ifs.GetOEGraphMols():
    OEWriteMolecule(ofs, mol)

It may be a good idea to follow the advice on setting up a virtual-env.

Your Answer

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

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