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.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
   -1.4289    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.7146   -0.4125    0.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.0002    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.0002    0.8250    0.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
   -0.7146    1.2375    0.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
    0.7141   -0.4125    0.0000 C   0  0  0  0  0  0  0  0  0  0 0  0
    1.4289    0.0000    0.0000 O   0  0  0  0  0  0  0  0  0  0 0  0
    0.7141   -1.2375    0.0000 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 : 0000-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

Reply via email to