Re: [Rdkit-discuss] Forcing depiction to match input mol block

2022-03-23 Thread Greg Landrum
Hi Adam,

By default the RDKit picks the locations to do wedging. There's no built-in
function to reapply the wedging from an input mol file (we probably should
add this), but you can find a good one here, as part of the ChEMBL
structure pipeline:
https://github.com/chembl/ChEMBL_Structure_Pipeline/blob/master/chembl_structure_pipeline/standardizer.py#L469

-greg


On Tue, Mar 22, 2022 at 11:01 AM Ádám Baróthi 
wrote:

> Hello Everyone,
>
> I'm having some trouble trying to depict molecules the exact same way as
> the input mol block (V2000) was drawn. My main problem is that I've drawn
> in a wedge bond between atoms 1 and 7 (the right hand side of the
> cyclopropyl ring), and RDKit depicts the molecule with a wedge bond between
> atoms 0 and 1 (the left hand side of the cyclohexane ring).
>
> Google colab showing the difference between the structures
> 
>
> Is there a way to force the depiction to match the input exactly without
> having to set the bond types manually?
>
> Molecule in question:
>
>   ACCLDraw0310522D
>
>  11 12  0  0  1  0  0  0  0  0999 V2000
>15.0356   -8.97260. C   0  0  0  0  0  0  0  0  0  0  0  0
>16.0593   -8.38150. C   0  0  2  0  0  0  0  0  0  0  0  0
>17.0831   -8.97260. C   0  0  0  0  0  0  0  0  0  0  0  0
>17.0831  -10.15470. C   0  0  0  0  0  0  0  0  0  0  0  0
>16.0593  -10.74570. C   0  0  2  0  0  0  0  0  0  0  0  0
>15.0356  -10.15470. C   0  0  0  0  0  0  0  0  0  0  0  0
>16.0593  -11.92690. N   0  0  0  0  0  0  0  0  0  0  0  0
>16.6510   -7.35670. C   0  0  3  0  0  0  0  0  0  0  0  0
>15.4680   -7.35670. C   0  0  0  0  0  0  0  0  0  0  0  0
>17.6738   -6.76620. C   0  0  0  0  0  0  0  0  0  0  0  0
>18.6967   -7.35670. O   0  0  0  0  0  0  0  0  0  0  0  0
>   1  2  1  0  0  0  0
>   2  3  1  0  0  0  0
>   3  4  1  0  0  0  0
>   4  5  1  0  0  0  0
>   5  6  1  0  0  0  0
>   1  6  1  0  0  0  0
>   5  7  1  1  0  0  0
>   2  8  1  1  0  0  0
>   8  9  1  0  0  0  0
>   2  9  1  0  0  0  0
>   8 10  1  0  0  0  0
>  10 11  1  0  0  0  0
> M  END
>
> Best,
> Adam
> ___
> 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


[Rdkit-discuss] 2D drawing with template

2022-03-23 Thread Jean-Marc Nuzillard

Dear all,

The 2D structure drawing code

from rdkit import Chem
from rdkit.Chem import rdCoordGen

m = 
Chem.MolFromSmiles('CN1C[C@H]2[C@]3([C@@H]1C[C@@H](C=C3)OC)C4=CC5=C(C=C4[C@@H](O2)O)OCO5')

template = Chem.MolFromMolFile('template.mol')
params = rdCoordGen.CoordGenParams()
params.SetTemplateMol(template)
rdCoordGen.AddCoords(m, params)
writer = Chem.SDWriter('compound_2D.sdf')
writer.write(m)
writer.close()

with file template.mol containing

template.mol
  ChemDraw03232214592D

  9  9  0  0  1  0  0  0  0  0999 V2000
   -1.4289    0.8250    0. C   0  0  0  0  0  0  0  0  0  0 0  0
   -1.4289    0.    0. C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.7146   -0.4125    0. C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.0002    0.    0. C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.0002    0.8250    0. C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.7146    1.2375    0. C   0  0  0  0  0  0  0  0  0  0 0  0
    0.7141   -0.4125    0. C   0  0  0  0  0  0  0  0  0  0 0  0
    1.4289    0.    0. O   0  0  0  0  0  0  0  0  0  0 0  0
    0.7141   -1.2375    0. O   0  0  0  0  0  0  0  0  0  0 0  0
  1  2  2  0
  2  3  1  0
  3  4  2  0
  4  5  1  0
  5  6  2  0
  6  1  1  0
  4  7  1  0
  7  8  1  0
  7  9  1  0
M  END

The template looks like



in which the H in OH groups have been added to have a nice drawing
but are not part of the mol file.

The result in compound_2D.sdf is



as if no template were provided.
I succeeded already to obtain what I wanted with the same code
but for other molecules and templates.
I use rdkit version 2021.03.2 .

Can you reproduce that?
Is there a better way to do it?

Best,

Jean-Marc Nuzillard

--
Jean-Marc Nuzillard
Directeur de Recherches au CNRS

Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France

ORCID : -0002-5120-2556
Tel : +33 (0)3 26 91 82 10

http://www.univ-reims.fr/icmr
http://eos.univ-reims.fr/LSD/CSNteam.html

http://www.univ-reims.fr/LSD/
http://www.univ-reims.fr/LSD/JmnSoft/
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss