Thanks, Greg. Indeed, passing "kekulize=False" to MolsToGridImage works.

-P.

On Tue, Oct 11, 2016 at 1:56 AM, Greg Landrum <[email protected]>
wrote:

> HI Peter,
>
> On Tue, Oct 11, 2016 at 12:31 AM, Peter S. Shenkin <[email protected]>
> wrote:
>
>>
>> Please see the attached image for (1) and (2).
>>
>> 1. If I render a molecule via 'SVG(svg)', I get the dotted aromatic
>> representation.
>>
>
> A bit of clarification here, to help with the later answer.
> The key piece is where the SVG itself is generated: the call to
> drawer.DrawMolecule() in your render_mol() function.
>
>
>> 2. If I render it just by displaying 'MolFromSmiles(smi)', I get the
>> kekulized representation.
>>
>
> Here's the python code that does that generates that SVG (if you've
> configured SVG generation with IPythonConsole.ipython_useSVG):
> https://github.com/rdkit/rdkit/blob/master/rdkit/Chem/
> Draw/IPythonConsole.py#L132
> or the PNG  (the default):
> https://github.com/rdkit/rdkit/blob/master/rdkit/Chem/
> Draw/IPythonConsole.py#L103
> Notice the call to rdMolDraw2D.PrepareMolForDrawing() in each function.
> This does the kekulization.
>
>
> So I guessed that (for some reason) when SVG is used, RDKit automatically
>> uses the dotted representation.
>>
>> 3. However, if I display MolsToGridImage(mol, useSVG=True), I get the
>> kekulized form. (This method does not return an SVG, and therefore I cannot
>> display it using 'SVG(result)' ).
>>
>> So I have several questions:
>>
>> a. Is there a way to force MolsToGridImage to return the dotted aromatic
>> representation? Or to postprocess the result to achieve this?
>>
>>
> Try passing the "kekulize=False" argument to MolsToGridImage(). That
> should do it.
>
>
>> b. What is the underlying paradigm which dictates which representation
>> will be shown, and how can it be controlled?
>>
>
> By default the code kekulizes things before rendering them. You can change
> this default for normal molecule rendering in the notebook by setting
> IPythonConsole.kekulizeStructures to False. This doesn't currently impact
> what MolsToGridImage does, though it should.
>
>
>> c. What I would really like is the "circle" representation (i.e., benzene
>> as a hexagon with a circle inside). Can this be achieved, and if so, how?
>>
>
> Nope, not currently possible.
>
> -greg
>
>
>
>
>>
>> Thank you,
>> -P.
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Rdkit-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to