<?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: Ruby and InChI: The Rino Library</title>
    <link>http://depth-first.com/articles/2006/08/17/ruby-and-inchi-the-rino-library</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <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>
