Hi Eric,
as I mentioned, I do not have access to ChemDraw, so I am afraid I can't
help more with that.
A possible workaround is to install OpenBabel in your conda environment
and use that to do a cdx->mol conversion. While it should be possible to
use the openbabel or pybel module, for some reason I couldn't get it
work, so in the example below I am calling the obabel.exe executable.
import subprocess
from rdkit import Chem
from rdkit.Chem.Draw import rdMolDraw2D
from IPython.display import SVG
RDKit WARNING: [17:45:59] Enabling RDKit 2019.09.1 jupyter extensions
proc = subprocess.Popen("obabel.exe -i cdx 1oit_2d.cdx -o mol".split(),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
rdk_mol = Chem.MolFromMolBlock(stdout.decode("UTF-8"))
drawer = rdMolDraw2D.MolDraw2DSVG(400, 400)
Chem.Kekulize(rdk_mol)
rdMolDraw2D.PrepareAndDrawMolecule(drawer, rdk_mol)
drawer.FinishDrawing()
svg = drawer.GetDrawingText()
SVG(svg)
This should allow you to easily automate the SVG (or PNG) generation
process.
HTH, cheers
p.
On 03/12/2019 15:08, Eric Murphy wrote:
Hi Paolo, all,
Thank you for responding. I tried this out this morning - though I
could not find chemdraw using the combrowser.
Instead I went to the registry editor grabbed the CLSID from
HKEY_CLASSES_ROOT\ChemDraw.Application.15.0\CLSID. (As far as I
understand this should be identical to the GUID) I replaced the GUID
in
\Local\Continuum\anaconda3\pkgs\rdkit-2019.09.1-py37h422b363_0\Lib\site-packages\rdkit\utils\chemdraw.py
- however, I'm not seeing any change in the error when I go to import
via "from rdkit.utils import chemdraw".
Please let me know if I am doing something wrong.
Regards,
Eric Murphy, PhD
On Tue, Dec 3, 2019 at 3:47 AM Paolo Tosco <paolo.tosco.m...@gmail.com
<mailto:paolo.tosco.m...@gmail.com>> wrote:
Hi Eric,
it looks like the GUID in rdkit/utils/chemdraw.py might be outdated.
Unfortunately I don't have access to ChemDraw, so I can't test
this myself, but you might be able to find the current ChemDraw
GUID as follows.
From a Python prompt, issue the following commands:
|fromwin32com.client importcombrowse combrowse.main()|
This will pop up a COM browser. Expand the "Registered Type
Libraries" and look for ChemDraw.
Expand it, and you should find the IID (which is a GUID)
corresponding to ChemDraw.
Try replacing 5F646AAB-3B56-48D2-904C-A68D7989C251 in
rdkit/utils/chemdraw.py and see if it helps.
Cheers,
p.
On 02/12/2019 21:04, Eric Murphy wrote:
Hello all,
I'm trying to make use of the rdkit.utils.chemdraw to automate
conversion of cdx files to png's. and other formats. However, I'm
getting the following error message: ImportError: ChemDraw
version (at least version 7) not found.
I'm currently using windows 10 with anaconda 3 with rdkit
2019.09.1 installed from conda forge. I do have chemdraw
professional 15.0 installed, so I am wondering if there is
anything that I need to do to the path, etc.
Regards,
Eric Murphy, PhD
Multiphase Flow Scientist
Mechanical Engineer
murphyericja...@gmail.com <mailto:murphyericja...@gmail.com> |
563-449-6661
LinkedIn <https://www.linkedin.com/in/eric-james-murphy/> |
ResearchGate
<https://www.researchgate.net/profile/Eric_Murphy5> | Google
Scholar
<https://scholar.google.com/citations?user=3Mu7770AAAAJ&hl=en>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
<mailto: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