On Nov 11, 2010, at 9:58 PM, Noel O'Boyle replied to Andrew Dalke: >> Since I'm not (directly) calling WriteMolecule and since my >> test cases don't support the --gen2D or --gen3d flags, this >> warning isn't that helpful in a library function. > > This is by design (added recently). Up until recently, new users > thought that Open Babel didn't work, and complained to the mailing > list. I remember it confused me too when I first did a SMILES to SDF > conversion and it came up all zeros! This way we annoy you and me but > everyone else is happy.
I understand the need for the warning. It's useful and appropriate. But in a general-purpose library, this warning is less useful and rarely appropriate. It indicates that the library should have some way to flag to the caller that some action should be done, and let the caller figure out the right way to handle that. For example, in a GUI without a console, that message isn't helpful. However, as the number of people who have a problem with this are very small in number, I am not suggesting a change to the API. I wanted to point this out only if there was a simple solution which addressed everyone's problems. >> 3) Why does the fingerprint GetBit require a fingerprinter instance? >> That is, I have to go through a bound method >> >> x = ob.OBFingerprint.FindFingerprint("FP2") >> self.assertEquals(x.GetBit(v, 0), True) >> >> instead of using a static/global function >> >> self.assertEquals(ob.OBFingerprint.GetBit(v, 0), True) > > ? That is, why do I need the "FP2" or to load any fingerprinter. Is there any way to call GetBit otherwise? > All Begin/End methods do not work from Python. Many of them are > disabled from Python. Okay. Didn't know that. >> 6) I included tests for iterating over atoms and bonds in >> a molecule, and for atoms and bonds connected to an atom. I >> expected I could also iterate over the atoms in a bond, but >> there is no OBBondAtomIter . While not important, it appeals >> to my sense of symmetry and it's very simple to write. > > True, but will have to wait until next API change. What does "API" change mean here? This is part of the adapter layer to make Python work with OpenBabel. ... Ahh, you mean that the C++ layer doesn't have an iterator interface for this case, so the Python one won't have something like def OBBondAtomIter(bond): yield bond.GetBeginAtom() yield bond.GetEndAtom() until the C++ one does. Well, I can understand the reasoning behind keeping things in synch. > >> 7) Why can't I do mol.AddBond(C, N, 3) where C and N are atoms? >> Instead, I need to do mol.AddBond(C.GetIdx(), N.GetIdx(), 3) > > No reason I guess. Could cause problems where C and N are not members > of the molecule though. Which lead me to wonder why >>> import openbabel as ob >>> mol = ob.OBMol() >>> mol.AddBond(123,435, 3) True returned True. Then digging through the code I discovered "OBGenericDataType::VirtualBondData". which lead me to try >>> mol.AddBond(-123, -532, 3) True I don't intend for the code to change, only pointing out something I thought was interesting. >> 9) How does OpenBabel define "implicit hydrogen"? > ? Take away the other things I said. It was my attempt at figuring out what OB does. I think I know the answer but it's different from RDKit, OEChem, and Daylight, and not what I'm used to, so I'm looking for enlightenment. > I think no C arrays are accessible (I think most instances can be > worked around). You need to use atom.GetVector(). Through the magic of ctypes. I use it in my fingerprint reader, for example, to get faster access to the actual fingerprint data. >> 15) In an OBRing, if there are multiple non-C atoms, which one >> is the root? And since ring.GetRootAtom() returns an integer, >> shouldn't it be named GetRootAtomIdx()? > > ? What does the "?" refer to? There are two parts here. - "the root" mol = parse_smiles("C12CNCC3C1.C2CCC3") sssr = mol.GetSSSR() ring = sssr[0] idx = ring.GetRootAtom() The documentation for GetRootAtom: the index for the root atom. O for furan, S for thiazole, N for pyrrole. For 6 membered aromatic rings, the first non carbon atom is used for root. For 5 members rings the O, S or N (BOSum=3, valence=3) will be used for root That isn't enough information to figure out what it does. What is "first"? What if there are multiple non-carbons, as in "C1CCOCOCCNC1" -- which is first? - "GetRootAtomIdx()" The other API calls which end "*Atom()" return an OBAtom, while *Idx() returns an integer. This is an API call which returns an integer index instead of an actual atom. >> 19) I see that MMFF94's ValidateGradients() dumps output >> to stdout. The other ValidateGradients I tested (gaff and >> ghemical) do not do that, and the output probably isn't >> appropriate for a library. >> >> Then again, the API docs say that it's meant for debugging. >> Should the debugging API be published for general use? > > ? Who is the target audience for ValidateGradients()? Is it used for anything other than debugging? Andrew da...@dalkescientific.com ------------------------------------------------------------------------------ Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel