Re: [Rdkit-discuss] Plotting values next to atoms

2018-11-05 Thread Francois Berenger

On 03/11/2018 04:27, Greg Landrum wrote:

Hi Eric,

On Fri, Nov 2, 2018 at 2:00 PM Eric Jonas  wrote:


Hello! I'm trying to figure out if there's any known or sane way to
automatically plot numerical values adjacent to atoms using the
rdkit drawing machinery. Ideally I'd like to annotate certain atoms
programmatically with values. I think the conventional way this is
done for publication is post-hoc editing in illustrator but it would
be great if there was an automatic or supported mechanism.


Hi Eric,

One hackish way is to export your molecules in 3D in the PDB format.
Then shove your numeric value into the B-factor field.
Then, color your molecules by B-factor using your favorite viewer 
(Chimera, pymol, etc.).
For this to work correctly, you may have to scale your values so that 
they become in the same

range than B-factors.

Wit a little programming, you could also export your molecules (in 3D, 
still) directly
as balls in the BILD format of UCSF Chimera, and look at them into 
Chimera.


https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/bild.html

Regards,
Francois.


Doing this correctly is on the list of high-priority things to do, and
I really hope to have something done for the 2019.03 release, but
there's no way I can guarantee that (it's a hard problem).

In the meantime, there's a way to at least do something that is,
hopefully, better than nothing:
https://gist.github.com/greglandrum/8cf8ecc3253abf0a5139a776a5095163
[1]

displayed here:
https://nbviewer.jupyter.org/gist/greglandrum/8cf8ecc3253abf0a5139a776a5095163
[2]


Links:
--
[1] 
https://gist.github.com/greglandrum/8cf8ecc3253abf0a5139a776a5095163

[2]
https://nbviewer.jupyter.org/gist/greglandrum/8cf8ecc3253abf0a5139a776a5095163

___
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


Re: [Rdkit-discuss] Docs intentionally broken?

2018-11-05 Thread Greg Landrum
The change from epydoc to sphinx/autodoc for the python documentation led
to some URL changes (most of which I fixed with redirects) and some missing
modules. Looks like the rdGeometry module is missing. I will see if I can
add it back, but this may take a bit since I'm traveling this week and the
beginning of next.


-greg


On Mon, Nov 5, 2018 at 1:23 PM Brian Cole  wrote:

> My google search for 'rdkit python point3d' yielded the following as the
> top result:
>
> https://rdkit.org/docs/api/rdkit.Geometry.rdGeometry-module.html
>
> Which unfortunately now has a 404, page not found.
>
> Was this an intentional reorganization of the documentation?
>
> -Brian
> ___
> 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


[Rdkit-discuss] Docs intentionally broken?

2018-11-05 Thread Brian Cole
My google search for 'rdkit python point3d' yielded the following as the
top result:

https://rdkit.org/docs/api/rdkit.Geometry.rdGeometry-module.html

Which unfortunately now has a 404, page not found.

Was this an intentional reorganization of the documentation?

-Brian
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] How to increase the quality of image by Draw.MolToImage ?

2018-11-05 Thread Noki Lee
Hi, rdkit-discuss

I'm looking for a way to increase the quality of image made by
Draw.MolToImage.

Here is my function, but its bonds and atom labels look like up-and-down
slightly.
I don't use IPython, then are there other options?

def draw_img(smiles):
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import MolDrawing, DrawingOptions
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid

m = Chem.MolFromSmiles(smiles)
AllChem.Compute2DCoords(m)
mHs = AllChem.AddHs(Chem.Mol(m))
m_idx = Chem.Mol(m)
mHs_idx = Chem.Mol(mHs)
for mol in [m, m_idx, mHs, mHs_idx]:
AllChem.GenerateDepictionMatching2DStructure(mol, m)
img_m = Draw.MolToImage(m, size=(800, 400), fitImage=True)
img_m_idx = Draw.MolToImage(m_idx, size=(800, 400), fitImage=True,
includeAtomNumbers=True)
img_mHs = Draw.MolToImage(mHs, size=(800, 400), fitImage=True)
img_mHs_idx = Draw.MolToImage(mHs_idx, size=(800, 400),
fitImage=True, includeAtomNumbers=True)
imgs = [img_m, img_m_idx, img_mHs, img_mHs_idx]
fig = plt.figure(1, (8, 8))
grid = ImageGrid(fig, 111, # similar to subplot(111)
 nrows_ncols=(2, 2), # creates 2x2 grid of axes
 axes_pad=0.1 # pad between axes in inch.
 )
for i in range(4):
grid[i].imshow(imgs[i])  # The AxesGrid object work as a list of axes.

plt.show()

smiles = 'COc1ccc2[nH]c(nc2c1)S(=O)Cc3ncc(C)c(OC)c3C'
draw_img(smiles)

Also, I need the function which can close the presented image. The
functions from RDkit seem not to support that.

Best,
Noki
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss