Hi,

I found the examples in the bug report. The code in canon.h handles
disconnected fragments correctly. However, in smilesformat.cpp the symmetry
classes are computed for the molecule as a whole. This is not what the
canonical coding algorithm expects and the resulting smiles may be
different when canonicalized separately or as part of a complex.

I have a simple patch to fix this here:
http://moldb.net/timvdm/multi_mol_smiles.patch

With this patch I get the correct results:

$ echo 'OC(=O)[C@@H]([C@H](C(=O)O)O)O.CNC[C@@H](c1ccc(c(c1)O)O)O' | obabel
-ismi -ocan
O[C@H]([C@H](C(=O)O)O)C(=O)O.CNC[C@@H](c1ccc(c(c1)O)O)O
1 molecule converted
$ echo 'OC(=O)[C@@H]([C@H](C(=O)O)O)O' | obabel -ismi -ocan
O[C@H]([C@H](C(=O)O)O)C(=O)O
1 molecule converted

This patch should only affect multi-molecule smiles. Single fragment smiles
are not affected. I can run this patch on a few million molecules and
compare the results to get a better view (with more confidence) of what
would actually change.

Tim


On Mon, Feb 17, 2014 at 6:41 PM, Tim Vandermeersch <
tim.vandermeer...@gmail.com> wrote:

> Hi,
>
> Are there any examples of disconnected SMILES that have this problem?
> IIRC, a canonical code is created for each fragment individually and these
> are later sorted to create the entire canonical order. A quick look at the
> code confirms this but I'll try to test some cases tonight to see if this
> is still the case.
>
> Tim
>
>
> On Mon, Feb 17, 2014 at 4:50 PM, Geoffrey Hutchison <
> geoff.hutchi...@gmail.com> wrote:
>
>> > This is actually a pretty bad thing. But it may not be that easy to
>> fix, and would result in a major change to the SMILES that OpenBabel
>> produces (very unfortunate, as it requires large databases to be completely
>> re-canonicalized).
>>
>> As far as I can tell, the code is still there.. As far as the different
>> canonicalization, we had a variety of bugs in the canonicalization going
>> from 2.2 -> 2.3. I agree, it's not present, but I think it's an important
>> bug to fix soon and will be part of the 2.4.0 release.
>>
>> -Geoff
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Android apps run on BlackBerry 10
>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>> Get your Android app in front of a whole new audience.  Start now.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> OpenBabel-Devel mailing list
>> openbabel-de...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-devel
>>
>
>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&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