Fun with Open Babel

Fun with Open Babel
04 October 2012 - The CRD

Last time on this blog's Chemical Reaction Database segment the absence of any InChi2svg tool was duly noted. But we have been looking the wrong way! Open Babel is an amazing chemical toolbox that can do lots of stuff, including (not InChi) but SMILES to svg conversion!.

Here is a quick summary of the installation procedure from the NNNS computer lab (server: x86_64 x86_64 x86_64 GNU/Linux centos Red Hat 4.1.2-48)
tar zxf openbabel-2.3.1.tar.gz
mkdir build
cd build
cmake ../openbabel-2.3.1
make install
whereis openbabel
openbabel: /usr/local/lib/openbabel
whereis obabel
obabel: /usr/local/bin/obabel

No complications whatsoever. This documentation gives you an overview of what is possible on the command line using the obabel tool.

For example, this command:

obabel -:"Cn1cnc2c1c(=O)n(c(=O)n2C)C" -:"n1c(c2c(nc1)ncn2)N" -ofpt
> Tanimoto from first mol = 0.4

gives you the similarity between caffeine and adenine as the Tanimoto coefficient.
Creating the .svg image is easy as well:

obabel -:"CN1C=NC2=C1C(=O)N(C(=O)N2C)C" -xu -O out.svg

svg image below (Firefox only):
CH 3 N N O N O N CH 3 H 3 C - OBDepict