You're going to reach the limit of what this simple approach can do can do
very quickly. :-)
When you express the sulfur atom as [SH] in the SMILES, you tell the RDKit
that it must have an H attached. That information is preserved when you
connect the S to the other molecule, so you end up with a valence that's
too high.

I added a function combine2 to the gist (
https://gist.github.com/greglandrum/fd488309268cb085be218f26178e13b8) that
can handle this case,

On Thu, Nov 1, 2018 at 9:33 AM Noki Lee <noki.le...@gmail.com> wrote:

> Hi, Greg
>
> Recently, I got the code producing a combined molecule from one core and
> several functional groups:
> https://gist.github.com/greglandrum/fd488309268cb085be218f26178e13b8
>
> Here is the exception case that I encountered.
>
> core = Chem.MolFromSmiles('N(=N/c1ccccc1)\c2ccccc2')
> pieces = [Chem.MolFromSmiles(x) for x in ('C(=O)O','O=[SH](=O)O')]
> connections = ((7,0),(4,1))
> newMol = combine(core,pieces,connections)
> Draw.MolToImage(core).show()
> Draw.MolToImage(pieces[0]).show()
> Draw.MolToImage(pieces[1]).show()
> Draw.MolToImage(newMol).show()
> print(Chem.MolToSmiles(newMol))
>
> I tried using all canonicalized smiles. I worked for 'O=S(=O)O' which is
> not canonicalized one.
> If I put 'O=[SH](=O)O', it works. But it's not what I wanted. The tail of
> H(hydrogen) tags along the S atom.
> I tried [S-] instead [SH], but it is also not what I expected. S in the
> result of 'combine' function has a negative charge. Can you suggest
> something?
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to