Hi Thomas,

I don't know if there's a direct working option to show the carbons symbol.
You might consider showing the symbols manually:

from rdkit import Chem
from IPython.display import SVG
from rdkit.Chem.Draw import IPythonConsole, rdMolDraw2D

mol = Chem.MolFromSmiles('c1cccnc1OCCCNC(=N)N')
drawer = rdMolDraw2D.MolDraw2DSVG(400,200)
opts = drawer.drawOptions()
for i in range(mol.GetNumAtoms()):
    atom = m.GetAtomWithIdx(i)
    if atom.GetSymbol() == 'C':
        imp_num = atom.GetNumImplicitHs()
        if imp_num > 1:
            imp_label = 'H' + str(imp_num)
        elif imp_num == 1:
            imp_label = 'H'
        else:
            imp_label = ''
        opts.atomLabels[i] = atom.GetSymbol() + imp_label
drawer.DrawMolecule(m)
drawer.FinishDrawing()
svg = drawer.GetDrawingText().replace('svg:','')
SVG(svg)

The following post might contain useful information:
http://rdkit.blogspot.com/2015/02/new-drawing-code.html
I hope this helps.
Best,
Omar

On Tue, Mar 2, 2021 at 10:49 PM Thomas <odioidenti...@gmail.com> wrote:

> Hi everybody,
>  I'm very new to rdkit, can anybody explain to me how to set drawing
> options?
> I wanted to do something easy like:
>
> MolToImage(mol, noCarbonSymbol=False)
>
> but apparently it is not the right way. Following some recipes i tried
> also with:
>
> drawer = rdMolDraw2D.MolDraw2DCairo(100, 100)
> drawer.drawOptions().noCarbonSymbols = False
>
> but again no luck. I tried also to modify the MolDrawOptions object
>
> options = drawer.drawOptions()
>
> but there is nothing about "noCarbonSymbol"...
>
> Can anybody address me on the right path? Much appreciated
> Thomas
> _______________________________________________
> 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