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 OBChainsParser.

- Noel

On 3 October 2014 02:15, Stefano Forli <fo...@scripps.edu> wrote:
> Hi,
> I'm a little bit puzzled by the behavior of the following code:
> ----------------------------
> import pybel
> ob = pybel.ob
> smi = 'c1ccccc1'
> mol = pybel.readstring('smi', smi).OBMol
> print "RESIDUES FOUND:", len([ x for x in ob.OBResidueIter(mol)])
> mol.GetAtom(1).GetResidue()
> print "RESIDUES FOUND:", len([ x for x in ob.OBResidueIter(mol)])
> print mol.GetResidue(0).GetName()
> ----------------------------
> On v2.3.1 the output is:
>   RESIDUES FOUND: 0
>   RESIDUES FOUND: 1
>   LIG
>
>
> Basically, the OBMol has no residues before OBAtom.GetAtom() gets called, 
> then one is
> created (and named "LIG").
> It seems like a bug to me, but I want to be sure I'm not missing anything 
> before reporting
> it...
>
> Thanks,
>
> S
>
> --
>   Stefano Forli, PhD
>
>   Staff Scientist
>   Molecular Graphics Laboratory
>   Dept. of Integrative Structural
>    and Computational Biology, MB-112F
>   The Scripps Research Institute
>   10550  North Torrey Pines Road
>   La Jolla,  CA 92037-1000,  USA.
>
>      tel: +1 (858)784-2055
>      fax: +1 (858)784-2860
>      email: fo...@scripps.edu
>      http://www.scripps.edu/~forli/
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to