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

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):


xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cml="http://www.xml-cml.org/schema" width="245.477" height="240" x="0" y="0" font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="1" stroke-linecap="round">




















CH
3
N
N
O
N
O
N
CH
3
H
3
C
x="10.000000" y="20.000000" >
- OBDepict