Re: [Rdkit-discuss] rdMolDraw2D drawing code
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Greg L. <gre...@gm...> - 2016-09-08 15:22:59
|
On Tue, Sep 6, 2016 at 10:00 PM, Dimitri Maziuk <dm...@bm...> wrote: > 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. > > Pull requests with documentation tweaks/corrections are always welcome. > > 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. > Yes, the layout will always be different when you are using different atoms. ;-) 2D depictions of non-trivial molecules that include H atoms have a tendency to be pretty crowded. This makes them a challenge for the coordinate generation algorithm. This is an example of that. I'm not sure that there's a good general solution, or if it's worth investing the time in trying to find one given that this is something of a special case. > > 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 > > ------------------------------------------------------------ > ------------------ > > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > |