<?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: Cheminformatics for Ruby: Getting Started with Rubidium</title>
    <link>http://depth-first.com/articles/2007/11/06/cheminformatics-for-ruby-getting-started-with-rubidium</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Cheminformatics for Ruby: Getting Started with Rubidium</title>
      <description>&lt;p&gt;&lt;a href="http://rbtk.rubyforge.org"&gt;&lt;img src="http://depth-first.com/demo/20071015/rubidium.png" align="right"  border="0"&gt;&lt;/img&gt;&lt;/a&gt;
Cheminformatics has seen the introduction of a diverse array of new open source software over the last few years. Using it all to its fullest potential is not always easy; differing languages, dependencies, interfaces, and varying levels of documentation make the job especially difficult. &lt;a href="http://rbtk.rubyforge.org"&gt;Rubidium&lt;/a&gt; is a new open source project aimed at changing that.&lt;/p&gt;

&lt;p&gt;Rubidium is a full-featured cheminformatics scripting environment for Ruby. When complete, Rubidium will offer a single well-tested and well-documented Ruby interface to the best open source cheminformatics software. Rubidium-0.1.0 is now available for download.&lt;/p&gt;

&lt;h4&gt;Downloading and Installing Rubidium&lt;/h4&gt;

&lt;p&gt;Rubidium runs on &lt;a href="http://jruby.codehaus.org"&gt;JRuby&lt;/a&gt;, a pure Java implementation of the Ruby language. After &lt;a href="http://jruby.codehaus.org/The+JRuby+Tutorial+Part+1+-+Getting+Started"&gt;installing JRuby on your system&lt;/a&gt;, you should be ready to install Rubidium.&lt;/p&gt;

&lt;p&gt;Installation is most conveniently done with the Ruby package manager &lt;a href="http://rubygems.org/"&gt;RubyGems&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Rubidium RubyGem can be &lt;a href="http://rubyforge.org/frs/download.php/27580/rbtk-0.1.0-jruby.gem"&gt;downloaded from RubyForge&lt;/a&gt; (large file). The &lt;tt&gt;gem&lt;/tt&gt; command is all we need:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ ll rbtk-0.1.0-jruby.gem
-rw-r--r-- 1 rich rich 12955136 Nov  6 07:56 rbtk-0.1.0-jruby.gem
$ jruby -S gem install rbtk-0.1.0.gem
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Note: at the time of this writing, my installation of JRuby 1.0.1 was reporting an out of memory error when attempting to use the RubyForge RubyGems repository directly. Downloading Gems separately and then installing the local copy is a workaround.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Rubidium can be tested with the following code run in interactive JRuby (jirb):&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ jirb
irb(main):001:0&gt; require 'rubygems'
=&gt; true
irb(main):002:0&gt; gem 'rbtk'
=&gt; true
irb(main):003:0&gt; require 'rubidium/lang'
=&gt; true
irb(main):004:0&gt; c=Rubidium::Converter.new
=&gt; #&amp;lt;Rubidium::Converter:0xbd4e3c ... &amp;gt;
irb(main):005:0&gt; c.set_formats 'smi', 'mol'
=&gt; true
irb(main):006:0&gt; c.convert 'c1ccccc1'
=&gt; "\n  CDK    11/6/07,8:41\n\n  6  6  0  0  0  0  0  0  0  0999 V2000\n    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n  2  1  2  0  0  0  0 \n  3  2  1  0  0  0  0 \n  4  3  2  0  0  0  0 \n  5  4  1  0  0  0  0 \n  6  5  2  0  0  0  0 \n  6  1  1  0  0  0  0 \nM  END\n"
&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;Low-Level Interface&lt;/h4&gt;

&lt;p&gt;There's not much yet to Rubidium itself beyond molecular language interconversions offered by the &lt;a href="http://cdk.sf.net"&gt;Chemistry Development Kit&lt;/a&gt; (CDK). But the CDK offers a wide range of cheminformatics functionality that is immediately accessible in raw form via JRuby itself. For example, we can calculate the TPSA of oxazepam:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ jirb
irb(main):001:0&gt; require 'rubygems'
=&gt; true
irb(main):002:0&gt; gem 'rbtk'
=&gt; true
irb(main):003:0&gt; require 'cdk/lang'
=&gt; true
irb(main):004:0&gt; import 'org.openscience.cdk.qsar.descriptors.molecular.TPSADescriptor'
=&gt; ["org.openscience.cdk.qsar.descriptors.molecular.TPSADescriptor"]
irb(main):005:0&gt; reader=CDK::SmilesReader.new
=&gt; #&amp;lt;CDK::SmilesReader:0x1088a1b ... &amp;gt; 
irb(main):006:0&gt; mol=reader.read 'O=C3Nc1ccc(Cl)cc1C(c2ccccc2)=NC3O'
=&gt; #&amp;lt;Java::OrgOpenscienceCdk::Molecule:0x174f02c ... &amp;gt;
irb(main):007:0&gt; tpsa = TPSADescriptor.new
=&gt; #&amp;lt;Java::OrgOpenscienceCdkQsarDescriptorsMolecular::TPSADescriptor:0x14596d5 ...&amp;gt;
irb(main):008:0&gt; result = tpsa.calculate mol
=&gt; #&amp;lt;Java::OrgOpenscienceCdkQsar::DescriptorValue:0x171120a ..&amp;gt;
irb(main):009:0&gt; result.value.double_value
=&gt; 61.69
&lt;/pre&gt;
&lt;/div&gt;

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

&lt;p&gt;There's much more to be done with Rubidium. As more software packages and their Ruby interfaces are added, a major challenge will be to maintain a simple yet powerful interface to the underlying capabilities.&lt;/p&gt;</description>
      <pubDate>Tue, 06 Nov 2007 11:17:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:049b9b9c-456d-4d7e-992b-5e4776d183c8</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2007/11/06/cheminformatics-for-ruby-getting-started-with-rubidium</link>
      <category>Tools</category>
      <category>rubidium</category>
      <category>ruby</category>
      <category>java</category>
    </item>
  </channel>
</rss>
