ChemPy has a an SDF class for processing SD files. Here's an example of using it to answer your question.
# Python code for reading an SDF file with # identifier in first line of the MOL record from pymol import cmd from chempy.sdf import SDF from string import join,strip isdf = SDF("input.sdf") while 1: r = isdf.read() if not r: break mol = r.get('MOL') ident = strip(mol[0]) cmd.read_molstr(join(mol,''),ident) isdf.close() # Python code for reading an SD file with # identifier as separate SD field 'MOLID' from pymol import cmd from chempy.sdf import SDF from string import join isdf = SDF("input.sdf") while 1: r = isdf.read() if not r: break mol = r.get('MOL') ident = r.get_single('MOLID') cmd.read_molstr(join(mol,''),ident) isdf.close() -- mailto:war...@sunesis.com Warren L. DeLano, Ph.D. Informatics Manager Sunesis Pharmaceuticals, Inc. 341 Oyster Point Blvd. S. San Francisco, CA 94080 (650)-266-3606 FAX:(650)-266-3501 > -----Original Message----- > From: Szilveszter Juhos [mailto:szi...@ribotargets.com] > Sent: Monday, March 11, 2002 9:27 AM > To: pymol-users@lists.sourceforge.net > Subject: [PyMOL] MDL file > > > Dear Pymol Users/Developers, > > If I have an MDL (.sdf) file with multiple models, how can I > ask pymol to > load them into separate models? As I checked pymol is reading sdf with > chempy's reader, so I could access the data field as well somehow. > > Cheers: > > Szilva > > > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pymol-users >