<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Depth-First: Tag canonicalsmiles</title>
    <link>http://depth-first.com/articles/tag/canonicalsmiles</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Run Babel Anywhere Java Runs with JBabel</title>
      <description>&lt;p&gt;&lt;a href="http://openbabel.sf.net"&gt;&lt;img src="http://depth-first.com/files/Babel256.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;A &lt;a href="http://depth-first.com/articles/tag/nestedvm"&gt;recent series of D-F articles&lt;/a&gt; have discussed the use of &lt;a href="http://nestedvm.ibex.org/"&gt;NestedVM&lt;/a&gt; to compile cheminformatics programs written in C/C++ to pure java binaries that can be run on any system with a JVM. More specifically, an attempt to compile &lt;a href="http://openbabel.sf.net"&gt;OpenBabel's&lt;/a&gt; &lt;tt&gt;babel&lt;/tt&gt; program to bytecode was only &lt;a href="http://depth-first.com/articles/2007/11/26/compiling-open-babel-to-pure-java-bytecode-with-nestedvm-building-a-runnable-classfile-that-almost-works"&gt;partially successful&lt;/a&gt;. With the &lt;a href="http://sourceforge.net/mailarchive/forum.php?thread_name=819391.60947.qm%40web34201.mail.mud.yahoo.com&amp;amp;forum_name=openbabel-discuss"&gt;help of Geoff Hutchison&lt;/a&gt;, the problem was resolved. This article introduces JBabel, a platform-independent, pure Java implementation of OpenBabel's &lt;tt&gt;babel&lt;/tt&gt; program.&lt;/p&gt;

&lt;h4&gt;A Little About JBabel&lt;/h4&gt;

&lt;p&gt;JBabel was compiled from the &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=40728&amp;amp;package_id=32894&amp;amp;release_id=521581"&gt;Open Babel 2.1.1 source release&lt;/a&gt; and can be &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=144794&amp;amp;package_id=255103"&gt;downloaded from SourceForge&lt;/a&gt;. The same jarfile was successfully tested on Linux, Windows and Mac OS X. You can verify JBabel works on your platform with the following command:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ java -jar jbabel-20071209.jar -Hsmi
smi  SMILES format
A linear text format which can describe the connectivity
and chirality of a molecule
Write Options e.g. -xt
  n no molecule name
  t molecule name only
  r radicals lower case eg ethyl is Cc
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This version of JBabel was compiled with support for three formats:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SMILES (smi). Non-canonical SMILES.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MDL (mol). Molfiles and SD Files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Canonical SMILES (can). Canonical SMILES implementation &lt;a href="http://depth-first.com/articles/2006/11/06/stone-soup"&gt;donated by eMolecules&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'll discuss exactly how support for these formats was added in a subsequent post. More formats will be added in the future. For now, let's just try JBabel out.&lt;/p&gt;

&lt;h4&gt;Testing JBabel&lt;/h4&gt;

&lt;p&gt;One way to use JBabel is interactively from the command line - just leave out an input or output file parameter. For example, if you wanted to get the eMolecules canonical SMILES for &lt;a href="http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=68617"&gt;sertraline&lt;/a&gt;, you might do something like this (be sure to use two returns to begin processing):&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ java -jar jbabel-20071209.jar -ismi -ocan
CN[C@H]1CC[C@H](C2=CC=CC=C12)C3=CC(=C(C=C3)Cl)Cl

CN[C@H]1CC[C@H](c2ccc(Cl)c(Cl)c2)c2ccccc12
1 molecule converted
34 audit log messages
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This canonical SMILES can be converted into a molfile with the following:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ java -jar jbabel-20071209.jar -ismi -omol
CN[C@H]1CC[C@H](c2ccc(Cl)c(Cl)c2)c2ccccc12


 OpenBabel12090723182D

 22 24  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0

...
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To convert using input and output files, we could use a medium-sized dataset such as the &lt;a href="http://rubyforge.org/frs/download.php/27768/pubchem_benzodiazepine_20071110.sdf.gz"&gt;PubChem benzodiazepine dataset&lt;/a&gt; prepared for &lt;a href="http://rbtk.rubyforge.org/"&gt;Rubidium&lt;/a&gt;:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ java -jar jbabel-20071209.jar -imol pubchem_benzodiazepine_20071110.sdf -ocan pubchem_benzodiazepine_20071110.smi
==============================
*** Open Babel Warning  in ReadMolecule
  WARNING: Problems reading a MDL file
Cannot read title line

2117 molecules converted
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This test, which parses 2117 records, required four minutes forty-five seconds on my system. For comparison, the natively compiled binary did the same thing in about thirteen seconds. Clearly, the JBabel performance hit is substantial.&lt;/p&gt;

&lt;h4&gt;Uses&lt;/h4&gt;

&lt;p&gt;Although it's very unlikely that JBabel will ever be useful in performance-critical situations, its portability makes it attractive for other uses. Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;application development in heterogeneous computing environments;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;use on systems in which native compilation may be difficult, such as those with unusual configurations or operating systems;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cases in which native binaries work poorly or not at all, such as in applets and Java applications;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;situations in which performance is a minor consideration, such as in end-user applications that process only a few molecules at a time, or during application prototyping&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Conclusions&lt;/h4&gt;

&lt;p&gt;This article has described JBabel, the first portable binary version of OpenBabel's &lt;tt&gt;babel&lt;/tt&gt; molecular file format interconversion program. The next article in this series will describe in detail the steps that were used to compile it.&lt;/p&gt;</description>
      <pubDate>Mon, 10 Dec 2007 08:50:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5d98a980-e3d6-4afd-8eb3-25769a28d13b</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2007/12/10/run-babel-anywhere-java-runs-with-jbabel</link>
      <category>Tools</category>
      <category>jbabel</category>
      <category>babel</category>
      <category>openbabel</category>
      <category>nestedvm</category>
      <category>molfile</category>
      <category>canonicalsmiles</category>
      <category>smiles</category>
    </item>
  </channel>
</rss>
