Dear RDkit team,

I started to use RDkit package quite recently first to draw 2D models for a
large set of molecules using a python script. My script is finally working
but I am still trying to make some improvements in the styling of figures.
Specifically, I am applying the highlight function of RDkit on some special
bonds (or atoms) in order to get something similar to the examples I have
found on the RDkit blog (
http://rdkit.blogspot.com/search?updated-max=2018-10-16T20:10:00-07:00&max-results=2).
However, in the figures created with my script the bonds are highlighted
with red colors only instead of applying the alpha transparency as in the
blog's examples. I followed essentially the same procedure as described in
the examples with the exception that I am exporting the images as png
rather than SVG. Does anyone know how to reproduce the highlighting bonds
with transparency shown in the RDkit blog? This could be a problem related
to the version of the RDkit I am using (the most recent one)?

I will be grateful for any comment or suggestion that can help me to solve
this.

Follow below the main lines of the python script I am using to create the
images.

labels = np.genfromtxt('./smiles.dat', unpack=True, usecols=0,
skip_header=1, dtype=str)
data = np.genfromtxt('./smiles.dat', skip_header=1, usecols=1, dtype=str)

mols = [Chem.MolFromSmiles(smiles) for smiles in data]

heavy_atoms = []
for m in mols:
  idx = []
  for atom in m.GetAtoms():
   n = atom.GetIdx()
   if ( m.GetAtomWithIdx(n).GetIsAromatic() == True):
      idx.append(atom.GetIdx())
  heavy_atoms.append(idx)

opt = Draw.DrawingOptions()
#opt.bgColor = None
opt.bondLineWidth = 1.80
opt.clearBackground=False

img=Draw.MolsToGridImage(mols[:60],molsPerRow=5,subImgSize=(400,150),highlightAtomLists=heavy_atoms,
                         options=opt,legends=[x for x in labels[:60]])
img.save('test_grid.png')
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to