Re: [Rdkit-discuss] rdMolDraw2D drawing code
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Dimitri M. <dm...@bm...> - 2016-09-06 20:00:07
|
On 09/05/2016 03:47 AM, Greg Landrum wrote: > Dave's right about the font size: it's expressed in whatever coordinates > the molecule is being drawn in. I'd put Dave's explanation in the doc++ (?) comment on FontSize get/setter in MolDraw2D: http://www.rdkit.org/Python_Docs/rdkit.Chem.Draw.rdMolDraw2D.MolDraw2D-class.html Right now they just say "float". If you're dealing with SVG output, font sizes are px, em, and points, and you need a couple of tries to figure them out. It's a minor thing. > I suspect the other part of Dmitri's question is about the way bonds are > shortened so that they don't draw all the way through the atom labels. Yes, I think. It looks like there's more padding on the top and the right, and less padding on the left and bottom. E.g. H39 in the attached "all" version is the worst, but it is consistent in all 3. The other one on the "all" picture is that the bond to O21 isn't shortened enough and there isn't much room left between 021 and O24. OTOH all three labels: H38, O21, H39 could be drawn without even shortening the bonds if we could just move them up a little. (Well, H39 could be just drawn without shortening the bond at all.) Last but not least, my starting point is a 3D MOL file and I call rdkit.Chem.AllChem.Compute2DCoords( mh ) -- last thing before DrawMolecule(). Attached CID112084.svg is the one generated without AddHs(), notice how layout is very different on that one. I've a suspicion that that layout might look better with all the Hs and numbers added, than the one I get (the other 3 pictures). -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu |