Thank you Andrew! Indeed it's working and it's a tiny bit faster too.
Best,
M
----
Pozdrawiam, | Best regards,
Maciek Wójcikowski
[email protected]
2016-10-03 13:08 GMT+02:00 Andrew Dalke <[email protected]>:
> On Oct 2, 2016, at 10:48 PM, Maciek Wójcikowski wrote:
> > Yes I get it, but obviously there is no MolFromSDBlock, so one would
> suspect MolFromMolBlock to support both formats. As I understand correctly
> the only way of reading SD from variable is as presented in my example? Or
> is there some marvelous undocumented API? ;)
>
> Six years ago, Greg Landrum at http://www.mail-archive.com/
> [email protected]/msg01436.html suggested:
>
> nsuppl = Chem.SDMolSupplier()
> nsuppl.SetData(mb)
> mol = nsuppl.next()
>
> This is simpler than passing in a StringIO().
>
> I knew about this posting because my own code has MolFromSDBlock() wrapper
> layer, and a comment pointing to that URL as explanation.
>
>
> On Oct 2, 2016, at 11:06 PM, Brian Kelley wrote:
> > The general idea, I believe, is that if the format can result in
> multiple molecules a supplier should be used.
>
> I wrote the function to make it easier to deal with web service input or
> database records where the text contains one and only one record in SD
> format. This is a proper subset of the SD format, which contains 0 or more
> records.
>
> If there are no records then my function returns a None, so I don't need
> to deal with a StopIteration. I don't care if there is more than one
> record, so I ignore anything past the first record.
>
> The use case occurs pretty frequently in my work, so I figured a
> MolFromSDBlock() for my own use was worthwhile.
>
> Cheers,
>
> Andrew
> [email protected]
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss