Sometimes I'm a bit too quick to assume that the RDKit is doing something
wrong; this turns out to be one of those cases. Kind of...

The default salt definitions used by the RDKit are encoded using SMARTS. In
your case the matching salt definition is:
[Li,Na,K,Ca,Mg]

When you convert a molecule defined from this SMARTS into a SMILES, you get
the incorrect result that you saw:

In [3]: Chem.MolToSmiles(Chem.MolFromSmarts('[Li,Na,K,Ca,Mg]'))
Out[3]: '[LiH]'


So, although the correct salt is being removed, an incorrect SMILES is
being generated.

I think there's a good case to be made that the SMILES being generated here
is a bug. There should be some kind of clear indication that a query atom
is present.

-greg



On Tue, Jul 31, 2018 at 5:26 AM Greg Landrum <greg.land...@gmail.com> wrote:

> Hi Mariana,
>
> Sorry for the slow reply.
>
> On Tue, Jul 24, 2018 at 11:52 AM Mariana Assmann <mariana.assm...@gmx.net>
> wrote:
>
>>
>> Why does StripMolWithDeleted return [LiH] as the deleted salt instead of
>> [Na] in the following example? I am using version 2018.03.1
>>
>> smiles = 'CC(=O)O.[Na]'
>> mol = Chem.MolFromSmiles(smiles)
>> remover = SaltRemover()
>> res, deleted = remover.StripMolWithDeleted(mol, dontRemoveEverything=True)
>> print(Chem.MolToSmiles(deleted[0]))
>> >>> [LiH]
>>
>
> There's no complicated or interesting answer to that one: it's a bug.
> Thanks for pointing it out.
> Here's the github issue: https://github.com/rdkit/rdkit/issues/1987
>
> This should be fixable for the next patch release.
>
> Best,
> -greg
>
>
>
>
>>
>>
>> Thank you,
>> Mariana
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
------------------------------------------------------------------------------
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
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to