HI Markus,

On Tue, Mar 7, 2017 at 7:00 PM, Markus Metz <metm...@gmail.com> wrote:

> I am wondering if it is possible to depict 2D structures as ball and stick.
> I have some very simple fragments and I would like to use them for axis
> annotation in a heatmap.
> Currently I generate the png files via MolToFile and read them in again.
> Changing size did not help.
> I also tried to generate the molecules on the fly.
> But so far I am getting only 2D pictures which are not readable. I hope to
> resolve this issue by picking another representation such as ball and stick.
> Does anybody have a suggestion how I might change the molecular
> representation?
> As always I very much appreciate any input somebody may have.

Are you trying to get broader lines in the drawings and circles around the
atoms so that they are more visible or are you looking for something else?

One thing you might try is abusing the current code for handling highlights:

from rdkit.Chem import Draw
from IPython.display import SVG
def DrawCartoonMol(mol):
    from rdkit.Chem.Draw.MolDrawing import DrawingOptions
    ecolors = DrawingOptions.elemDict
    d2 = Draw.MolDraw2DSVG(200,200)
    dopts = d2.drawOptions()

    hcolors = {}
    for at in m2.GetAtoms():
        hcolors[at.GetIdx()] = ecolors.get(at.GetAtomicNum(),(0,0,0))

    return d2.GetDrawingText().replace('svg:','')

This produces output like this:
[image: Inline image 1]
It's currently producing SVG, but you could also get PNG out of it.

Not perfect, but it's at least a start.

Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
Rdkit-discuss mailing list

Reply via email to