Cyrus,

When you generate a PDF with the RDKit drawing code, it attempts to find
installed versions of cairo and aggdraw. If these both fail, then it uses
an old (and buggy) cross-platform drawing library called sping (which is
included with the RDKit). It looks like the problem you are having is due
to the use of sping.

The best (though certainly not painless) solution is to get cairo and a
python wrapper for it installed on your Mac. I would suggest getting cairo
with homebrew and then using pip to install cairocffi. From a bit of
googling, that seems to be an approach that works.

-greg


On Sat, May 16, 2015 at 7:58 PM, Cyrus Harmon <cyrushar...@gmail.com> wrote:

> So (now that I've gotten the basics working on MacOS) I have a little
> python program that generates an image from a SMILES string:
>
> #!/usr/bin/env python
> import argparse, sys
>
> from rdkit import Chem
> from rdkit.Chem import AllChem
> from rdkit.Chem import Draw
> from rdkit.Chem.Draw.MolDrawing import MolDrawing
> from rdkit.Chem.Draw.MolDrawing import DrawingOptions
>
> parser = argparse.ArgumentParser()
> parser.add_argument('-s', "--smiles", nargs='?', help="input smiles")
> parser.add_argument('-o', "--output", type=str, default=sys.stdout)
>
> args = parser.parse_args()
> smiles = args.smiles
> mol = AllChem.MolFromSmiles(smiles)
>
> options = DrawingOptions()
> options.atomLabelFontSize = 18
> options.atomLabelFontFace = "sans"
>
> Draw.MolToFile(mol,args.output,size=(300,300),options=options)
>
>
>
> Everything works as expected for PDF and PNG files:
>
> e.g.
>
> ./draw-test.py -s "N[C@@H](C(C)C)C(O)=O" -o ~/tmp/valine.pdf
>
> looks fine. But if I try that as a PDF, I get a big mess where the font
> size is enormous (>100 pt) and the glyph isn't placed right.
>
> This sounds similar to the problem described here:
> http://sourceforge.net/p/rdkit/mailman/message/26208338/
>
> although that seems to be some sort of Adobe problem.
>
> I've tried a similar example (a couple of weeks, on a slightly earlier
> version of Rdkit) on a different computer (running linux) and things look
> good. Perhaps this is once again some library installation/configuration
> issue, but I'm not sure what would be causing the problem.
>
> Any ideas?
>
> thanks,
>
> Cyrus
>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Rdkit-devel mailing list
> Rdkit-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-devel
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Rdkit-devel mailing list
Rdkit-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-devel

Reply via email to