This list is closed, nobody may subscribe to it.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(10) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(3) |
Feb
(10) |
Mar
(5) |
Apr
(12) |
May
(8) |
Jun
(9) |
Jul
(3) |
Aug
(11) |
Sep
|
Oct
(26) |
Nov
(21) |
Dec
(20) |
2007 |
Jan
(10) |
Feb
(32) |
Mar
(14) |
Apr
(13) |
May
(44) |
Jun
(13) |
Jul
(18) |
Aug
(26) |
Sep
(17) |
Oct
(3) |
Nov
(10) |
Dec
(8) |
2008 |
Jan
(20) |
Feb
(8) |
Mar
(28) |
Apr
(18) |
May
(22) |
Jun
(13) |
Jul
(4) |
Aug
(2) |
Sep
(19) |
Oct
(17) |
Nov
(8) |
Dec
(10) |
2009 |
Jan
(4) |
Feb
(3) |
Mar
(12) |
Apr
(15) |
May
(7) |
Jun
(1) |
Jul
(13) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(14) |
Dec
(13) |
2010 |
Jan
(9) |
Feb
(6) |
Mar
(21) |
Apr
(12) |
May
(4) |
Jun
|
Jul
(2) |
Aug
(15) |
Sep
(3) |
Oct
(1) |
Nov
(18) |
Dec
(6) |
2011 |
Jan
(7) |
Feb
(13) |
Mar
(17) |
Apr
(7) |
May
(16) |
Jun
(21) |
Jul
(15) |
Aug
(11) |
Sep
(12) |
Oct
(3) |
Nov
(14) |
Dec
(4) |
2012 |
Jan
(10) |
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(1) |
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Patricia O. <po...@us...> - 2006-06-05 20:57:17
|
From: Geoffrey H. <ge...@ge...> - 2006-05-25 20:57:48
|
On May 25, 2006, at 10:53 AM, Noel O'Boyle wrote: > I've been reading up on C++, and so can finally make some sense of the > code. What does mol.ReserveAtoms(natom) do though? The API is > silent on > this matter, and the inline code is slightly obaque. Ah. I'll make a note to update the docs on that. In C++, the vector type is a re-sizable array. That means if you start adding objects, it resizes when needed, right? When it resizes, and how much space it adds is an implementation issue. But if you're adding 1,000 atoms at once, chances are good that the vector will resize a few times -- copying data, allocating more memory, etc. If you know ahead of time that you're going to be adding 1,000 atoms, you can improve performance and memory use by allocating that vector right at the beginning: mol.ReserveAtoms(1000); ... Cheers, -Geoff |
From: Noel O'B. <no...@ca...> - 2006-05-25 14:54:13
|
On Thu, 2006-05-25 at 10:25 -0400, Geoffrey Hutchison wrote: > On May 25, 2006, at 5:08 AM, Noel O'Boyle wrote: > > > Given a set of atom coordinates and corresponding atomic numbers, > > is the > > following function sufficient to create an OBMol suitable for > > writing to > > a file as a PDB, for example? > > Sure. If you look at the xyzformat code, that's pretty much what you > get. Thanks - I've been reading up on C++, and so can finally make some sense of the code. What does mol.ReserveAtoms(natom) do though? The API is silent on this matter, and the inline code is slightly obaque. Does this have an effect on subsequent uses of mol.NewAtom() ? Regards, Noel |
From: Geoffrey H. <ge...@ge...> - 2006-05-25 14:25:32
|
On May 25, 2006, at 5:08 AM, Noel O'Boyle wrote: > Given a set of atom coordinates and corresponding atomic numbers, > is the > following function sufficient to create an OBMol suitable for > writing to > a file as a PDB, for example? Sure. If you look at the xyzformat code, that's pretty much what you get. Cheers, -Geoff |
From: Noel O'B. <no...@ca...> - 2006-05-25 09:08:40
|
Given a set of atom coordinates and corresponding atomic numbers, is the following function sufficient to create an OBMol suitable for writing to a file as a PDB, for example? def createopenbabel(atomcoords,atomnos): """Create an open babel molecule.""" obmol = ob.OBMol() for coords,atomno in zip(atomcoords,atomnos): obatom = ob.OBAtom() obatom.SetAtomicNum(atomno) obatom.SetVector(*coords) obmol.AddAtom(obatom) obmol.ConnectTheDots() obmol.PerceiveBondOrders() return obmol (I see that I've neglected to include the molecular charge, but apart from that, how does it look? Do I have to handle aromaticity in some way?) Regards, Noel |
From: Geoffrey H. <ge...@ge...> - 2006-05-09 01:19:19
|
On Apr 24, 2006, at 10:55 AM, Noel O'Boyle wrote: >>> How can I access the data fields in an SD file? Such as... >> data = mymol.GetData("Mol weight"); // returns type OBPairData >> data.GetValue() // returns 1234.567 or whatever > > I think OB is misbehaving, then. mymol.GetData("NSC") returns None > (the > Python object) and mymol.HasData("NSC") returns False. I thought I had e-mailed you, but evidently not. Could you submit a bug report with a test file? Let's make sure this is fixed ASAP. Thanks, -Geoff |
From: Dr N. O'B. <no...@ca...> - 2006-05-09 01:15:35
|
Ok, moving swiftly on from my previous non-bug, I have in fact identified an unexpected feature. I was a bit confused why you referred to OBPairData in the example below, as in Python it's an OBGenericData that's actually returned. As a result, there's no GetValue() method and it's not possible to access the field value (I previously was accessing GetDataType() which was returning '1' which coincidentally happened to be the value of my data field and so I thought that everything was fine). I'll submit a bug report. Regards, Noel On May 6 2006, Geoffrey Hutchison wrote: > >On Apr 24, 2006, at 10:55 AM, Noel O'Boyle wrote: > >>>> How can I access the data fields in an SD file? Such as... >>> data = mymol.GetData("Mol weight"); // returns type OBPairData >>> data.GetValue() // returns 1234.567 or whatever >> >> I think OB is misbehaving, then. mymol.GetData("NSC") returns None >> (the >> Python object) and mymol.HasData("NSC") returns False. > >I thought I had e-mailed you, but evidently not. Could you submit a >bug report with a test file? Let's make sure this is fixed ASAP. > >Thanks, >-Geoff > |
From: Dr N. O'B. <no...@ca...> - 2006-05-08 23:56:10
|
>> I think OB is misbehaving, then. mymol.GetData("NSC") returns None >> (the >> Python object) and mymol.HasData("NSC") returns False. > >I thought I had e-mailed you, but evidently not. Could you submit a >bug report with a test file? Let's make sure this is fixed ASAP. Hmmmm....you see, the strange thing is that it works fine now (egg on face). I don't have a copy of my original test code so I guess I probably had a typo either with the field name or was opening a file without the field. In any case, sorry for 'bugging' you about this. Having this working, means that I can continue with my tutorial on using open source tools to manipulate SD files. Noel P.S.GetDataType() is the method name for getting the value out of the OBGenericData that's returned. Wouldn't GetValue() be more appropriate? |
From: Geoffrey H. <ge...@ge...> - 2006-05-08 17:59:07
|
On May 6, 2006, at 2:22 PM, Dr N. O'Boyle wrote: > Having this working, means that I can continue with my tutorial on > using open source tools to manipulate SD files. Speaking of which, I've been meaning to ask if there's interest in a "contributed script archive" for Open Babel. The idea would be to have a set of scripts that folks can download for examples of the OB wrappers or to simply run. For example, I have a Perl script which outputs a CSV text file suitable for a spreadsheet with a variety of molecular properties, e.g. like the obprop C++ tool. Cheers, -Geoff |
From: Noel O'B. <no...@ca...> - 2006-04-24 14:56:06
|
On Mon, 2006-04-24 at 10:45 -0400, Geoffrey Hutchison wrote: > On Apr 24, 2006, at 10:36 AM, Noel O'Boyle wrote: > > > How can I access the data fields in an SD file? Such as... > > ... > > I am guessing that mymol.GetData() should do this, but it doesn't > > appear > > to. > > You're right. It should. But I haven't looked at how the wrapper > works. Probably... > > data = mymol.GetData("Mol weight"); // returns type OBPairData > data.GetValue() // returns 1234.567 or whatever I think OB is misbehaving, then. mymol.GetData("NSC") returns None (the Python object) and mymol.HasData("NSC") returns False. > I need to write up some of those tutorials, don't I? Anyone have a > 25th hour? How about an 11th hour? Did you see my email regarding the existence of http://www.redbrick.dcu.ie/~noel/parseSD.html? Once I get a few more examples together, it should give some sort of introduction for cheminformaticians (although with a bias on Python and SD files). > Cheers, > -Geoff |
From: Geoffrey H. <ge...@ge...> - 2006-04-24 14:46:16
|
On Apr 24, 2006, at 10:36 AM, Noel O'Boyle wrote: > How can I access the data fields in an SD file? Such as... > ... > I am guessing that mymol.GetData() should do this, but it doesn't > appear > to. You're right. It should. But I haven't looked at how the wrapper works. Probably... data = mymol.GetData("Mol weight"); // returns type OBPairData data.GetValue() // returns 1234.567 or whatever I need to write up some of those tutorials, don't I? Anyone have a 25th hour? Cheers, -Geoff |
From: Noel O'B. <no...@ca...> - 2006-04-24 14:36:44
|
How can I access the data fields in an SD file? Such as... > <Mol weight> 2423.3434 I am guessing that mymol.GetData() should do this, but it doesn't appear to. Regards, Noel |
From: Noel O'B. <no...@ca...> - 2006-04-21 13:06:29
|
Hello all, Sorry for the crossposting, but some of you may be interested in looking at http://www.redbrick.dcu.ie/~noel/parseSD.html where I compare the performance of frowns, CDK and OB, in calculating the molecular weights of all of the molecules in a 100K molecule SD file. This is more from the point of view of creating examples of the use of these programs than to compare performace. Regards, Noel |
From: Geoffrey H. <ge...@ge...> - 2006-04-17 14:53:22
|
The Open Babel project is extremely proud to announce the release of Open Babel 2.0.1, the latest stable version of the free chemistry file translation program and chemistry software library. This release represents a bug-fix release and should be a stable upgrade, strongly recommended for all users of Open Babel. Highlights include improved memory usage, fixes for compilation problems on AIX, Solaris, Fedora Core, and with the new GCC-4.1 compiler. Several crashes were fixed, and significantly improved scripting wrappers for Perl and Python are available. Support for Cygwin and countless bug fixes are also included. What's new? See the full release notes at: http://openbabel.sourceforge.net/wiki/Open_Babel_2.0.1 To download, see: http://sourceforge.net/project/showfiles.php? group_id=40728&package_id=32894&release_id=410464 For more information, see the project website and new wiki at: http://openbabel.sourceforge.net/ Many thanks to all the contributors to Open Babel including those of you who submitted feedback, bug reports, and code contributions. Particular thanks go to (in no particular order) Craig James, Mikael Johansson, Chris Morley, Noel O'Boyle and Kevin Parkes. Cheers, -Geoff |
From: Geoffrey H. <ge...@ge...> - 2006-04-12 19:03:24
|
I apologize in advance to those receiving this message multiple times. However, the 2.0.1 release does offer significant improvements for scripting access, and wanted to make this clear on the scripting list too. > One of the difficulties in "stable" releases is leaving well enough > alone. Many times fixing a bug reveals 3 other related problems. > For this reason, as I'm finalizing the 2.0.1 release of Open Babel, > I have tried to make snapshots available for testing. As discussed > before and after the 2.0 release, we also didn't allow enough time > for a "freeze" before the release for people to test the 2.0 > candidate, be sure the Windows and UNIX releases were in sync, and > make sure the source release had all files. (We managed to leave > out src/dlhandler_win32.cpp, for example.) > > So I've uploaded a 2.0.1 "release candidate" to SourceForge and > Chris and I are freezing the openbabel-2-0-x branch until the 2.0.1 > release. This shouldn't be a big deal since no one except me has > actually checked code into that branch. > > Please try out the release candidate and send feedback. While it > doesn't fix every known bug, the remaining bugs are IMHO ones that > will require considerable debugging and coding to fix. > > http://sourceforge.net/project/showfiles.php? > group_id=40728&package_id=154019&release_id=409376 > > If you uncover new bugs or would like to argue that a particular > bug needs to be fixed ASAP, now is a good time to speak up. > Otherwise, 2.0.1 should be released in the next week or so. Cheers, -Geoff |
From: Geoffrey H. <ge...@ge...> - 2006-04-12 14:10:39
|
On Apr 12, 2006, at 3:24 AM, Steven Enoch wrote: > Does anybody have any experience with getting the Perl bindings for > openbabel to work? I have downloaded and installed OpenBabel 2.0, > I can get the C++ utilities to compile without any trouble, however > when I try and compile the Perl bindings I get the following errors > when I run make test: It's the same bug -- the Perl and Python bindings worked just fine for me on Mac OS X, but it turns out that Linux has different options for loading shared plugins. The "real solution" is in the 2.0.1 release, along with updated bindings for more classes and a pile of bug-fixes. I'd be happy to send anyone the release candidate -- it should be released in a week or two. If you want it, please e-mail me off-list. A workaround in the meantime is to make a small change in OpenBabel.pm: Find the line near the top: @EXPORT = qw( ); Change it to read: @EXPORT = qw( ); sub dl_load_flags { 0x01 } Cheers, -Geoff |
From: Noel O'B. <no...@ca...> - 2006-04-12 14:06:43
|
This problem has been fixed in the development version of OpenBabel. You can either check this out of CVS, or wait a week or so until Geoff has released the next version of OpenBabel. Regards, Noel On Wed, 2006-04-12 at 08:24 +0100, Steven Enoch wrote: > Hi, > > Does anybody have any experience with getting the Perl bindings for > openbabel to work? I have downloaded and installed OpenBabel 2.0, I > can get the C++ utilities to compile without any trouble, however when > I try and compile the Perl bindings I get the following errors when I > run make test: > > /usr/local/lib/openbabel/<file>format.so did lot load properly > > where <file> is every *.so file in the > directory /usr/local/lib/openbabel > > I have checked the /usr/local/lib/openbabel directory and the files > definitely exists. I am running Red Hat Enterprise WS4 version of > Linux on an 32 bit dual processor Intel Xeon Dell machine. > > I have 'Googled' for help but only come across the same problems > relating to the Python bindings. > > Any help would be appreciated, > > Thanks, > > Steve > > Dr Steve Enoch > Computational Chemist > Peakdale Molecular Ltd > Tel +44 (0) 1298 816741 > ste...@pe... > > > > ********************************************************************** > > Peakdale Molecular Ltd > > Peakdale Science Park, Sheffield Road > > Chapel-en-le-Frith, High Peak, SK23 OPG, UK > > T: +44 1298 816700 E: in...@pe... > > F: +44 1298 816701 W: www.peakdale.co.uk > > This e-mail and any attachments hereto are: > > Strictly confidential and intended solely for the addressee. If you > are > > not the intended addressee you must not disclose, copy, distribute, or > take > > any other action in reliance on this e-mail or attachments. If you > have > > received this e-mail in error, please notify the sender immediately. > > Addressees should check all attachments for viruses. Peakdale > Molecular Limited > > make no representations as regards the absence of viruses in > attachments to this e-mail. > > ********************************************************************** > |
From: Steven E. <Ste...@pe...> - 2006-04-12 07:25:11
|
Hi, =20 Does anybody have any experience with getting the Perl bindings for openbabel to work? I have downloaded and installed OpenBabel 2.0, I can get the C++ utilities to compile without any trouble, however when I try and compile the Perl bindings I get the following errors when I run make test: =20 /usr/local/lib/openbabel/<file>format.so did lot load properly =20 where <file> is every *.so file in the directory /usr/local/lib/openbabel =20 I have checked the /usr/local/lib/openbabel directory and the files definitely exists. I am running Red Hat Enterprise WS4 version of Linux on an 32 bit dual processor Intel Xeon Dell machine. =20 I have 'Googled' for help but only come across the same problems relating to the Python bindings. =20 Any help would be appreciated, =20 Thanks,=20 =20 Steve Dr Steve Enoch=20 Computational Chemist=20 Peakdale Molecular Ltd=20 Tel +44 (0) 1298 816741=20 ste...@pe...=20 =20 ********************************************************************** Peakdale Molecular Ltd Peakdale Science Park, Sheffield Road Chapel-en-le-Frith, High Peak, SK23 OPG, UK T: +44 1298 816700=A0 E: in...@pe... F: +44 1298 816701=A0 W: www.peakdale.co.uk This e-mail and any attachments hereto are: Strictly confidential and intended solely for the addressee.=A0 If you are not the intended addressee you must not disclose, copy, distribute, or take any other action in reliance on this e-mail or attachments.=A0 If you have received this e-mail in error, please notify the sender immediately. Addressees should check all attachments for viruses.=A0 Peakdale Molecular = Limited make no representations as regards the absence of viruses in attachments to= this e-mail. ********************************************************************** |
From: Geoffrey H. <ge...@ge...> - 2006-04-06 14:45:00
|
On Apr 6, 2006, at 4:21 AM, Noel O'Boyle wrote: > I may have missed something here, and if so, I recommend moving to the > CVS version. Actually, I recommend moving to the 2.0.1 CVS version, which will soon be released. The CVS "head" version for 2.1 is still a bit thorny in places. I've certainly had problems getting it to work from time to time. On the other hand, the 2.0.1 version should fix many of the problems with 2.0. I'd be glad to send snapshots to people as needed. > Please let us know if you have any more problems/questions with the > scripting module as we are keen to improve it. Indeed! Cheers, -Geoff |
From: Noel O'B. <no...@ca...> - 2006-04-06 08:22:00
|
Hello Seth, First of all, as the OB scripting modules in particular are young and under active development, you may want to consider using the CVS version of openbabel rather than the last release. (You also will have the chance to test out the pyopenbabel module as somewhat described on the openbabel website) To answer your question, this bug has been fixed in CVS. It is caused by Python's confusion between openbabel.so (a C extension) and openbabel.py in /usr/lib/Python2.4/site-packages (on my system). What you need to do is: (1) Change "import openbabel" to "import _openbabel" at the start of your own openbabel.py (in openbabel/scripts/python) (2) change Extension('openbabel' to Extension('_openbabel' in openbabel/scripts/python/setup.py. (3) remove /usr/lib/Python2.4/site-packages/openbabel.so (4) rerun "python setup.py install" (/usr/lib/Python2.4/site-packages should now contain _openbabel.so and openbabel.py) I may have missed something here, and if so, I recommend moving to the CVS version. Please let us know if you have any more problems/questions with the scripting module as we are keen to improve it. Regards, Noel On Thu, 2006-04-06 at 14:34 +1000, Dr. Seth Olsen wrote: > > Hi OBScripters, > > I built the python module from OB 2.0.0, but when I 'import > openbabel', it fails with the following error: > ImportErrr: dynamic module does not define init function > (initopenbabel) > > What did I do wrong? Does anybody know? > > Cheers, > > Seth > > -- > ccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccms > > Dr Seth Olsen, PhD > Postdoctoral Fellow, Biomolecular Modeling Group > Centre for Computational Molecular Science > Chemistry Building, > The University of Queensland > Qld 4072, Brisbane, Australia > > tel (617) 33653732 > fax (617) 33654623 > email: s.o...@uq... > Web: www.ccms.uq.edu.au > > ccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccms > |
From: Dr. S. O. <set...@gm...> - 2006-04-06 04:34:43
|
Hi OBScripters, I built the python module from OB 2.0.0, but when I 'import openbabel', it fails with the following error: ImportErrr: dynamic module does not define init function (initopenbabel) What did I do wrong? Does anybody know? Cheers, Seth -- ccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccms Dr Seth Olsen, PhD Postdoctoral Fellow, Biomolecular Modeling Group Centre for Computational Molecular Science Chemistry Building, The University of Queensland Qld 4072, Brisbane, Australia tel (617) 33653732 fax (617) 33654623 email: s.o...@uq... Web: www.ccms.uq.edu.au ccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccmsccms |
From: Dr N. O'B. <no...@ca...> - 2006-03-16 17:56:32
|
Regarding the wrapping of streams, you may find the following interesting: http://embedded.eecs.berkeley.edu/Alumni/pinhong/scriptEDA/pyTypemapFAQ.html#8 It appears to show a way of wrapping them. Regards, Noel On Mar 16 2006, Noel O'Boyle wrote: >I'm not having great luck with this method. > >Attempt 1 Using Read after ReadFile >========= >from openbabel import * > >myfile = "3d.head.sdf" >obConversion = OBConversion() >obConversion.SetInFormat("sdf") > >mymol = OBMol() >obConversion.ReadFile(mymol,myfile) >print mymol.GetMolWt() >print obConversion.Read(mymol) >print "The program segfaults before this line" > >Attempt 2 Using Read after ReadString >========= >from openbabel import * > >myfilestring = open("3d.head.sdf","r").read() >obConversion = OBConversion() >obConversion.SetInFormat("sdf") > >mymol = OBMol() >obConversion.ReadString(mymol,myfilestring) >print mymol.GetMolWt() >print obConversion.Read(mymol) >print "The program aborts before this line" > >>From the python point of view, what is needed is a function that when >repeatedly called, will return additional molecules. This doesn't need >to be in the main openbabel library, but can be in the SWIG wrapper >somewhere. > >Regards, > Noel > >On Wed, 2006-03-15 at 14:18 -0500, Geoffrey Hutchison wrote: >> On Mar 15, 2006, at 5:18 AM, Noel O'Boyle wrote: >> >> > It seems that OBConversion.ReadFile(OBMolecule) just reads in the >> > first >> > molecule, and I cannot see a way of iterating over the molecules. >> >> The OBConversion.Read(OBMol) function should continue to read from >> the same file. However, since Python and Perl have no concept of >> "streams", it's not possible to use OBConversion.Read() to set up the >> input file or string. >> >> So something like this (sorry, I haven't written much Python, so the >> syntax might be off): >> >> import openbabel >> >> mol = openbabel.OBMol() >> conv = openbabel.OBConversion() >> conv.SetInAndOutFormats("sdf", "sdf") >> obConversion.ReadString(mol, "test.sdf") >> >> while (obConversion.Read(mol)) >> ... >> >> >> Cheers, >> -Geoff > > > > ------------------------------------------------------- This SF.Net email > is sponsored by xPML, a groundbreaking scripting language that extends > applications into web and mobile media. Attend the live webcast and join > the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ OpenBabel-scripting > mailing list Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting |
From: Noel O'B. <no...@ca...> - 2006-03-16 11:24:21
|
I'm not having great luck with this method. Attempt 1 Using Read after ReadFile ========= from openbabel import * myfile = "3d.head.sdf" obConversion = OBConversion() obConversion.SetInFormat("sdf") mymol = OBMol() obConversion.ReadFile(mymol,myfile) print mymol.GetMolWt() print obConversion.Read(mymol) print "The program segfaults before this line" Attempt 2 Using Read after ReadString ========= from openbabel import * myfilestring = open("3d.head.sdf","r").read() obConversion = OBConversion() obConversion.SetInFormat("sdf") mymol = OBMol() obConversion.ReadString(mymol,myfilestring) print mymol.GetMolWt() print obConversion.Read(mymol) print "The program aborts before this line" >From the python point of view, what is needed is a function that when repeatedly called, will return additional molecules. This doesn't need to be in the main openbabel library, but can be in the SWIG wrapper somewhere. Regards, Noel On Wed, 2006-03-15 at 14:18 -0500, Geoffrey Hutchison wrote: > On Mar 15, 2006, at 5:18 AM, Noel O'Boyle wrote: > > > It seems that OBConversion.ReadFile(OBMolecule) just reads in the > > first > > molecule, and I cannot see a way of iterating over the molecules. > > The OBConversion.Read(OBMol) function should continue to read from > the same file. However, since Python and Perl have no concept of > "streams", it's not possible to use OBConversion.Read() to set up the > input file or string. > > So something like this (sorry, I haven't written much Python, so the > syntax might be off): > > import openbabel > > mol = openbabel.OBMol() > conv = openbabel.OBConversion() > conv.SetInAndOutFormats("sdf", "sdf") > obConversion.ReadString(mol, "test.sdf") > > while (obConversion.Read(mol)) > ... > > > Cheers, > -Geoff |
From: Noel O'B. <no...@ca...> - 2006-03-16 11:00:32
|
I have a question about the behaviour of ReadFile. The following code repeatedly reads the first molecule in 3d.head.sdf and prints out 122.12134 twice: """ from openbabel import * myfile = "3d.head.sdf" obConversion = OBConversion() obConversion.SetInFormat("sdf") mymol = OBMol() # Initialise for the first time obConversion.ReadFile(mymol,myfile) print mymol.GetMolWt() # 122.12134 mymol = OBMol() # Initialise for the second time obConversion.ReadFile(mymol,myfile) print mymol.GetMolWt() # 122.12134 """ *but* the following code, appears to append the new molecule to the old molecule -- is this the expected behaviour? """ from openbabel import * myfile = "3d.head.sdf" obConversion = OBConversion() obConversion.SetInFormat("sdf") mymol = OBMol() # Initialise once only obConversion.ReadFile(mymol,myfile) print mymol.GetMolWt() # 122.12134 obConversion.ReadFile(mymol,myfile) print mymol.GetMolWt() # 244.24268 (=122.12134*2) """ Regards, Noel |
From: Geoffrey H. <ge...@ge...> - 2006-03-15 19:18:53
|
On Mar 15, 2006, at 5:18 AM, Noel O'Boyle wrote: > It seems that OBConversion.ReadFile(OBMolecule) just reads in the > first > molecule, and I cannot see a way of iterating over the molecules. The OBConversion.Read(OBMol) function should continue to read from the same file. However, since Python and Perl have no concept of "streams", it's not possible to use OBConversion.Read() to set up the input file or string. So something like this (sorry, I haven't written much Python, so the syntax might be off): import openbabel mol = openbabel.OBMol() conv = openbabel.OBConversion() conv.SetInAndOutFormats("sdf", "sdf") obConversion.ReadString(mol, "test.sdf") while (obConversion.Read(mol)) ... Cheers, -Geoff |