Package rdkit :: Package Chem :: Package Draw
[hide private]
[frames] | no frames]

Package Draw

source code

Submodules [hide private]

Functions [hide private]
 
_getCanvas() source code
 
_createCanvas(size) source code
 
MolToImage(mol, size=(300, 300), kekulize=True, wedgeBonds=True, fitImage=False, options=None, canvas=None, **kwargs)
Returns a PIL image containing a drawing of the molecule
source code
 
MolToFile(mol, fileName, size=(300, 300), kekulize=True, wedgeBonds=True, imageType=None, fitImage=False, options=None, **kwargs)
Generates a drawing of a molecule and writes it to a file...
source code
 
MolToImageFile(mol, filename, size=(300, 300), kekulize=True, wedgeBonds=True, **kwargs)
DEPRECATED: please use MolToFile instead
source code
 
ShowMol(mol, size=(300, 300), kekulize=True, wedgeBonds=True, title='RDKit Molecule', **kwargs)
Generates a picture of a molecule and displays it in a Tkinter window...
source code
 
MolToMPL(mol, size=(300, 300), kekulize=True, wedgeBonds=True, imageType=None, fitImage=False, options=None, **kwargs)
Generates a drawing of a molecule on a matplotlib canvas...
source code
 
calcAtomGaussians(mol, a=0.03, step=0.02, weights=None)
useful things to do with these: fig.axes[0].imshow(z,cmap=cm.gray,interpolation='bilinear',origin='lower',extent=(0,1,0,1)) fig.axes[0].contour(x,y,z,20,colors='k')
source code
 
MolsToImage(mols, subImgSize=(200, 200), legends=None, **kwargs) source code
 
_moltoimg(mol, sz, highlights, legend, **kwargs) source code
 
_MolsToGridImage(mols, molsPerRow=3, subImgSize=(200, 200), legends=None, highlightAtomLists=None, **kwargs)
returns a PIL Image of the grid...
source code
 
_MolsToGridSVG(mols, molsPerRow=3, subImgSize=(200, 200), legends=None, highlightAtomLists=None, stripSVGNamespace=True, **kwargs)
returns an SVG of the grid...
source code
 
MolsToGridImage(mols, molsPerRow=3, subImgSize=(200, 200), legends=None, highlightAtomLists=None, useSVG=False, **kwargs) source code
 
ReactionToImage(rxn, subImgSize=(200, 200), **kwargs) source code
 
MolToQPixmap(mol, size=(300, 300), kekulize=True, wedgeBonds=True, fitImage=False, options=None, **kwargs)
Generates a drawing of a molecule on a Qt QPixmap...
source code
Variables [hide private]
  tkRoot = None
hash(x)
  tkLabel = None
hash(x)
  tkPI = None
hash(x)
  __package__ = 'rdkit.Chem.Draw'

Imports: os, re, rdMolDraw2D, MolDrawing, DrawingOptions, iteritems, IntStringMap, MolDraw2D, MolDraw2DSVG, MolDrawOptions, PrepareMolForDrawing, map_indexing_suite_IntStringMap_entry


Function Details [hide private]

MolToImage(mol, size=(300, 300), kekulize=True, wedgeBonds=True, fitImage=False, options=None, canvas=None, **kwargs)

source code 
Returns a PIL image containing a drawing of the molecule

ARGUMENTS:

  - kekulize: run kekulization routine on input `mol` (default True)

  - size: final image size, in pixel (default (300,300))

  - wedgeBonds: draw wedge (stereo) bonds (default True)

  - highlightAtoms: list of atoms to highlight (default [])

  - highlightMap: dictionary of (atom, color) pairs (default None)

  - highlightBonds: list of bonds to highlight (default [])

  - highlightColor: RGB color as tuple (default [1, 0, 0])

NOTE:

      use 'matplotlib.colors.to_rgb()' to convert string and
      HTML color codes into the RGB tuple representation, eg.

        from matplotlib.colors import ColorConverter
        img = Draw.MolToImage(m, highlightAtoms=[1,2], highlightColor=ColorConverter().to_rgb('aqua'))
        img.save("molecule.png")

RETURNS:

  a PIL Image object

MolToFile(mol, fileName, size=(300, 300), kekulize=True, wedgeBonds=True, imageType=None, fitImage=False, options=None, **kwargs)

source code 
Generates a drawing of a molecule and writes it to a file
  

ShowMol(mol, size=(300, 300), kekulize=True, wedgeBonds=True, title='RDKit Molecule', **kwargs)

source code 
Generates a picture of a molecule and displays it in a Tkinter window
  

MolToMPL(mol, size=(300, 300), kekulize=True, wedgeBonds=True, imageType=None, fitImage=False, options=None, **kwargs)

source code 
Generates a drawing of a molecule on a matplotlib canvas
  

calcAtomGaussians(mol, a=0.03, step=0.02, weights=None)

source code 

useful things to do with these:
fig.axes[0].imshow(z,cmap=cm.gray,interpolation='bilinear',origin='lower',extent=(0,1,0,1))
fig.axes[0].contour(x,y,z,20,colors='k')

fig=Draw.MolToMPL(m);
contribs=Crippen.rdMolDescriptors._CalcCrippenContribs(m)
logps,mrs=zip(*contribs)
x,y,z=Draw.calcAtomGaussians(m,0.03,step=0.01,weights=logps)
fig.axes[0].imshow(z,cmap=cm.jet,interpolation='bilinear',origin='lower',extent=(0,1,0,1))
fig.axes[0].contour(x,y,z,20,colors='k',alpha=0.5)
fig.savefig('coumlogps.colored.png',bbox_inches='tight')


  

_MolsToGridImage(mols, molsPerRow=3, subImgSize=(200, 200), legends=None, highlightAtomLists=None, **kwargs)

source code 
returns a PIL Image of the grid
  

_MolsToGridSVG(mols, molsPerRow=3, subImgSize=(200, 200), legends=None, highlightAtomLists=None, stripSVGNamespace=True, **kwargs)

source code 
returns an SVG of the grid
  

MolToQPixmap(mol, size=(300, 300), kekulize=True, wedgeBonds=True, fitImage=False, options=None, **kwargs)

source code 
Generates a drawing of a molecule on a Qt QPixmap