From: DeLano, W. <wa...@su...> - 2002-03-11 18:47:26
|
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 =3D SDF("input.sdf") while 1: r =3D isdf.read() if not r: break mol =3D r.get('MOL') ident =3D 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'=20 from pymol import cmd from chempy.sdf import SDF from string import join isdf =3D SDF("input.sdf") while 1: r =3D isdf.read() if not r: break mol =3D r.get('MOL') ident =3D r.get_single('MOLID') cmd.read_molstr(join(mol,''),ident) isdf.close() -- mailto:wa...@su... 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:sz...@ri...] > Sent: Monday, March 11, 2002 9:27 AM > To: pym...@li... > Subject: [PyMOL] MDL file >=20 >=20 > Dear Pymol Users/Developers, >=20 > If I have an MDL (.sdf) file with multiple models, how can I=20 > 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. >=20 > Cheers: >=20 > Szilva >=20 >=20 > _______________________________________________ > PyMOL-users mailing list > PyM...@li... > https://lists.sourceforge.net/lists/listinfo/pymol-users >=20 |