Hi, >> But, is not possible put the name for each molecule that appear in the sdf >> file?
> I can see that this would be useful, but at present the molecule title > cannot be used as the output file name with babel or obabel. > > It would probably be possible using a simple Python script. > Sure, probably the best way, IMHO. Or split the sdf (output files should be the molecule name) (with e.g. SplitSDFiles.pl from Mayachemtools; I have my own very basic perl script too if you want to give it a try), and convert to mol2. Or convert the multi sdf to multi mol2, and split the mol2 (I have a basic perl script for that too - it should take less that one day for 1 million molecule, if I remember well, on my own PC). Or split the sdf with obabel, rename the file (I have a tcl script if the name is in a sdf field, or perl script which need an input file with mol names). But all that stuff was before I knew pybel, which can do it in one shoot: #!/usr/bin/python import pybel for mol in pybel.readfile("sdf", "tmp.sdf"): filename = mol.OBMol.GetTitle() filename = filename + ".mol2" output = open(filename,"w") # erase existing file, if any output.write(mol.write("mol2")) output.close() That's it. Comments welcome, I'm always eager to learn how do it better, as scripting is not my biggest skill :) Regards, Pascal ------------------------------------------------------------------------------ Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss