# Open Source tools to draw a set of 2d molecular graphs from sdf file

I have a sdf file for around 50 small-molecules for which I am doing structure-activity study. I would like to draw 2d graphs of all the molecules such that the image would fit into a single journal page. For example, in this paper, page number 3, they have listed 2d molecular structure. I have attached the image file from the same paper. I have software tools like MarvinSketch which give me 2d or 3d graph for a given sdf file. But I want the integrated image like shown below suitable for publication.

An SDF file is just a bunch of MOL entries in a single file;  serves as the separator for the individual entries.

Splitting into individual files AND simultaneous conversion to graphic file formats (PNG, SVG) is possible with Open Babel, either directly on the command line or through scripts/programmes using the bindings available for various programming languages, such as Pybel for Python.

To my knowledge, the direct generation of PostScript files - probably the nicest option when using $\LaTeX$ - is not possible, so you might want to used SVG as an alternate vector-based format.

obabel -isdf lotsofstructures.sdf -m -osvg -xC -xu -xd -O basename.svg

will do the job.

-isdf specifies the input file format, -m does the splitting, -osvg specifies the output file format, and -O basename.svg specifies the prefix and extension for the individual numbered output files that are generated. -xC prevents that terminal carbon atoms are printed explicitly with attached hydrogen atoms. Surely a matter of taste, but I wouldn't want to have lots of $\ce{-CH3}$ in the drawings. -xu prevents the use of colour for heteroatoms and generates a black and white drawing. -xd suppressed the name of the compound to be written and displayed in the SVG file.

This should work for SDF files with 2D and 3D coordinates, but in the latter case I'd suggest to check it carefully; I've seen 3D -> 2D transformations on some molecules that went wrong.

• I don't think we have any interest in adding PDF or PS output, although there are a few svg2pdf utilities out there. – Geoff Hutchison Sep 15 '14 at 17:51
• Incidentally, if you find cases where 3D -> 2D does not work, please send an e-mail to the list or file a bug report. I'd like to see these and fix them. Thanks! – Geoff Hutchison Sep 15 '14 at 17:51

This looks like a combination of individual SDF images and some sort of Table editor. A program that can take your PNGs rendered from SDF files and create this table layout is $\LaTeX$, or perhaps plain $\TeX$ or (my favorite) ConTeXt.

You have a number of constraints: a) a free program that b) makes intricate tables and c) handles SDF images. You probably want it to be easy to use, as well.

I don't know of any single open source program that will simultaneously satisfy these conditions. There probably isn't one.

I know for sure that Mathematica can take care of b) and c). You can get it for \$100 if you are academic. But then you have to learn it.

The easiest way to make this is probably to render all of your images as graphics, and then lay everything out in Microsoft Excel or Word Table Editor, changing the column widths and grid lines to suit you. (But this is Microsoft Office, and is not open source, so again, b) and c) )

• Perhaps LibreOffice will work, and then you have a) b) and c). – Eric Brown May 30 '13 at 21:00
• given that you have each separate images, can you give me a brief outline how would you do this in LaTex? – DurgaDatta May 31 '13 at 5:39
• I would look into the makecell package and \includegraphics command. – Eric Brown May 31 '13 at 11:27

In addition to those listed in Wikipedia we have a product called "Chemistry Add-in for Microsoft Word"

As its name suggests it is designed to run inside Microsoft Word. It is Open Source, I am the lead developer in a team of 4 people who are actively involved with the design and coding.

System requirements are quite modest Windows 7+, Word 2010+, IE11+

PS: We have tried to get it listed on Wikipedia, but our edits get rejected as we "run" the project Our project home page is at https://www.chem4word.co.uk/

Check out this Wikipedia page which lists molecule editors, many of which are licensed under GNU GPL.

An inexpensive (50-60 USD) program for drawing chemical structures is Chemdoodle. Despite not being free, you get some user friendliness and features (like reaction building) for the cost.