<?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 webapplication</title>
    <link>http://depth-first.com/articles/tag/webapplication</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Building Chempedia: Start Simple, Then Iterate</title>
      <description>&lt;p&gt;&lt;a href="http://chempedia.com"&gt;&lt;img src="http://depth-first.com/demo/20080513/chempedia.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;As a medium for building software, the Web offers unparalleled adaptability. With nothing to download or install, users of Web applications automatically see the newest version - always. This may sound like a small thing, and technically it is. But it dramatically increases the effectiveness with which software can be created. &lt;a href="http://depth-first.com/articles/2008/04/28/building-chempedia-indexing-wikipedias-6-411-compound-monographs"&gt;The previous article in this series&lt;/a&gt; introduced &lt;a href="http://chempedia.com"&gt;Chempedia&lt;/a&gt;, the free Chemical encyclopedia and cheminformatics Web application. This article will discuss the process by which Chempedia will become a better service over time.&lt;/p&gt;

&lt;h4&gt;Iterative Web Application Development&lt;/h4&gt;

&lt;p&gt;Chempedia, like all actively-developed software, is a work in progress. It will be built in stages starting with the addition of new features, followed by a round of user feedback, bug fixing, and stabilization. This will then be followed by the next major iteration, and so on.&lt;/p&gt;

&lt;p&gt;This iterative design style is ideally suited for Web applications. Because the barrier to pushing out new versions is essentially non-existent, a Web application can evolve at a much more rapid rate than other kinds of software. Indeed, the first version of a Web application need only work well enough to prove a point.&lt;/p&gt;

&lt;p&gt;One of the keys to iterative Web development is a technology framework designed to facilitate it. Chempedia is being developed with &lt;a href="http://rubyonrails.com/"&gt;Ruby on Rails&lt;/a&gt;, a tool that enables Web developers to take full advantage of the iterative development style the Web makes possible.&lt;/p&gt;

&lt;p&gt;Another key element of iterative Web development is users willing to explore the system and offer criticism. Evolution succeeds only when the environment stresses an ecosystem; the same is true in Web application development.&lt;/p&gt;

&lt;p&gt;Chempedia will take full advantage of the evolutionary nature of Web application development. As features are added and (hopefully) use of the service grows, Chempedia will evolve in ways that are impossible to predict today.&lt;/p&gt;

&lt;h4&gt;What's Wrong With Chempedia?&lt;/h4&gt;

&lt;p&gt;If you happened to take a look at Chempedia last week (that version is now no longer visible), you probably noticed many, many things that needed improvement. Some concerns were in the areas of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Navigation. Navigation works best when the right granularity of options is achieved. Chempedia's navigation system grouped both closely-related and dissimilar actions at the same level.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Metaphor. The initial idea behind Chempedia was to see what happened when PubChem's chemical structures were mashed up with Wikiepia articles, using &lt;a href="http://depth-first.com/articles/2007/05/21/simple-cas-number-lookup-with-pubchem"&gt;CAS numbers&lt;/a&gt; as the common link. The site design reflected this, with no clear organizing principle other than mashup. However, after the initial demonstration of the success of this approach, it became clear that Chempedia was strikingly similar in both form and function to the &lt;a href="http://depth-first.com/articles/2008/04/28/building-chempedia-indexing-wikipedias-6-411-compound-monographs"&gt;Merck Index&lt;/a&gt;. Perhaps this should be used as a clue in deriving a better organizing principle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wikipedia integration. The old Chempedia site didn't make it nearly as convenient as is should be to create or edit compound monographs. Because Chempedia serves as a chemically-aware front-end for Wikipedia, the easier it is to get to Wikipedia from Chempedia, the better.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;What Changed?&lt;/h4&gt;

&lt;p&gt;During the process of trying to fix Chempedia's problems, it became clear that a major redesign was in order. This consisted of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Creating a landing page oriented toward search.&lt;/strong&gt; Using the Merck Index as a metaphor suggested that &lt;a href="http://chempedia.com"&gt;Chempedia's landing page&lt;/a&gt; should be designed around search, not browsing - as it was originally designed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Emphasizing compound monographs, not compounds.&lt;/strong&gt; Chempedia's central organizing principle is now the Compound Monograph. One way this is seen is in the new URL structure, which makes it very easy to see where a Chempedia link is about to take you. For example, consider the URL for &lt;a href="http://chempedia.com/monographs/benzene"&gt;benzene&lt;/a&gt;. Another way this can be seen is in the inclusion of &lt;a href="http://chempedia.com/monographs/virginiamycin"&gt;Compound Monographs lacking a chemical structure&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Designing a streamlined menu system.&lt;/strong&gt; The main menu system has been broken down into just three main categories: &lt;a href="http://chempedia.com/"&gt;Search&lt;/a&gt;; &lt;a href="http://chempedia.com/monographs"&gt;Browse&lt;/a&gt;; and &lt;a href="http://chempedia.com/monographs/new"&gt;Create&lt;/a&gt;. These headings refer to actions on Compound Monographs, again in line with their importance as an organizing principle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Promoting better integration with Wikipedia.&lt;/strong&gt; After experimenting with a few implementation possibilities, it is now possible to edit Wikipedia articles directly from the Chempedia site, thanks to the use of &lt;a href="http://en.wikipedia.org/wiki/IFrame"&gt;inline frame&lt;/a&gt;. Once again, this capability is tied to the Compound Monograph, from which editing and updating links are accessible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Striving for comprehensive Wikipedia coverage.&lt;/strong&gt; Wikipedia had far more compound monographs than could be found on Chempedia, &lt;a href="http://depth-first.com/articles/2008/04/28/building-chempedia-indexing-wikipedias-6-411-compound-monographs"&gt;6,411 of them&lt;/a&gt;, to be precise. Chempedia now contains all of them, regardless of whether a chemical structure can be found based on a CAS number in PubChem. This includes inorganics, organometallics, polymers, mixtures, and polypeptides.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Miles to Go Yet&lt;/h4&gt;

&lt;p&gt;Chempedia is far from being finished. For example, you'll notice many instances in which a Compound Monograph is &lt;a href="http://chempedia.com/monographs/parthenolide"&gt;truncated&lt;/a&gt;. This arises from difficulties in parsing Wikipedia's &lt;a href="http://en.wikipedia.org/wiki/Wikilink"&gt;Wikitext&lt;/a&gt; format (more on this later).&lt;/p&gt;

&lt;p&gt;Ultimately, the full text of each Wikipedia article will be present on Chempedia rather than just the first introductory paragraph. But it will take a significant amount of work to ensure that each article's Wikitext entry can be parsed faithfully.&lt;/p&gt;

&lt;p&gt;Chempedia allows search by CAS number, PubChem CID and exact title. Full-text searching is not yet implemented, nor is autocomplete search, both of which would greatly enhance the usability of the service.&lt;/p&gt;

&lt;p&gt;Exact structure searching is made possible by the &lt;a href="http://metamolecular.com/chemwriter"&gt;ChemWriter&lt;/a&gt; editor in combination with &lt;a href="http://en.wikipedia.org/wiki/SHA-1"&gt;SHA-1&lt;/a&gt; hashed &lt;a href="http://depth-first.com/articles/2007/09/27/inchi-for-newbies"&gt;InChIs&lt;/a&gt;. Substructure search and query atom search will ultimately be added, but for an encyclopedia containing relatively few molecules, most of which having trivial names, this isn't yet seen as being critical.&lt;/p&gt;

&lt;p&gt;You'll notice many Monographs on Chempedia that have no structure information. Behind the scenes, Chempedia uses the 350,000+ CAS numbers now contained in the &lt;a href="http://pubchem.ncbi.nlm.nih.gov/"&gt;PubChem&lt;/a&gt; database to associate a chemical structure with a Wikipedia article. In the future, these associations will be made by Chempedia and Wikipedia users, which will allow every Chempedia small-molecule Monograph to have a structure associated with it. (It will also create a rather large, publicly-curated, open database of CAS numbers linked to chemical structures, but that's a story for another time).&lt;/p&gt;

&lt;h4&gt;Your Feedback is Essential&lt;/h4&gt;

&lt;p&gt;Finally, many of the changes made in this iteration were the result of conversions with chemists and developers. If you see something on Chempedia that just doesn't work for you, please don't be shy about &lt;a href="http://chempedia.com/messages/new"&gt;saying so&lt;/a&gt;. Feedback is an essential ingredient in making Chempedia the best service it can be.&lt;/p&gt;</description>
      <pubDate>Tue, 13 May 2008 11:38:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:63df5614-92fb-4363-a060-212645be6315</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/05/13/building-chempedia-start-simple-then-iterate</link>
      <category>Meta</category>
      <category>chempedia</category>
      <category>evolution</category>
      <category>webapplication</category>
      <category>rails</category>
      <category>compoundmonograph</category>
      <category>merckindex</category>
      <category>iteration</category>
    </item>
    <item>
      <title>CampDepict: Building a Simple SMILES Depict Web Application With JRuby, Structure CDK, and Camping</title>
      <description>&lt;p&gt;&lt;a href="http://redhanded.hobix.com/bits/campingAMicroframework.html"&gt;&lt;img src="http://depth-first.com/demo/20080423/camping.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;Today's tribute to the power of simplicity comes by way of &lt;a href="http://goeslightly.blogspot.com/"&gt;John Jaeger&lt;/a&gt;, who has built one of the simplest cheminformatics Web applications ever written. His creation, &lt;a href="http://goeslightly.blogspot.com/2008/04/campdepict-jruby-cdk-and-camping.html"&gt;CampDepict&lt;/a&gt;, interactively produces a raster image of a 2D chemical structure given a SMILES string, not unlike &lt;a href="http://www.daylight.com/daycgi/depict"&gt;Daylight's Depict application&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;CampDepict uses the Ruby Web microframework &lt;a href="http://redhanded.hobix.com/bits/campingAMicroframework.html"&gt;Camping&lt;/a&gt;. From the &lt;a href="http://camping.rubyforge.org/files/README.html"&gt;README&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;Camping is a web framework which consistently stays at less than 4kb of code. You can probably view the complete source code on a single page. But, you know, it&#8216;s so small that, if you think about it, what can it really do?&lt;/p&gt;
    
    &lt;p&gt;The idea here is to store a complete fledgling web application in a single file like many small CGIs. But to organize it as a Model-View-Controller application like Rails does. You can then easily move it to Rails once you&#8216;ve got it going.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;John's application is loosely-based on the &lt;a href="http://depth-first.com/articles/2006/12/04/anatomy-of-a-cheminformatics-web-application-ajaxifying-depict"&gt;Rails Depict&lt;/a&gt; application first described in 2006 here on Depth-First. His code makes use of &lt;a href="http://cdk.sf.net"&gt;CDK&lt;/a&gt; and &lt;a href="http://sf.net/projects/structure"&gt;Structure CDK&lt;/a&gt;, and it runs on &lt;a href="http://jruby.codehaus.org/"&gt;JRuby&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you've ever been curious about what Ruby has to offer cheminformatics, CampDepict could be just the application to get your feet wet.&lt;/p&gt;</description>
      <pubDate>Wed, 23 Apr 2008 11:16:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b831ffb0-cb0a-46ed-aaa1-a5cddc2acfcf</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/04/23/campdepict-building-a-simple-smiles-depict-web-application-with-jruby-structure-cdk-and-camping</link>
      <category>Tools</category>
      <category>camping</category>
      <category>ruby</category>
      <category>jruby</category>
      <category>campdepict</category>
      <category>structurecdk</category>
      <category>cdk</category>
      <category>webapplication</category>
    </item>
    <item>
      <title>ChemWriter Now Available for Download</title>
      <description>&lt;p&gt;&lt;a href="http://metamolecular.com/products/chemwriter"&gt;&lt;img src="http://depth-first.com/demo/20080114/chemwriter_logo.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;A &lt;a href="http://depth-first.com/articles/2007/11/27/chemwriter-chemical-structures-and-the-web"&gt;2D chemical structure editor&lt;/a&gt; is a key component in most cheminformatics systems. With an ever-increasing number of groups using the Web as a cheminformatics platform, the need for a structure editor built specifically around the capabilities and constraints of the Web becomes more apparent.&lt;/p&gt;

&lt;p&gt;For the last several months, my company (&lt;a href="http://metamolecular.com"&gt;Metamolecular, LLC&lt;/a&gt;) has been developing a 2D structure editor called &lt;a href="http://metamolecular.com/products/chemwriter"&gt;ChemWriter(TM)&lt;/a&gt;. It was created specifically to solve the problem of building interactive, chemically-enabled Web applications that look good and load fast.&lt;/p&gt;

&lt;p&gt;You can now &lt;a href="http://metamolecular.com/downloads/"&gt;download&lt;/a&gt; a free, fully-functional, non-expiring copy of ChemWriter (the ChemWriter Starter Package) good for development and testing of your chemically-aware Web application. The Metamolecular Company Blog has &lt;a href="http://metamolecular.com/blog/2008/01/14/chemwriter-starter-package-now-available-for-download/"&gt;the details&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 14 Jan 2008 10:29:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f7887b33-8c9a-4042-940d-c8c705425054</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/01/14/chemwriter-now-available-for-download</link>
      <category>Tools</category>
      <category>chemwriter</category>
      <category>2d</category>
      <category>applet</category>
      <category>editor</category>
      <category>java</category>
      <category>metamolecular</category>
      <category>webapplication</category>
    </item>
    <item>
      <title>Build a Rails Cheminformatics Application in Thirty Minutes</title>
      <description>&lt;p&gt;&lt;a href="http://www.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;A &lt;a href="http://depth-first.com/articles/2006/11/20/unchaining-chemistry-from-the-desktop"&gt;recent article&lt;/a&gt; highlighted the Web as a new cheminformatics platform. Advocacy is one thing, but a working, open, demo built with modern technologies is far more compelling. In the following tutorial we'll build a first-generation cheminformatics Web application using the &lt;a href="http://www.rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; framework and 100% Open Source components. We'll just cover the essentials here - look for future articles to discuss the underlying technology in more detail.&lt;/p&gt;

&lt;h4&gt;The Problem&lt;/h4&gt;

&lt;p&gt;&lt;a href="http://www.daylight.com/smiles/index.html"&gt;Simplified Molecular Input Line Entry System&lt;/a&gt; (SMILES) is one of the most compact and easy-to-learn molecular representation systems ever developed. Part of a larger family of molecular languages called &lt;a href="http://depth-first.com/articles/2006/08/18/107-years-of-line-formula-notations-1861-1968"&gt;line notations&lt;/a&gt;, SMILES strings are always written as a single line of ASCII text. This makes them perfect in situations calling for data entry; witness their use in a wide range of new free &lt;a href="http://depth-first.com/articles/2006/11/07/twelve-free-chemistry-databases"&gt;online chemistry databases&lt;/a&gt;. This system typically works by a chemist drawing a structure in a graphical editor, copying a SMILES string from the editor, and pasting this string into a search window in the database application.&lt;/p&gt;

&lt;p&gt;SMILES is a great language for computers, but not for chemists, who are trained to communicate through 2-D structure diagrams. Although SMILES strings can be decoded manually, this is a tedious and error-prone process, especially for SMILES encoding high degrees of branching and ring content. It's preferable for the computer to do this hard work for us, providing a perfectly laid-out 2-D structure diagram for use in debugging or inclusion in documents.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.daylight.com/daycgi/depict"&gt;Depict&lt;/a&gt; is a Web application originally developed by &lt;a href="http://www.daylight.com/"&gt;Daylight&lt;/a&gt; for the conversion of SMILES strings into 2-D structure diagrams. Type a SMILES string into the form, press enter, and get a raster image of the encoded molecule. Daylight's Depict does a good enough job, but you can't change the interface or output. You also can't take the software apart to see how it works. Wouldn't it be great if you could?&lt;/p&gt;

&lt;h4&gt;About This Tutorial Series&lt;/h4&gt;

&lt;p&gt;This tutorial is the first in a series describing how to build a Depict server using 100% &lt;a href="http://opensource.org"&gt;Open Source&lt;/a&gt; components. The application will accept a SMILES string in a Webpage text field, and then produce a 2-D structure diagram. It won't be designed for ease of use, appearance, or configurability - these improvements will be described in subsequent articles. When this application is finished, I'll deploy it on a Web server. At every step in this process, I'll provide enough detail for anyone to do the same.&lt;/p&gt;

&lt;p&gt;It won't be necessary to finish every step yourself before you can work with the finished product. Near the beginning of each installment will be be a "Download and Prerequisites" section containing a link to the complete source code. Simply download this code and run it to see what it does.&lt;/p&gt;

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

&lt;p&gt;For this tutorial, you'll need &lt;a href="http://depth-first.com/articles/2006/10/30/agile-chemical-informatics-development-with-cdk-and-ruby-rcdk-0-3-0"&gt;Ruby CDK&lt;/a&gt; (RCDK). A recent article described the small amount of system configuration required for &lt;a href="http://depth-first.com/articles/2006/09/25/cdk-the-ruby-way-rcdk-0-2-0"&gt;RCDK on Linux&lt;/a&gt;. Another article showed how to install &lt;a href="http://depth-first.com/articles/2006/10/12/running-ruby-java-bridge-on-windows"&gt;RCDK on Windows&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.amazon.com/gp/product/0977616630?ie=UTF8&amp;amp;tag=depthfirst-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0977616630"&gt;&lt;img border="0" src="http://depth-first.com/demo/20061122/0977616630.01._AA_SCMZZZZZZZ_V36350687_.jpg" align="right"&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=depthfirst-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0977616630" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /&gt;In addition, you'll need to install &lt;a href="http://www.rubyonrails.org/down"&gt;Ruby on Rails&lt;/a&gt; - something that can be done through &lt;a href="http://docs.rubygems.org/"&gt;RubyGems&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The complete Depict application can be &lt;a href="http://depth-first.com/demo/20061121/depict.tar.gz"&gt;downloaded from this link&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;A Note on Ruby Java Bridge and AMD64 Linux Platforms&lt;/h4&gt;

&lt;p&gt;Our Depict application will use &lt;a href="http://rjb.rubyforge.org/"&gt;Ruby Java Bridge&lt;/a&gt; (RJB) as a Ruby interface to Java bytecode. Recently, &lt;a href="http://rubyforge.org/pipermail/rjb-users/2006-November/000008.html"&gt;a problem with RJB on AMD64-Linux&lt;/a&gt; was uncovered. This problem prevents third-party jarfiles from being loaded after Rails has been loaded.&lt;/p&gt;

&lt;p&gt;In practice, this means that the command to start the Rails server (Step 2) needs to be prefixed with an assignment of &lt;tt&gt;LD_PRELOAD&lt;/tt&gt;. You also need to make &lt;tt&gt;LD_LIBRARY_PATH&lt;/tt&gt; point to your native Java libraries. On my platform, which is AMD64-Linux running Sun's JVM, the commands are:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ export LD_LIBRARY_PATH=/usr/java/jdk1.5.0_09/jre/lib/amd64:/usr/java/jdk1.5.0_09/jre/lib/amd64/server
$ LD_PRELOAD=/usr/java/jdk1.5.0_09/jre/lib/amd64/libzip.so ruby script/server
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If you get an "Internal Error" due to an "unknown exception" while running Depict, chances are good that you've hit the same problem. Starting the Rails server as above should resolve it.&lt;/p&gt;

&lt;h4&gt;Step 1: Create the Application&lt;/h4&gt;

&lt;p&gt;Getting started with Rails is as simple as issuing the &lt;tt&gt;rails&lt;/tt&gt; command with the name of your application as an argument:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ rails depict
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Executing this command creates a complete Rails application template under the &lt;strong&gt;depict&lt;/strong&gt; subdirectory in your working directory. You build your application by editing the files and directories that were generated.&lt;/p&gt;

&lt;h4&gt;Step 2: Start the Server&lt;/h4&gt;

&lt;p&gt;You can start the Depict application by running the included server script:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ cd depict
$ ruby script/server
=&gt; Booting WEBrick...
=&gt; Rails application started on http://0.0.0.0:3000
=&gt; Ctrl-C to shutdown server; call with --help for options
[2006-11-18 10:17:08] INFO  WEBrick 1.3.1
[2006-11-18 10:17:08] INFO  ruby 1.8.5 (2006-08-25) [x86_64-linux-gnu]
[2006-11-18 10:17:08] INFO  WEBrick::HTTPServer#start: pid=4036 port=3000
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Let's see what Depict looks like so far. Point your browser to &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt;. You should see the following page:&lt;/p&gt;

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

&lt;p&gt;Congratulations! You're now running Ruby on Rails.&lt;/p&gt;

&lt;h4&gt;Step 3: Create the SmilesController&lt;/h4&gt;

&lt;p&gt;Rails adapts the Model-View-Controller application paradigm to the Web. It also automates many of the steps in building models, views, and controllers. Let's create a controller to handle the manipulation of SMILES strings:&lt;/p&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ ruby script/generate controller Smiles
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/smiles
      exists  test/functional/
      create  app/controllers/smiles_controller.rb
      create  test/functional/smiles_controller_test.rb
      create  app/helpers/smiles_helper.rb
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Currently, &lt;tt&gt;SmilesController&lt;/tt&gt; is just a skeleton:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;SmilesController&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ApplicationController&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Let's give &lt;tt&gt;SmilesController&lt;/tt&gt; the ability to accept a SMILES string as input by adding an &lt;tt&gt;input&lt;/tt&gt; method.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;SmilesController&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;input&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;h4&gt;Step 4: Create a Form&lt;/h4&gt;

&lt;p&gt;At this stage, pointing your browser to &lt;a href="http://localhost:3000/smiles/input"&gt;http://localhost:3000/smiles/input&lt;/a&gt; gives a screen containing an error message:&lt;/p&gt;

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

&lt;p&gt;Rails is looking for view that doesn't exist, so let's create one. To your &lt;strong&gt;depict/app/views/smiles&lt;/strong&gt; directory, add the following file, called &lt;strong&gt;input.rhtml&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;html&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;head&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;title&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;&lt;span class="constant"&gt;Enter&lt;/span&gt; &lt;span class="ident"&gt;a&lt;/span&gt; &lt;span class="constant"&gt;SMILES&lt;/span&gt; &lt;span class="constant"&gt;String&lt;/span&gt;&lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="regex"&gt;title&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;head&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;body&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt;&lt;span class="string"&gt; form_tag :action&lt;/span&gt;&lt;span class="punct"&gt;=&amp;gt;'&lt;/span&gt;&lt;span class="string"&gt;depict&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="string"&gt;
      Enter a SMILES String: &amp;lt;br /&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt;&lt;span class="string"&gt; text_field('smiles', 'value') %&amp;gt;&amp;lt;br /&amp;gt;
    &amp;lt;%&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;end_form_tag&lt;/span&gt; &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="string"&gt;
  &amp;lt;/body&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="regex"&gt;html&amp;gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This HTML view is an example of Ruby's templating mechanism, eRuby, which was discussed earlier in the context of &lt;a href="http://depth-first.com/articles/2006/11/15/diversity-oriented-chemical-informatics"&gt;converting SD files to HTML&lt;/a&gt;. In the template above, we've configured our form to invoke an action called &lt;tt&gt;depict&lt;/tt&gt; when submitted. This action does not yet exist, but will be created in Step 5 below.&lt;/p&gt;

&lt;p&gt;Now, pointing your browser to &lt;a href="http://localhost:3000/smiles/input"&gt;http://localhost:3000/smiles/input&lt;/a&gt; should give an input field:&lt;/p&gt;

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

&lt;p&gt;Let's try it. Submitting the SMILES string for benzene gives the following error screen:&lt;/p&gt;

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

&lt;p&gt;We haven't defined the &lt;tt&gt;depict&lt;/tt&gt; action yet, a fact that Rails is communicating with this error message.&lt;/p&gt;

&lt;p&gt;Have you noticed how we haven't had to restart the Rails Web server as we've made changes? This is but one of the many conveniences that makes Rails such a productive platform.&lt;/p&gt;

&lt;h4&gt;Step 5: Add a Depict Action&lt;/h4&gt;

&lt;p&gt;We need a way to pass a SMILES string from the Web page text field in which it's entered to our application and back to another view. To do this we'll add a &lt;tt&gt;depict&lt;/tt&gt; method to &lt;strong&gt;depict/app/controllers/smiles_controller.rb&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;depict&lt;/span&gt;
  &lt;span class="attribute"&gt;@smiles&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="attribute"&gt;@params&lt;/span&gt;&lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="symbol"&gt;:smiles&lt;/span&gt;&lt;span class="punct"&gt;][&lt;/span&gt;&lt;span class="symbol"&gt;:value&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Of course, our application still won't run properly because we haven't created a view for the new &lt;tt&gt;depict&lt;/tt&gt; method to use. Let's do this by adding the following file, named &lt;strong&gt;depict.rb&lt;/strong&gt; to the &lt;strong&gt;depict/app/views/smiles&lt;/strong&gt; directory:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;html&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;head&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;title&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;&lt;span class="constant"&gt;Depict&lt;/span&gt; &lt;span class="constant"&gt;SMILES&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt;&lt;span class="string"&gt; @smiles %&amp;gt;&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;SMILES: &amp;lt;%&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="attribute"&gt;@smiles&lt;/span&gt; &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="string"&gt;&amp;lt;/h1&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="regex"&gt;body&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;html&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Notice how the instance variable &lt;tt&gt;@smiles&lt;/tt&gt; is available for use within the template.&lt;/p&gt;

&lt;p&gt;Let's have a look at Depict so far. Pointing your browser to &lt;a href="http://localhost:3000/smiles/input"&gt;http://localhost:3000/smiles/input&lt;/a&gt;, entering the SMILES string for benzene, and pressing return produces the page show below:&lt;/p&gt;

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

&lt;p&gt;So far, so good. We've been able to read user input from an HTML form and reprocess it into some simple HTML output. Now, lets render a 2-D molecular image to go with it.&lt;/p&gt;

&lt;h4&gt;Step 6: Generate the 2-D Image&lt;/h4&gt;

&lt;p&gt;We'll use a method called &lt;tt&gt;image_for&lt;/tt&gt;, which we'll define shortly. The file &lt;strong&gt;depict/app/views/smiles/depict&lt;/strong&gt; should look like this:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;html&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;head&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;title&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;&lt;span class="constant"&gt;Depict&lt;/span&gt; &lt;span class="constant"&gt;SMILES&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;%=&lt;/span&gt;&lt;span class="string"&gt; @smiles %&amp;gt;&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;SMILES:&amp;lt;%&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="attribute"&gt;@smiles&lt;/span&gt; &lt;span class="punct"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="string"&gt;&amp;lt;/h1&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="ident"&gt;img&lt;/span&gt; &lt;span class="ident"&gt;src&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;&amp;lt;%= url_for :action =&amp;gt; &lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="ident"&gt;image_for&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;, :smiles =&amp;gt; @smiles %&amp;gt;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="regex"&gt;img&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;body&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="regex"&gt;html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The added &lt;tt&gt;img&lt;/tt&gt; tag is a placeholder for now. It loads an image dynamically generated from the &lt;tt&gt;image_for&lt;/tt&gt; method, which we'll shortly add to &lt;tt&gt;SmilesController&lt;/tt&gt;. We pass the SMILES string as a parameter.&lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;image_for&lt;/tt&gt; method does all of the real work in the Depict application. It accepts a SMILES string as a parameter, and produces a laid-out 2-D color molecular image as output. The method uses a variety of functionality contained in the Java API itself, and in Ruby CDK.&lt;/p&gt;

&lt;p&gt;In addition to an &lt;tt&gt;image_for&lt;/tt&gt; method, we'll need to add some accessory code to make it work. Edit &lt;strong&gt;depict/app/controllers/smiles_controller.rb&lt;/strong&gt; so that it looks like this:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="comment"&gt;# Load the RCDK library&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;rcdk/util&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="comment"&gt;# New jrequire calls.&lt;/span&gt;
&lt;span class="ident"&gt;jrequire&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;java.io.ByteArrayOutputStream&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;jrequire&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;net.sf.structure.cdk.util.ImageKit&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;jrequire&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;javax.imageio.ImageIO&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;SmilesController&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ApplicationController&lt;/span&gt;

  &lt;span class="comment"&gt;# Already defined.&lt;/span&gt;
  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;input&lt;/span&gt;

  &lt;span class="keyword"&gt;end&lt;/span&gt;

  &lt;span class="comment"&gt;# Already defined.&lt;/span&gt;
  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;depict&lt;/span&gt;
    &lt;span class="attribute"&gt;@smiles&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="attribute"&gt;@params&lt;/span&gt;&lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="symbol"&gt;:smiles&lt;/span&gt;&lt;span class="punct"&gt;][&lt;/span&gt;&lt;span class="symbol"&gt;:value&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;

  &lt;span class="comment"&gt;# New method.&lt;/span&gt;
  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;image_for&lt;/span&gt;
    &lt;span class="ident"&gt;smiles&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="attribute"&gt;@params&lt;/span&gt;&lt;span class="punct"&gt;[&lt;/span&gt;&lt;span class="symbol"&gt;:smiles&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt;
    &lt;span class="ident"&gt;mol&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;read_smiles&lt;/span&gt; &lt;span class="ident"&gt;smiles&lt;/span&gt;
    &lt;span class="ident"&gt;mol&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_molecule&lt;/span&gt; &lt;span class="ident"&gt;mol&lt;/span&gt;
    &lt;span class="ident"&gt;out&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt;&lt;span class="constant"&gt;Java&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="constant"&gt;ByteArrayOutputStream&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;image&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt;&lt;span class="constant"&gt;Net&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Sf&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Structure&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Cdk&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;ImageKit&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;createRenderedImage&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;mol&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;span class="number"&gt;300&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;

    &lt;span class="constant"&gt;Javax&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Imageio&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;ImageIO&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;write&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;image&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;png&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;,&lt;/span&gt; &lt;span class="ident"&gt;out&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;

    &lt;span class="ident"&gt;send_data&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;out&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;toByteArray&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="symbol"&gt;:type&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;image/png&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;,&lt;/span&gt; &lt;span class="symbol"&gt;:disposition&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;inline&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;,&lt;/span&gt; &lt;span class="symbol"&gt;:filename&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;molecule.png&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&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;Let's test the application with a real-world example. The achiral SMILES string for &lt;a href="http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=14950"&gt;Carmine&lt;/a&gt; is:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_smiles "&gt;CC1=C2C(=CC(=C1C(=O)O)O)C(=O)C3=C(C2=O)C(=C(C(=C3O)O)C4C(C(C(C(O4)CO)O)O)O)O&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Pointing your browser to &lt;a href="http://localhost:3000/smiles/input"&gt;http://localhost:3000/smiles/input&lt;/a&gt; and entering the above SMILES string produces a color 2-D image of the structure of the red food coloring:&lt;/p&gt;

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

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

&lt;p&gt;Ruby on Rails is a fun and agile framework for rapid Web development. Although Depict isn't much to look at yet, it demonstrates many key Rails concepts. Several techniques could be used improve the application's look and usability. For example, we could use &lt;a href="http://www.ajaxian.com/"&gt;AJAX&lt;/a&gt; to depict SMILES strings as they are being typed - without the need to hit return. We could also provide options for changing image format, size, and color scheme. Future articles will describe these and other improvements.&lt;/p&gt;</description>
      <pubDate>Tue, 21 Nov 2006 15:06:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:28d193f3-f174-45ca-84f1-cac552672c29</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/11/21/build-a-rails-cheminformatics-application-in-thirty-minutes</link>
      <category>Tools</category>
      <category>webapplication</category>
      <category>web</category>
      <category>rails</category>
      <category>2d</category>
      <category>rcdk</category>
      <category>ruby</category>
      <category>rjb</category>
      <category>amd64</category>
    </item>
  </channel>
</rss>
