Re: [Open Babel] Unexpected behavior with GetResidue()

2014-10-03 Thread Stefano Forli
I partially agree with the explanation. What makes me uncomfortable is the inconsistency of the behavior between the two methods. Ideally, either both OBAtom.GetResidue() and OBResidue.GetResidue() should trigger residue perception, or none. The current behavior opens the way to all kinds of un

Re: [Open Babel] Unexpected behavior with GetResidue()

2014-10-03 Thread Noel O'Boyle
I guess that calling GetResidue triggers residue perception but the iterator doesn't trigger it. I don't think it's a bug - just because GetResidue automatically does something doesn't mean that everything should. In particular, iterators shouldn't have side-effects. To directly perceive, uses OBCh

[Open Babel] Unexpected behavior with GetResidue()

2014-10-02 Thread Stefano Forli
Hi, I'm a little bit puzzled by the behavior of the following code: import pybel ob = pybel.ob smi = 'c1c1' mol = pybel.readstring('smi', smi).OBMol print "RESIDUES FOUND:", len([ x for x in ob.OBResidueIter(mol)]) mol.GetAtom(1).GetResidue() print "RESIDUES FOUND:"