Hi Greg,

There is no blank line after the end of the molecule in my test cases.
The molecule ends: M  END<newline>$$$$<eof>

If I change it to: M  END<eof> the atEnd() method works as expected,
if you expect mol blocks to parse as SD mols.

If I change the file end to: M  END<newline>$$$$<newline><eof> I get
atEnd() returning false, followed by the error message:
ERROR: Counts line too short: '' on line47
ERROR: moving to the begining of the next molecule
followed by a NULL ROMol object being returned by next() and atEnd()
returning true on the next iteration.

Yours,

Toby


On 10 October 2012 14:52, JP <jeanpaul.ebe...@inhibox.com> wrote:
>
> On 10 October 2012 14:24, Greg Landrum <greg.land...@gmail.com> wrote:
>>
>> On Tue, Oct 9, 2012 at 4:44 PM, Toby Wright <toby.wri...@inhibox.com>
>> wrote:
>> >
>> > Working in C++, I am calling ForwardsSDMolSupplier's method "atEnd()",
>> > expecting that it returns false if there are more molecules and true
>> > if there are no more molecules. As such the line:       while
>> > (!molSupplier->atEnd()) ought to be the obvious looping test with
>> > molSupplier->next()      providing the molecules, one per loop. Sadly it
>> > seems that atEnd doesn't work. For example if I have a file with 2
>> > molecules in it, the loop executes 3 times. On the first 2 "next()"
>> > provides me with the correct molecule. On the third "next()" returns
>> > NULL. Then when the loop test is checked for a fourth time atEnd()
>> > returns true.
>> >
>> > I can work around this very easily so there is no urgency from me,
>> > just thought I should make the bug known. Below is code in full that
>> > demonstrates the problem.
>>
>> Thanks for raising it. This is a known characteristic of the
>> ForwardSDMolSupplier. This supplier does not do a look-ahead at the
>> end of the molecule, so if there's a blank line after the last
>> molecule, the supplier has no way of knowing the file is actually at
>> the end until you try to read the next molecule. Fixing this requires
>> adding a cache to the supplier so that it can do look-ahead. This is
>> doable (and would help address the outstanding feature request to have
>> a getLastItemText method on ForwardSDMolSuppliers.
>
>
>
> https://sourceforge.net/p/rdkit/bugs/259/
>
>>:-)
>
> (feel free to reject it, of course)
>
>

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to