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: 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: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-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-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: 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 > |