7
$\begingroup$

I have the following molecule in SMILE format (saved as my_molecule.smi):

[H]N[C@@H](CCCCN)C(=O)N[C@@H](CCCCN)C(=O)N[C@@H](C)C(=O)N[C@@H](CC1=CNC2=C1C=CC=C2)C(O)=O

I created an image using ChemAxon Marvin's molconvert command:

MarvinSuite/bin/molconvert "jpeg:w800:h800" my_molecule.smi -o mol.jpg

It produces the following image:

enter image description here

Then I use RDKit, with the following code:

from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
m = Chem.MolFromSmiles('[H]N[C@@H](CCCCN)C(=O)N[C@@H](CCCCN)C(=O)N[C@@H](C)C(=O)N[C@@H](CC1=CNC2=C1C=CC=C2)C(O)=O')
m

I get this image:

enter image description here

Notice that it is circular, and missing an H3C. With RDKit, how can I create the identical image with the one made by molconvert? i.e. straight format and H3C included.

Python code can be tried in my Google Colab.

$\endgroup$
2
  • 1
    $\begingroup$ I'm not sure why you care about a linear format. Is there actually a reason you want that? $\endgroup$ Oct 28 at 4:05
  • 1
    $\begingroup$ If you happen to speak JavaScript, SmilesDrawer might be an option for you, too. $\endgroup$
    – Buttonwood
    Oct 31 at 15:45
8
$\begingroup$

You're not going to get something identical. Different toolkits use different code to do 2D molecule layout. Generally the current RDKit code (which uses the CoordGen library) tends to prefer geometries closer to square, which is useful when drawing a bunch of molecules in a grid.

In short, I don't think there's anything you can do if you prefer an extended form and want RDKit to generate that.

Adding explicit methyl groups is pretty easy with recent RDKit (2020.03 and later), which adds new drawing options, e.g.

from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit.Chem import rdDepictor
rdDepictor.SetPreferCoordGen(True)
from rdkit.Chem.Draw import IPythonConsole
from IPython.display import SVG

m = Chem.MolFromSmiles('[H]N[C@@H](CCCCN)C(=O)N[C@@H](CCCCN)C(=O)N[C@@H](C)C(=O)N[C@@H](CC1=CNC2=C1C=CC=C2)C(O)=O')

d2d = rdMolDraw2D.MolDraw2DSVG(350,300)
d2d.drawOptions().explicitMethyl =True
d2d.DrawMolecule(m)
d2d.FinishDrawing()
SVG(d2d.GetDrawingText())

The options are documented for the rdMolDraw2D module

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.