<?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 rino</title>
    <link>http://depth-first.com/articles/tag/rino</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>A Simple and Portable Ruby Interface to InChI</title>
      <description>&lt;p&gt;&lt;a href="http://ruby-lang.org"&gt;&lt;img src="http://depth-first.com/files/ruby_logo_new.gif" align="right"&gt;&lt;/img&gt;&lt;/a&gt;Although the &lt;a href="http://depth-first.com/articles/2007/09/27/inchi-for-newbies"&gt;InChI&lt;/a&gt; software itself is written in C, it can still be used via Ruby. &lt;a href="http://depth-first.com/articles/2007/03/19/customize-inchi-output-with-rino"&gt;Rino&lt;/a&gt; offers one implementation of a Ruby InChI interface that makes use of a C extension. This article describes a more concise and portable solution.&lt;/p&gt;

&lt;h4&gt;The Code&lt;/h4&gt;

&lt;p&gt;The following code will accept a String encoding a molfile and return either its InChI, or an empty String if no InChI could be found:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;module &lt;/span&gt;&lt;span class="module"&gt;InChI&lt;/span&gt;
  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;inchi_for&lt;/span&gt; &lt;span class="ident"&gt;molfile&lt;/span&gt;
    &lt;span class="ident"&gt;output&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;%x[&lt;/span&gt;&lt;span class="string"&gt;echo &amp;quot;&lt;span class="expr"&gt;#{molfile}&lt;/span&gt;&amp;quot; | cInChI-1 -STDIO&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;

    &lt;span class="ident"&gt;output&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;eql?&lt;/span&gt;&lt;span class="punct"&gt;(&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt; &lt;span class="punct"&gt;?&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="ident"&gt;output&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;split&lt;/span&gt;&lt;span class="punct"&gt;(/&lt;/span&gt;&lt;span class="regex"&gt;&lt;span class="escape"&gt;\n&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;/)[&lt;/span&gt;&lt;span class="number"&gt;1&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This code takes advantage of Ruby's built-in support for &lt;a href="http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#UA"&gt;Command Expansion&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Testing the Code&lt;/h4&gt;

&lt;p&gt;The code below tests the library:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;inchi&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;include&lt;/span&gt; &lt;span class="constant"&gt;InChI&lt;/span&gt;

&lt;span class="ident"&gt;molfile&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt;
&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;http://chempedia.com/compounds/106.mol
  -OEChem-03010811072D

 12 12  0     0  0  0  0  0  0999 V2000
    2.8660    1.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.0000    0.5000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    3.7321    0.5000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.0000   -0.5000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    3.7321   -0.5000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.8660   -1.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.8660    1.6200    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    1.4631    0.8100    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    4.2690    0.8100    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    1.4631   -0.8100    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    4.2690   -0.8100    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    2.8660   -1.6200    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0  0  0  0
  1  3  1  0  0  0  0
  1  7  1  0  0  0  0
  2  4  1  0  0  0  0
  2  8  1  0  0  0  0
  3  5  2  0  0  0  0
  3  9  1  0  0  0  0
  4  6  2  0  0  0  0
  4 10  1  0  0  0  0
  5  6  1  0  0  0  0
  5 11  1  0  0  0  0
  6 12  1  0  0  0  0
M  END&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Found InChI: &lt;span class="expr"&gt;#{inchi_for(molfile)}&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We can run the test by saving it in a file called &lt;strong&gt;test.rb&lt;/strong&gt; and executing it:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ ruby test.rb
InChI version 1, Software version 1.02-beta August 2007
Log file not specified. Using standard error output.
Input file not specified. Using standard input.
Output file not specified. Using standard output.
Options: Mobile H Perception ON
Isotopic ON, Absolute Stereo ON
Omit undefined/unknown stereogenic centers and bonds
Full Aux. info
Input format: MOLfile
Output format: Plain text
Timeout per structure: 60.000 sec; Up to 1024 atoms per structure
End of file detected after structure #1.
Finished processing 1 structure: 0 errors, processing time 0:00:00.00
Found InChI: InChI=1/C6H6/c1-2-4-6-5-3-1/h1-6H
&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;Prerequisites&lt;/h4&gt;

&lt;p&gt;The above approach only requires that it be run on a UNIX-like system, and that a copy of the InChI library be present on your path.&lt;/p&gt;

&lt;h4&gt;Advantages&lt;/h4&gt;

&lt;p&gt;The approach described here offers some important advantages over Rino:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It works without modification on both the &lt;a href="http://en.wikipedia.org/wiki/Ruby_MRI"&gt;Matz Ruby Interpreter&lt;/a&gt; (C-Ruby) and &lt;a href="http://jruby.codehaus.org/"&gt;JRuby&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It neither creates nor uses files.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Disadvantages&lt;/h4&gt;

&lt;p&gt;This approach creates a lot of noisy log output to the console. There must be a way to suppress it, but so far I haven't found out how.&lt;/p&gt;

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

&lt;p&gt;Using Ruby's support for Command Expansions has enabled the creation of a concise and portable Ruby interface to the InChI toolkit. Similar principles would apply to any Unix command-line binary, including for example, &lt;a href="http://openbabel.org/wiki/Babel"&gt;Open Babel&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Thu, 29 May 2008 12:12:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:a79f3191-e044-4db5-8676-38f97fcaeedf</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/05/29/a-simple-and-portable-ruby-interface-to-inchi</link>
      <category>Tools</category>
      <category>ruby</category>
      <category>inchi</category>
      <category>rino</category>
      <category>commandexpansion</category>
    </item>
    <item>
      <title>Customize InChI Output with Rino</title>
      <description>&lt;p&gt;&lt;a href="http://rubyforge.org/projects/rino"&gt;Rino&lt;/a&gt; is a toolkit for working with the &lt;a href="http://en.wikipedia.org/wiki/International_Chemical_Identifier"&gt;IUPAC International Chemical Identifier&lt;/a&gt; (InChI) in Ruby. Because it's based on the IUPAC/NIST InChI toolkit, Rino can be configured using a variety of useful options. This article summarizes those options and provides an illustrative example.&lt;/p&gt;

&lt;h4&gt;Complete List of InChI Command Line Options&lt;/h4&gt;

&lt;p&gt;The following is a complete summary of the IUPAC/NIST InChI toolkit command line options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SNon&lt;/strong&gt; Exclude stereo (Default: Include Absolute stereo)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SRel&lt;/strong&gt; Relative stereo&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SRac&lt;/strong&gt; Racemic stereo&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SUCF&lt;/strong&gt; Use Chiral Flag: On means Absolute stereo, Off - Relative&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SUU&lt;/strong&gt; Include omitted unknown/undefined stereo&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NEWPS&lt;/strong&gt; Narrow end of wedge points to stereocenter (default: both)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SPXYZ&lt;/strong&gt; Include Phosphines Stereochemistry&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SAsXYZ&lt;/strong&gt; Include Arsines Stereochemistry&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RecMet&lt;/strong&gt; Include reconnected metals results&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;FixedH&lt;/strong&gt; Mobile H Perception Off (Default: On)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AuxNone&lt;/strong&gt; Omit auxiliary information (default: Include)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NoADP&lt;/strong&gt; Disable Aggressive Deprotonation (for testing only)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compress&lt;/strong&gt; Compressed output&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DoNotAddH&lt;/strong&gt; Don't add H according to usual valences: all H are explicit&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wnumber&lt;/strong&gt; Set time-out per structure in seconds; W0 means unlimited&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SDF:DataHeader&lt;/strong&gt; Read from the input SDfile the ID under this DataHeader&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NoLabels&lt;/strong&gt; Omit structure number, DataHeader and ID from InChI output&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tabbed&lt;/strong&gt; Separate structure number, InChI, and AuxIndo with tabs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OutputSDF&lt;/strong&gt; Convert InChI created with default aux. info to SDfile&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;InChI2InChI&lt;/strong&gt; Convert InChI string into InChI string for validation purposes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SdfAtomsDT&lt;/strong&gt; Output Hydrogen Isotopes to SDfile as Atoms D and T&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;STDIO&lt;/strong&gt; Use standard input/output streams&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;FB&lt;/strong&gt; (or FixSp3Bug) Fix bug leading to missing or undefined sp3 parity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WarnOnEmptyStructure&lt;/strong&gt; Warn and produce empty InChI for empty structure&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;A Test&lt;/h4&gt;

&lt;p&gt;The following code displays the InChI for benzoic acid with and without mobile hydrogen atom perception. It requires both &lt;a href="http://depth-first.com/articles/tag/rino"&gt;Rino&lt;/a&gt; and &lt;a href="http://depth-first.com/articles/tag/rcdk"&gt;Ruby CDK&lt;/a&gt;. The latter library is used to convert a SMILES string into a molfile for use by Rino.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rcdk&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rino&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rcdk/util&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;molfile&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt;&lt;span class="constant"&gt;RCDK&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Util&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Lang&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;smiles_to_molfile&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;c1ccccc1C(=O)O&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="comment"&gt;# benzoic acid&lt;/span&gt;
&lt;span class="ident"&gt;reader&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Rino&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;MolfileReader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;
&lt;span class="ident"&gt;inchi&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;read&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;molfile&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;

&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Without mobile hydrogen perception:&lt;span class="escape"&gt;\n&lt;/span&gt;&lt;span class="expr"&gt;#{inchi}&lt;/span&gt;&lt;span class="escape"&gt;\n\n&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;options&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;-FixedH&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;inchi&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;read&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;molfile&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;

&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;With mobile hydrogen perception:&lt;span class="escape"&gt;\n&lt;/span&gt;&lt;span class="expr"&gt;#{inchi}&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;tt&gt;-FixedH&lt;/tt&gt; flag used by the reader the second time tells Rino to identify mobile hydrogens in the InChI output. Some InChI authors use this form of InChI and others don't. PubChem is an example of a large InChI author that does use mobile hydrogen perception, as their entry for &lt;a href="http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=243"&gt;benzoic acid&lt;/a&gt; demonstrates. To perform an exact match of your InChIs with theirs, the &lt;tt&gt;-FixedH&lt;/tt&gt; flag must be set.&lt;/p&gt;

&lt;h4&gt;Running the Test&lt;/h4&gt;

&lt;p&gt;Running the test code produces the following output:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
Without mobile hydrogen perception:
InChI=1/C7H6O2/c8-7(9)6-4-2-1-3-5-6/h1-5H,(H,8,9)

With mobile hydrogen perception:
InChI=1/C7H6O2/c8-7(9)6-4-2-1-3-5-6/h1-5H,(H,8,9)/f/h8H
&lt;/pre&gt;
&lt;/div&gt;

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

&lt;p&gt;When matching InChIs generated by other authors, it's best to adopt their processing conventions. Rino makes it conventient to do so through its full support for the standard IUPAC/NIST command line options.&lt;/p&gt;</description>
      <pubDate>Mon, 19 Mar 2007 10:30:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:1975ab63-5e0e-4ef7-9227-46b1fb0f0939</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2007/03/19/customize-inchi-output-with-rino</link>
      <category>Tools</category>
      <category>rino</category>
      <category>inchi</category>
      <category>pubchem</category>
      <category>commandline</category>
    </item>
    <item>
      <title>Anatomy of a Cheminformatics Web Application: InChIMatic</title>
      <description>&lt;p&gt;&lt;a href="http://rubyonrails.org"&gt;&lt;img src="http://depth-first.com/files/rails_logo.png" align="right" border="0"&gt;&lt;/img&gt;&lt;/a&gt;&lt;a href="http://www.iupac.org/inchi/"&gt;InChI&lt;/a&gt; is an open molecular identifier system. Although InChIs obviate the need for a central registration authority, they are complex enough that they must be generated by computer. Currently, a few desktop molecular editors can generate InChI identifiers. But wouldn't it be more convenient if this capability existed in a simple Web application that could be used from any computer - anywhere? This article describes a Web application called "InChIMatic", which does just that.&lt;/p&gt;

&lt;p&gt;In this article, I'll show how &lt;a href="http://www.molinspiration.com/jme/"&gt;Java Molecular Editor&lt;/a&gt; (JME), a lightweight 2-D structure editor, can be extended to produce InChI identifiers through &lt;em&gt;server-side&lt;/em&gt; software written in Ruby, rather than by extending the applet with Java code.&lt;/p&gt;

&lt;h4&gt;Downloads and Prerequisites&lt;/h4&gt;

&lt;p&gt;InChIMatic requires &lt;a href="http://rubyonrails.org"&gt;Ruby on Rails&lt;/a&gt; and the &lt;a href="http://depth-first.com/articles/2006/08/17/ruby-and-inchi-the-rino-library"&gt;Rino InChI toolkit&lt;/a&gt;. Both of these libraries can be installed using the &lt;a href="http://rubygems.org/"&gt;RubyGems&lt;/a&gt; packaging system.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://rubyforge.org/frs/download.php/15616/inchimatic-0.0.2.tar.gz"&gt;complete InChIMatic source package&lt;/a&gt; can be downloaded from RubyForge. For convenience, a copy of JME is included with the distribution. The author, Peter Ertl, has kindly given permission for the bundled JME applet to be used with InChIMatic. For other uses, consult the &lt;a href="http://www.molinspiration.com/jme/"&gt;JME homepage&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Running InChIMatic&lt;/h4&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ cd inchimatic-0.0.2
$ ruby script/server
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Pointing your browser to &lt;a href="http://localhost:3000/inchi/input"&gt;http://localhost:3000/inchi/input&lt;/a&gt;, drawing a structure in the JME window, and pressing the "InChI!" button will produce the corresponding InChI in the area below.&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20061214/screenshot_1.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;h4&gt;Behind the Scenes&lt;/h4&gt;

&lt;p&gt;The JME applet itself provides no capabilities for generating InChI identifiers. This functionality is instead provided by the Rails server via the Rino InChI library.&lt;/p&gt;

&lt;p&gt;Let's say Susan wants to get the InChI for 3,4-dichlorophenol. After entering the structure into the JME window, she presses the "InChI!" button. This sets in motion the following sequence of events:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The JavaScript function &lt;tt&gt;writeMolfile()&lt;/tt&gt; is called. This retrieves a molfile representation of 3,4-dichlorophenol from JME, which is then written to to the hidden field &lt;tt&gt;molfile&lt;/tt&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A Rails listener notices that the hidden text field has been updated and so invokes the InChIMatic &lt;tt&gt;ajax_inchi&lt;/tt&gt; action. This is a Rails Ajax action that will update only a portion of the InChIMatic window. For more detail on this Rails Ajax technique, see &lt;a href="http://depth-first.com/articles/2006/12/04/anatomy-of-a-cheminformatics-web-application-ajaxifying-depict"&gt;the previous Anatomy of a Cheminformatics Web Application&lt;/a&gt; article.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;tt&gt;ajax_inchi&lt;/tt&gt; action retrieves the contents of the hidden &lt;tt&gt;molfile&lt;/tt&gt; field. This molfile is then used to generate an InChI using Rino. This InChI is then saved to the instance variable &lt;tt&gt;inchi&lt;/tt&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The contents of the InChIMatic area partitioned by the &lt;tt&gt;results&lt;/tt&gt; &lt;tt&gt;div&lt;/tt&gt; are then updated with the InChI obtained in Step 3. The JME applet itself is unaffected by this operation, allowing Susan to further elaborate her molecule, if she'd like.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;So What? Re-Thinking the Role of Applets&lt;/h4&gt;

&lt;p&gt;JME is, by itself, incapable of generating InChIs. Yet InChIMatic provides this capability as if it existed natively. In other words, a lightweight, fast-loading, and responsive 2-D editor can be extended &lt;em&gt;on the server side&lt;/em&gt;, rather than on the client side. The difference is imperceptible to the user, but ripe with potential for the developer.&lt;/p&gt;

&lt;p&gt;One of the most common, and completely valid, complaints about Java applets is that they take too long to load. Offloading some of the functionality currently being bundled in applets onto a Web server offers one way to combat the problem. Furthermore, combining Java applets with Ajax and powerful Web application frameworks like Ruby on Rails offers virtually limitless opportunities to re-think the role of Java applets in Web application development.&lt;/p&gt;

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

&lt;p&gt;JME's strength comes, perhaps ironically, from its limited functionality. By using some simple Web programming techniques, JME can be extended with server-side programming. The advantages, compared to extending the JME applet itself with Java on the client side, are significant. Future articles in this series will explore some of the possibilities.&lt;/p&gt;</description>
      <pubDate>Fri, 15 Dec 2006 15:49:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:4ff346b0-7cec-4b8e-9770-feccfe683823</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/12/15/anatomy-of-a-cheminformatics-web-application-inchimatic</link>
      <category>Web</category>
      <category>jme</category>
      <category>inchimatic</category>
      <category>inchi</category>
      <category>rino</category>
      <category>java</category>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Looking at InChIs</title>
      <description>&lt;p&gt;InChI identifiers can be viewed both as unique molecular keys and as a language encoding molecular structure. With the right software, it is possible to decode any InChI to arrive at a human-readable molecular structure. This tutorial will show how to convert InChI identifiers into 2-D molecular renderings using open source tools.&lt;/p&gt;

&lt;h4&gt;Prerequisites&lt;/h4&gt;

&lt;p&gt;The InChI to 2-D image conversion process requires two pieces of software:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://depth-first.com/articles/2006/09/19/decoding-inchis-with-rino"&gt;Rino&lt;/a&gt; decodes InChI identifiers into molfiles. The resulting atomic coordinates are set to zero.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://depth-first.com/articles/2006/09/25/cdk-the-ruby-way-rcdk-0-2-0"&gt;RCDK&lt;/a&gt; assigns coordinates to the molfile produced by Rino, and renders the result.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Bring on the Code&lt;/h4&gt;

&lt;p&gt;The following Ruby code illustrates how the InChI for the pesticide fipronil (Regent) can be translated into a PNG image:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rino&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rcdk&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;util&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;inchi&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;InChI=1/C12H4Cl2F6N4OS/c13-5-1-4(11(15,16)17)2-6(14)8(5)24-10(22)9(7(3-21)23-24)26(25)12(18,19)20/h1-2H,22H2&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="comment"&gt;#fipronil&lt;/span&gt;
&lt;span class="ident"&gt;reader&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Rino&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;InChIReader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;
&lt;span class="ident"&gt;molfile1&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;read&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;inchi&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="comment"&gt;# lacks 2-D atomic coordinates&lt;/span&gt;
&lt;span class="ident"&gt;molfile2&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;RCDK&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Util&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;XY&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;coordinate_molfile&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;molfile1&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="comment"&gt;# has 2-D atomic coordinates&lt;/span&gt;

&lt;span class="constant"&gt;RCDK&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Util&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Image&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;molfile_to_png&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;molfile2&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;fipronil.png&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="number"&gt;350&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="number"&gt;300&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Running this code produces the image &lt;strong&gt;fipronil.png&lt;/strong&gt; in your working directory:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20060926/fipronil.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;h4&gt;Limitations&lt;/h4&gt;

&lt;p&gt;The technique illustrated here is subject to the same limitations as the underlying software. For Rino, this means that stereochemistry is ignored. For RCDK, this means that implicit hydrogen atoms, isotopes, and charges are omitted, and that layout of macrocycles and other complex ring systems may not subjectively appear very refined.&lt;/p&gt;

&lt;h4&gt;Other Software that Does This&lt;/h4&gt;

&lt;p&gt;To my knowledge, only one other Open Source package, &lt;a href="http://bkchem.zirael.org/inchi_en.html"&gt;BKChem&lt;/a&gt;, is capable of rendering InChIs as described here. BKChem's underlying InChI translation and depiction software, OASA, can also be &lt;a href="http://inchi.info/converter_en.html"&gt;accessed online&lt;/a&gt;. For comparison, OASA produces the following image for for the fipronil InChI:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20060926/fipronil_bkchem.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://pubchem.ncbi.nlm.nih.gov/edit/"&gt;PubChem editor&lt;/a&gt; can also translate and render InChIs, but no source code appears to be available. PubChem's InChI translation and rendering output for fipronil is:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20060926/fipronil_pubchem.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://cdk.sf.net"&gt;The Chemistry Development Kit&lt;/a&gt;, on which RCDK is based, was recently upgraded to support reading InChI identifiers. For some time, CDK has been able to generate 2-D atomic coordinates.&lt;/p&gt;

&lt;p&gt;More information on InChI software can be found at Beda Kosata's &lt;a href="http://inchi.info/index.html"&gt;InChI.info&lt;/a&gt; site.&lt;/p&gt;

&lt;h4&gt;The Final Word&lt;/h4&gt;

&lt;p&gt;Within certain limitations, it is quite feasible to programatically obtain a 2-D molecular image for any InChI identifier. Combining this capability with other chemical informatics software and services offers numerous possibilities to use InChI in innovative ways.&lt;/p&gt;</description>
      <pubDate>Tue, 26 Sep 2006 14:35:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:a6f32cae-5226-4b4d-9ab6-6ecd0a788c40</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/09/26/looking-at-inchis</link>
      <category>Graphics</category>
      <category>inchi</category>
      <category>rcdk</category>
      <category>rino</category>
      <category>depict</category>
      <category>2d</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Decoding InChIs with Rino</title>
      <description>&lt;p&gt;&lt;a href="http://wwmm.ch.cam.ac.uk/inchifaq/"&gt;InChI identifiers&lt;/a&gt; are unique, ASCII-based molecular identifiers well-suited for chemical informatics on the Web. But they are also much more than that. Encoded in every InChI is all of the information needed to reconstruct a valid, machine-readable molecular representation. This tutorial shows how Open Source tools can be used to construct a molfile representation from an InChI identifier with the help of new features in the &lt;a href="http://depth-first.com/articles/2006/08/17/ruby-and-inchi-the-rino-library"&gt;Rino&lt;/a&gt; toolkit for Ruby. The ability of Rino to &lt;a href="http://depth-first.com/articles/2006/08/17/ruby-and-inchi-the-rino-library"&gt;produce InChI identifiers&lt;/a&gt; from molfile input has already been discussed.&lt;/p&gt;

&lt;h4&gt;Credits&lt;/h4&gt;

&lt;p&gt;What follows was in part inspired by &lt;a href="http://sourceforge.net/mailarchive/forum.php?thread_id=30378782&amp;amp;forum_id=45166"&gt;helpful comments&lt;/a&gt; posted by Sam Adams, author of the &lt;a href="http://sourceforge.net/projects/jni-inchi"&gt;JNI InChI Wrapper&lt;/a&gt;, and Dmitrii Tchekhovskoi, co-author of the InChI software.&lt;/p&gt;

&lt;h4&gt;A Demo with cInChI&lt;/h4&gt;

&lt;p&gt;The newest release of the IUPAC &lt;a href="http://www.iupac.org/inchi/"&gt;InChI-API&lt;/a&gt; toolkit can now translate an InChI identifier into a molfile. This consists of a two-step process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Convert a simple InChI into a full InChI with Auxiliary Information (AuxInfo).&lt;/li&gt;
&lt;li&gt;Convert the full InChI into a molfile.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can get a feel for how this process works by using the cInChI command-line program. Create a file called &lt;strong&gt;test.txt&lt;/strong&gt; containing the following InChI (for benzene):&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;InChI=1/C6H6/c1-2-4-6-5-3-1/h1-6H&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

Now, run cInChI:

&lt;div class="console"&gt;
&lt;pre&gt;
$ touch temp.txt
$ ./cInChI-1 test.txt temp.txt -InChI2Struct
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The first line creates an empty temporary file, &lt;strong&gt;temp.txt&lt;/strong&gt;. Into this file is written the full InChI as output. The &lt;tt&gt;-InChI2Struct&lt;/tt&gt; parameter tells InChI to generate an InChI with Auxiliary Information.&lt;/p&gt;

&lt;p&gt;Now, create an empty file, &lt;strong&gt;benzene.mol&lt;/strong&gt; and run cInChI with the &lt;strong&gt;-OutputSDF&lt;/strong&gt; option:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ touch benzene.mol
$ ./cInChI-1 temp.txt benzene.mol -OutputSDF
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If everything worked, you should now have a molfile called &lt;strong&gt;benzene.mol&lt;/strong&gt;, describing benzene, in your working directory. All atom coordinates will be zero, because coordinate generation is outside the scope of the InChI project. This has important implications or stereochemistry (see below). Of course, &lt;a href="http://depth-first.com/articles/2006/09/02/humanizing-line-notations"&gt;other free libraries&lt;/a&gt; can generate aesthetically-pleasing 2-D molecular coordinates.&lt;/p&gt;

&lt;h4&gt;Hello, Rino&lt;/h4&gt;

&lt;p&gt;&lt;a href="http://rubyforge.org/projects/rino"&gt;Rino&lt;/a&gt; is a thin Ruby wrapper around the InChI-API toolkit, which is written in C. An &lt;a href="http://depth-first.com/articles/2006/09/16/taking-a-swig-of-inchi"&gt;earlier article&lt;/a&gt; described the use of the automatic wrapper generator &lt;a href="http://www.swig.org/"&gt;SWIG&lt;/a&gt; to write the C glue code that Rino interfaces with. The current version of Rino (v0.2.0) uses this approach to Ruby interface generation.&lt;/p&gt;

&lt;p&gt;The current version of Rino can conveniently be installed by executing the following (as root):&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
# gem install rino
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Earlier today, I got "404 Not Found" errors for this command, but not recently. The source is not clear, but seems to occur within the 24 hours after the Gem is uploaded. If you run into problems, the Rino RubyGem can also be &lt;a href="http://rubyforge.org/frs/download.php/13261/rino-0.2.0.gem"&gt;downloaded&lt;/a&gt; and installed locally.&lt;/p&gt;

&lt;p&gt;If you've already installed Rino-0.1.0, the new version can happily cohabitate with it. &lt;a href="http://www.rubygems.org/"&gt;RubyGems&lt;/a&gt; by default installs the most recent version of Rino unless you specify otherwise. If you'd like to uninstall Rino-0.1.0 do the following (as root):&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
# gem uninstall rino
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You should get a menu of Rino version to uninstall.&lt;/p&gt;

&lt;h4&gt;A Ruby Demo&lt;/h4&gt;

&lt;p&gt;The following Ruby code demonstrates the use of Rino to translate an InChI identifier into a molfile:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rino&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;inchi&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;InChI=1/C6H6/c1-2-4-6-5-3-1/h1-6H&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="comment"&gt;# benzene&lt;/span&gt;
&lt;span class="ident"&gt;reader&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Rino&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;InChIReader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;
&lt;span class="ident"&gt;molfile&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;read&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;inchi&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;

&lt;span class="ident"&gt;p&lt;/span&gt; &lt;span class="ident"&gt;molfile&lt;/span&gt; &lt;span class="comment"&gt;# =&amp;gt; prints the molfile for benzene&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you'd like even more control, you can directly access the InChI &lt;tt&gt;run&lt;/tt&gt; method, which provides all of the capabilities of running cInChI from the command line:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rino&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;input&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;input.txt&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;   &lt;span class="comment"&gt;# a valid file in your working dir&lt;/span&gt;
&lt;span class="ident"&gt;output&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;output.txt&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="comment"&gt;# also a valid file&lt;/span&gt;

&lt;span class="constant"&gt;Rino&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;InChI&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;run&lt;/span&gt;&lt;span class="punct"&gt;(['&lt;/span&gt;&lt;span class="string"&gt;&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="ident"&gt;input&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="ident"&gt;output&lt;/span&gt;&lt;span class="punct"&gt;])&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4&gt;Limitations&lt;/h4&gt;

&lt;p&gt;The InChI-&gt;molfile implementation in the InChI-API toolkit does not reproduce stereochemical information. For example, passing an InChI of a molecule containing a single tetrahedral stereocenter results in a molfile lacking stereo parities. Further, an explicit hydrogen atom is added to the sterogenic atom in the molfile output. Being based entirely on the InChI-API, Rino inherits these behaviors.&lt;/p&gt;

&lt;p&gt;Rino is based on a very simple interface into InChI's &lt;tt&gt;main&lt;/tt&gt; method. This has the advantage that anything that can be done with the cInChI command line application can also be done with Rino. It carries the disadvantage that the convenience classes &lt;tt&gt;InChIReader&lt;/tt&gt; and &lt;tt&gt;MolfileReader&lt;/tt&gt; use a less than elegant system of temporary disk files for input-output. Future versions of Rino should address this issue, a task that may be simplified by SWIG.&lt;/p&gt;

&lt;h4&gt;Other InChI Parsers&lt;/h4&gt;

&lt;p&gt;To my knowledge, three Open Source InChI parsers, besides the InChI-API and Rino, exist. They are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://sourceforge.net/projects/ninja"&gt;Ninja&lt;/a&gt;. A Java library that performs low-level InChI parsing, and is designed as a platform for more sophisticated parsers. While it does not create molfiles from InChIs, it can be used as a foundation for software that does. Ninja is used in the molecular language framework, &lt;a href="http://sf.net/projects/rxf"&gt;Rosetta&lt;/a&gt;, although this work is far from complete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://bkchem.zirael.org/"&gt;BKChem&lt;/a&gt;. Beda Kosata's 2-D structure editor, which is written in Python. The similarities between Ruby and Python make this codebase a potentially useful starting point for a pure Ruby InChI parser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://sourceforge.net/projects/jni-inchi"&gt;JNI InChI Wrapper&lt;/a&gt;. Also a wrapper for the InChI-API. When used in combination with the &lt;a href="http://cdk.sf.net"&gt;Chemistry Development Kit&lt;/a&gt;, this package &lt;a href="http://sourceforge.net/mailarchive/forum.php?thread_id=30378782&amp;amp;forum_id=45166"&gt;has been reported&lt;/a&gt; to produce molfiles from InChI identifiers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More information on InChI software capabilities can be found at Beda Kosata's &lt;a href="http://inchi.info/software_en.html"&gt;InChI info&lt;/a&gt; site.&lt;/p&gt;

&lt;h4&gt;Wrapping Up&lt;/h4&gt;

&lt;p&gt;The translation of InChI identifiers into other molecular representation systems will become more important as InChI gains traction. Mashups involving InChI translation offer many tantalizing opportunities for innovative chemical informatics applications. Future articles will discuss some of them.&lt;/p&gt;</description>
      <pubDate>Tue, 19 Sep 2006 14:07:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:06562883-8d50-45d0-aadd-2db459acd21a</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/09/19/decoding-inchis-with-rino</link>
      <category>Tools</category>
      <category>inchi</category>
      <category>rino</category>
    </item>
    <item>
      <title>Ruby and InChI: The Rino Library</title>
      <description>&lt;p&gt;Rino is a Ruby libraryfor generating InChI identifiers. Currently, molfile input is supported. The following code illustrates basic usage.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;reader&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Rino&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;MolfileReader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;
&lt;span class="ident"&gt;inchi&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;read&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="constant"&gt;IO&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;Read&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;some_molfile.mol&lt;/span&gt;&lt;span class="punct"&gt;'))&lt;/span&gt;

&lt;span class="ident"&gt;puts&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;The identifier is: &lt;span class="expr"&gt;#{inchi}&lt;/span&gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;RDoc documentation can be viewed online &lt;a href="http://depth-first.com/doc/rino"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Rino was implemented as an extension of the &lt;a href="http://www.iupac.org/inchi/"&gt;IUPAC InChI library&lt;/a&gt;, which is written in C. To keep the extension as simple as possible, Rino's point of entry into the IUPAC library is the inchi_main main method. File input is provided with temporary files that are deleted when a MolfileReader is garbage collected. This has the advantage that all options available to the IUPAC InChI console application are also available from within Rino. For example, activating compressed InChI output can be done by simply appending the option to a MolfileReader's options array.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;reader&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;options&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;-Compress&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Rino is available as both a Ruby Gem and as a source package from &lt;a href="http://rubyforge.org/projects/rino"&gt;RubyForge&lt;/a&gt;. If you're new to Ruby, the RubyGems package is recommended. After &lt;a href="http://docs.rubygems.org/read/chapter/3"&gt;installing RubyGems&lt;/a&gt;, Rino can be installed with the following shell command (executed as root):&lt;/p&gt;

&lt;div class="console"&gt;gem install rino&lt;/div&gt;

&lt;p&gt;To load Rino, simply execute the following code prior to creating a MolfileReader.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require_gem&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rino&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The use of the &lt;a href="http://www.chemruby.org"&gt;Chemruby&lt;/a&gt; library in combination with Rino offers some interesting possibilites for chemical infomatics with Ruby.&lt;/p&gt;</description>
      <pubDate>Thu, 17 Aug 2006 07:02:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:59844c6f-e1e8-40d6-8aef-692bc45af1b2</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/08/17/ruby-and-inchi-the-rino-library</link>
      <category>Tools</category>
      <category>rino</category>
      <category>ruby</category>
      <category>inchi</category>
    </item>
  </channel>
</rss>
