From: Noel O'B. <no...@ca...> - 2005-12-06 10:03:08
Attachments:
pyopenbabel.py
|
Dear all, I have been thinking about developing a more Pythonic interface to OpenBabel, PyOpenBabel, along the same idea as PyDaylight, for the Daylight library (Andrew Dalke). It is a wrapper around the SWIG interface to OpenBabel. The motivation is: (1) to provide easy access to attributes and methods (no need for GetVar()) (2) to keep things simple (only one good way to do things) (3) things should work 'as expected' in Python (iterators, etc.) For example, the following sort of commands should work: ----------------------- for atom in molecule.atoms: (or even 'for atom in molecule' !) print atom.coords print atom.element text = molecule.write("SDF") molecule.write("SMILES",filename="mymolecule.smi") print vars(atom).keys() # Show the attributes of 'atom', like dir(atom) ['index', 'hyb', 'valence', 'coordidx', 'formalcharge', 'idx', 'implicitvalence', 'type', 'partialcharge', 'heterovalence', 'isotope', 'cidx', 'coords', 'vector', 'atomicnum', 'atomicmass', 'OBAtom', 'spin', 'exactmass', 'heavyvalence', 'data'] ----------------------- It should be possible to access 90% of the OpenBabel library following these guidelines, and the other 10% can be accessed by 'advanced users' through the original OpenBabel objects, atom.OBAtom in the example above. I have done some work towards this goal (attached) although file format conversion will have to wait until OpenBabel is ready. If there is some interest in this, I will put it up on SourceForge. Comments, suggestions are welcome, of course. Regards, Noel |
From: Geoffrey H. <ge...@ge...> - 2005-12-06 14:16:29
|
On Dec 6, 2005, at 5:02 AM, Noel O'Boyle wrote: > It should be possible to access 90% of the OpenBabel library following > these guidelines, and the other 10% can be accessed by 'advanced > users' > through the original OpenBabel objects, atom.OBAtom in the example > above. Sounds great! This certainly offers better syntax than the original SWIG wrapper. Is it relatively easy to update the code as the library changes? > I have done some work towards this goal (attached) although file > format > conversion will have to wait until OpenBabel is ready. > If there is some interest in this, I will put it up on SourceForge. > Comments, suggestions > are welcome, of course. Can this be included alongside the current SWIG wrapper in scripts/ python? I'd ultimately like to have a separate download "package" for each scripting module on SourceForge, but want to get slightly more bulletproof code first. Thanks! -Geoff |
From: Noel O'B. <no...@ca...> - 2005-12-06 14:47:19
|
On Tue, 2005-12-06 at 09:16 -0500, Geoffrey Hutchison wrote: > On Dec 6, 2005, at 5:02 AM, Noel O'Boyle wrote: > > > It should be possible to access 90% of the OpenBabel library following > > these guidelines, and the other 10% can be accessed by 'advanced > > users' > > through the original OpenBabel objects, atom.OBAtom in the example > > above. > > Sounds great! This certainly offers better syntax than the original > SWIG wrapper. Is it relatively easy to update the code as the library > changes? Well, I won't argue "better" or "worse", but "easier for me" is certainly true. I'll let you know how easy it is to update once I've written it all - at the moment, piece of cake :-) (But I get your point) > > I have done some work towards this goal (attached) although file > > format > > conversion will have to wait until OpenBabel is ready. > > > If there is some interest in this, I will put it up on SourceForge. > > Comments, suggestions > > are welcome, of course. > > Can this be included alongside the current SWIG wrapper in scripts/ > python? I'd ultimately like to have a separate download "package" for > each scripting module on SourceForge, but want to get slightly more > bulletproof code first. Well, that'd be great. > Thanks! > -Geoff > |
From: S J. S. <swa...@gm...> - 2005-12-06 18:12:57
|
Noel, how did you fix the compile/linking problems? Josh On 06/12/05, Noel O'Boyle <no...@ca...> wrote: > On Tue, 2005-12-06 at 09:16 -0500, Geoffrey Hutchison wrote: > > On Dec 6, 2005, at 5:02 AM, Noel O'Boyle wrote: > > > > > It should be possible to access 90% of the OpenBabel library followin= g > > > these guidelines, and the other 10% can be accessed by 'advanced > > > users' > > > through the original OpenBabel objects, atom.OBAtom in the example > > > above. > > > > Sounds great! This certainly offers better syntax than the original > > SWIG wrapper. Is it relatively easy to update the code as the library > > changes? > > Well, I won't argue "better" or "worse", but "easier for me" is > certainly true. I'll let you know how easy it is to update once I've > written it all - at the moment, piece of cake :-) (But I get your point) > > > > I have done some work towards this goal (attached) although file > > > format > > > conversion will have to wait until OpenBabel is ready. > > > > > If there is some interest in this, I will put it up on SourceForge. > > > Comments, suggestions > > > are welcome, of course. > > > > Can this be included alongside the current SWIG wrapper in scripts/ > > python? I'd ultimately like to have a separate download "package" for > > each scripting module on SourceForge, but want to get slightly more > > bulletproof code first. > > Well, that'd be great. > > > Thanks! > > -Geoff > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Noel O'B. <no...@ca...> - 2005-12-07 10:12:52
|
On Tue, 2005-12-06 at 10:11 -0800, S Joshua Swamidass wrote: > Noel, how did you fix the compile/linking problems? I didn't fix those problems, but those problems only occur when you try file conversion. So I have just written code to use the other parts, so far. > Josh > > On 06/12/05, Noel O'Boyle <no...@ca...> wrote: > > On Tue, 2005-12-06 at 09:16 -0500, Geoffrey Hutchison wrote: > > > On Dec 6, 2005, at 5:02 AM, Noel O'Boyle wrote: > > > > > > > It should be possible to access 90% of the OpenBabel library following > > > > these guidelines, and the other 10% can be accessed by 'advanced > > > > users' > > > > through the original OpenBabel objects, atom.OBAtom in the example > > > > above. > > > > > > Sounds great! This certainly offers better syntax than the original > > > SWIG wrapper. Is it relatively easy to update the code as the library > > > changes? > > > > Well, I won't argue "better" or "worse", but "easier for me" is > > certainly true. I'll let you know how easy it is to update once I've > > written it all - at the moment, piece of cake :-) (But I get your point) > > > > > > I have done some work towards this goal (attached) although file > > > > format > > > > conversion will have to wait until OpenBabel is ready. > > > > > > > If there is some interest in this, I will put it up on SourceForge. > > > > Comments, suggestions > > > > are welcome, of course. > > > > > > Can this be included alongside the current SWIG wrapper in scripts/ > > > python? I'd ultimately like to have a separate download "package" for > > > each scripting module on SourceForge, but want to get slightly more > > > bulletproof code first. > > > > Well, that'd be great. > > > > > Thanks! > > > -Geoff > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > > _______________________________________________ > > OpenBabel-scripting mailing list > > Ope...@li... > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > |