Compiling structures to pdf-file (linux)

During my job-searching campaign I was once asked to show all the structures that I have synthesized. Drawing 200+ molecules seemed no fun to me. Even opening all .cdx files generated in 3.5 years, to copy-paste in a single one, was too boring. So I’ve used openbabel for this job.

Once I had all the .cdx in one folder I’ve ran

babel *.cdx allStruc.svg -xe -xl -xC
rsvg-convert -f pdf -o allStruc.pdf allStruc.svg

But the output was weird. All the charged molecules were assigned unrealistic charges over +2000, so all my potassium trifluoroborate and ammonium salts were crap.

Then I turned to molconvert tool from Chemaxon, which is free for academic non-commercial use. To convert all .cdx files to correct smiles I used a simple script:

#!/bin/bash
for i in $(ls -1 .|grep .cdx)
do
~/marvin/bin/molconvert smiles $i -o tmp.smi
cat tmp.smi >> smiles.smi
done

Followed by openbabel (I’ve decided to sort the molecules by molecular weight so the complexity will increase more or less steadily down the list):

babel smiles.smi allStruc.svg -xe -xl -xC --sort MW
rsvg-convert -f pdf -o allStruc.pdf allStruc.svg

Still, the conversion wasn’t ideal. Particularly, BF3¯ groups were represented as BF2·F¯. Fortunately, simple replacement of SMILES code ‘B(F)F’ to ‘[B-](F)(F)F’ and removal of extra fluoride (‘[F-].’ in SMILES) solved the problem.

So, here we go, the work of 3.5 years as almost square matrix 15×14:

The final result

Author: Slava Bernat

I did my PhD in medicinal chemistry/chemical biology of G protein-coupled receptors and then explored some chemical biology of non-coding RNA as a postdoc. Currently I'm working in a small biotech company in San-Francisco Bay area as a research chemist. I'm writing about science, which catches my attention in rss feed reader and some random thoughts or tutorials.

Leave a comment

breakingthemarket.com/

profiting from randomness

R-statistics blog

Statistics with R, and open source stuff (software, data, community)

Colorblind Chemistry

The blog of Marshall Brennan, PhD

ACS Careers Blog

Career advice from the American Chemical Society

Lab Without Benches

Career skills for scientists

amphoteros

forcing molecules to behave

Chemjobber

mostly science

Org Prep Daily

synthetic procedures I tried and liked

Sussex Drug Discovery Centre

Medicinal, Chemistry and Biochemistry blog from the Sussex Drug Discovery Centre

Practical Fragments

mostly science

Chemical connections

...chemistry & other curiosities

Just Like Cooking

mostly science