<?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 svg</title>
    <link>http://depth-first.com/articles/tag/svg</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>A Simple Vector Graphics API for Chemical Structure Output Part 1: In Search of a Simplifying Approach for ChemPhoto</title>
      <description>&lt;p&gt;&lt;a href="http://flickr.com/photos/estherase/2584941208/"&gt;&lt;img src="http://depth-first.com/demo/20081031/layers.jpg" align="right"&gt;&lt;/img&gt;&lt;/a&gt;One of the main design goals of &lt;a href="http://metamolecular.com/chemphoto"&gt;ChemPhoto&lt;/a&gt;, the &lt;a href="http://depth-first.com/articles/2008/09/08/smarter-cheminformatics-from-sd-file-to-image-collection-with-chemphoto"&gt;chemical structure imaging application&lt;/a&gt;, was to support all Web-relevant image output formats, both vector-based and pixel-based. Like most things in software development, there are far more approaches that add complexity to this problem than there are approaches that remove it. And for some reason, the complexity-reducing methods tend to be the last to be considered. This article, the first in a series, will discuss how ChemPhoto simplifies the problem of supporting multiple chemical structure image output formats from a common representation.&lt;/p&gt;

&lt;h4&gt;The Problem in a Nutshell&lt;/h4&gt;

&lt;p&gt;ChemPhoto uses an internal representation of molecular structure based closely on the industry-standard &lt;a href="http://www.mdl.com/downloads/public/ctfile/ctfile.pdf"&gt;MDL molfile format&lt;/a&gt;. Given this representation, ChemPhoto needs to be able to write a variety of vector- and raster-based image formats. Raster formats are fortunately limited to PNG and JPG, which are supported directly by the standard Java library.&lt;/p&gt;

&lt;p&gt;Vector formats, on the other hand are more diverse and less accessible. Currently, ChemPhoto supports Scalable Vector Graphics (SVG) and Encapsulated PostScript (EPS). Complete support for Adobe Flash (SWF) output is expected soon. Proof of concept for Microsoft's Vector Markup Language (VML) &lt;a href="http://depth-first.com/articles/2008/07/22/vector-markup-language-for-cheminformatics"&gt;has already been demonstrated&lt;/a&gt;. Support for Adobe Acrobat format, through the &lt;a href="http://www.lowagie.com/iText/"&gt;iText library&lt;/a&gt; is anticipated. Last but not least is Java2D itself for use in Swing components such as &lt;a href="http://metamolecular.com/chemwriter"&gt;renderers and editors&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Clearly, supporting all of these formats requires rendering code that is minimally coupled to the underlying display system. But how to do this in practice?&lt;/p&gt;

&lt;h4&gt;The Batik Approach: Extend Graphics2D&lt;/h4&gt;

&lt;p&gt;&lt;a href="http://xmlgraphics.apache.org/batik/"&gt;Batik&lt;/a&gt; is a widely-used library for creating and processing SVG in Java. At its core is the &lt;a href="http://xmlgraphics.apache.org/batik/using/svg-generator.html"&gt;SVGGraphics2D class&lt;/a&gt; which extends &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics2D.html"&gt;Graphics2D&lt;/a&gt;, overriding many of its methods in the process. The idea seems simple enough - create your drawing code using the Java2D API like you normally would. When you want to generate SVG, just pass an instance of &lt;tt&gt;SVGGraphics2D&lt;/tt&gt; and then read out the SVG document using &lt;tt&gt;stream&lt;/tt&gt; method.&lt;/p&gt;

&lt;p&gt;The problem with this approach is that every new image output format to be supported needs to extend Graphics2D and essentially re-implement most of its methods. Graphics2D is a large and complex class with many associated helper classes. Just knowing when you've completely covered the API is a major challenge, aside from the even bigger challenge of implementing the overridden methods.&lt;/p&gt;

&lt;p&gt;Fine, you might say, given that so many SVG interconverters exist, why not just use SVG (created by Batik) as the universal interconversion format and get a third-party-library to convert SVG into other vector formats?&lt;/p&gt;

&lt;p&gt;This approach is appealing in principle, but fails in practice. Many SVG implementations are partial at best - and many lack the documentation that would warn that a problem might exist with the exact form of SVG you're using. For example, in an early iteration of ChemPhoto, Batik was used to create SVG from some representative chemical structures. Unfortunately, the way Batik represented path data was not fully interpreted by any of the SVG-&gt;SWF converters that were examined. The result was bumpy instead of smooth curves for atom labels, and other unacceptable abnormalities.&lt;/p&gt;

&lt;p&gt;Finally, after spending some time reading J. David Eisenberg's &lt;a href="http://oreilly.com/catalog/9780596002237/toc.html"&gt;excellent book about SVG&lt;/a&gt;, it became clear that for drawing 2D chemical structures and even reactions and reaction schemes, only a fraction of the SVG specification was relevant.&lt;/p&gt;

&lt;p&gt;In this case, Batik, and its approach of extending Graphics2D was simply overkill that made the problem more complex than it needed to be.&lt;/p&gt;

&lt;h4&gt;A Better Approach: Create a Custom Vector Graphics Interface&lt;/h4&gt;

&lt;p&gt;Batik has the right idea: isolate drawing code from the specific format being generated. The problem is that the Graphics2D class wasn't really designed for this purpose. For one thing, it's a concrete class that inherits from another concrete class. And as mentioned before, Graphics2D a very complex class with many dependencies.&lt;/p&gt;

&lt;p&gt;How can we create a simple vector graphics API tailored to chemical structure image creation, which is easily re-implemented, and which works with the existing Java2D API?&lt;/p&gt;

&lt;p&gt;Part 2 of this series will describe one approach.&lt;/p&gt;

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

&lt;p&gt;Creating the ChemPhoto rendering engine has been an evolutionary process. It started with the idea of directly using the Graphics2D class in rendering code, but has since moved on to the definition of a vector graphics abstraction layer to simplify the addition of new image formats.&lt;/p&gt;

&lt;p&gt;I'd like to thank those beta testers who have already offered valuable feedback on ChemPhoto. If you'd like an unlimited 30-day trial for yourself, please &lt;a href="http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address"&gt;drop me a line.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Image Credit: &lt;a href="http://flickr.com/photos/estherase/"&gt;estherase&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 31 Oct 2008 18:25:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ca61daeb-1523-4f0e-a4f6-f95a9d69f14e</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/10/31/a-simple-vector-graphics-api-for-chemical-structure-output-part-1-in-search-of-a-simplifying-approach-for-chemphoto</link>
      <category>Tools</category>
      <category>chemphoto</category>
      <category>chemicalstructureimaging</category>
      <category>vectorgraphics</category>
      <category>pdf</category>
      <category>svg</category>
      <category>vml</category>
      <category>eps</category>
      <category>png</category>
      <category>jpg</category>
    </item>
    <item>
      <title>Smarter Cheminformatics: From SD File to Image Collection with ChemPhoto</title>
      <description>&lt;p&gt;&lt;a href="http://metamolecular.com/chemphoto"&gt;&lt;img src="http://depth-first.com/demo/20080908/chemphoto.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;The old adage says time is money. Unfortunately, working chemists are often forced to spend a remarkable amount of valuable time and mental effort on menial chemical information processing tasks. These are things that could be done faster and with better quality by the right software, if it were available. Most importantly, these tasks take resources away from much more valuable work that &lt;em&gt;can't&lt;/em&gt; be automated.&lt;/p&gt;

&lt;h4&gt;The Problem in a Nutshell&lt;/h4&gt;

&lt;p&gt;As a case in point, consider the creation of 2D chemical structure images. If you maintain a compound collection of any kind, sooner or later you may end up asking yourself how you can create a set of images depicting the chemical structures in your collection.&lt;/p&gt;

&lt;h4&gt;A Specific Example: Chemical Suppliers&lt;/h4&gt;

&lt;p&gt;For example, you might work for a chemical supplier that maintains a Web-based eCommerce site, one or more PDF catalogs, or printed brochures. Your customers are chemists and they expect to see chemical structures in your product listings. How can you make this happen?&lt;/p&gt;

&lt;p&gt;If you look around for software that automates this job, you'll more likely than not come up empty-handed. The software that solves this problem well simply doesn't exist yet.&lt;/p&gt;

&lt;h4&gt;Doing it the Hard Way&lt;/h4&gt;

&lt;p&gt;In the absence of software to solve the problem, the only way to get the job done is to buckle down and do it manually. Most chemical structure editors allow you to save output as a raster image. Provided that this output matches your requirements, your system might consist of the following steps:&lt;/p&gt;

&lt;p&gt;(1) For every product in your catalog, create a single molfile or its machine-readable equivalent.&lt;/p&gt;

&lt;p&gt;(2) Load one file into your editor.&lt;/p&gt;

&lt;p&gt;(3) Save the file as a raster image, being careful to make sure all of the drawing settings and image size parameters are identical to the rest of your images.&lt;/p&gt;

&lt;p&gt;(4) Repeat Steps (2)-(3) until you have all of your images.&lt;/p&gt;

&lt;p&gt;There are many problems with this approach. For example, if your images ever need to be made larger (or smaller), you'll have to create all of your images over again (which can easily number in the thousands). Similarly, if for some reason you want to change the appearance of the images such as background, atom label coloring, or line thicknesses, you'll be forced into a lot of manual work. Finally, this system requires you to keep track of structures that have been imaged and those that haven't, which can in itself be nontrivial and error-prone, especially for thousands of products.&lt;/p&gt;

&lt;p&gt;With the right software, this problem would disappear.&lt;/p&gt;

&lt;h4&gt;One Solution: Customized Imaging Service&lt;/h4&gt;

&lt;p&gt;My company, &lt;a href="http://metamolecular.com"&gt;Metamolecular&lt;/a&gt;, has recently provided custom imaging services to a few chemical suppliers wanting thousands of good-looking structure images rendered automatically. The service made use of the versatile &lt;a href="http://metamolecular.com/chemwriter"&gt;ChemWriter&lt;/a&gt; rendering engine together with some custom code written in &lt;a href="http://depth-first.com/articles/tag/ruby"&gt;Ruby&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Although the imaging service works very well as a one-off solution, it's less than optimal in the longer term. Any changes to the image collection must be processed by Metamolecular, and then sent back to the client. A cheaper and faster solution would be to offer software that implements the functionality of the service.&lt;/p&gt;

&lt;h4&gt;A Better Solution: Chemical Structure Imaging Software&lt;/h4&gt;

&lt;p&gt;Wouldn't it be great if easy-to-use software existed that could automatically generate thousands of chemical structure images with the press of a button?&lt;/p&gt;

&lt;p&gt;In particular, the software should:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Run on any modern platform (Windows, Mac OS X, Linux).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Read industry-standard Structure Data Files (SD Files).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Be capable of working with tens of thousands of chemical structures at a time even on older machines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Store fully-customizable drawing settings in a format that could be used over and over again for a consistent and professional look.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allow the output to be previewed exactly as it will appear in the generated images ("what you see is what you get").&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Output to a variety of image formats, including: Portable Network Graphics (PNG image); JPG image; &lt;a href="http://depth-first.com/articles/2008/06/10/adobe-flash-for-cheminformatics-fast-scalable-and-attractive-2d-depiction-of-chemical-structures-with-vector-graphics"&gt;Flash&lt;/a&gt; (SWF file); &lt;a href="http://depth-first.com/articles/2006/09/09/generating-and-serving-2-d-molecular-svgs"&gt;Scalable Vector Graphics&lt;/a&gt; (SVG); and &lt;a href="http://depth-first.com/articles/2008/08/07/encapsulated-postscript-for-cheminformatics"&gt;Encapsulated PostScript&lt;/a&gt; (EPS file).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Introducing ChemPhoto&lt;/h4&gt;

&lt;p&gt;ChemPhoto is designed to solve the problem of consistently creating large numbers of high-quality 2D chemical structure images. Currently in development, the first versions of ChemPhoto will be available for review within the next two weeks.&lt;/p&gt;

&lt;p&gt;ChemPhoto consists of a lightweight and intuitive user interface layer built on top of the ChemWriter rendering engine. ChemPhoto focuses on doing one thing very well, so it wouldn't be useful for creating or editing SD Files (a task for which many tools already exist). The software is specifically designed to work well with large SD Files, such as the 25,000-structure sets that can be obtained from &lt;a href="http://pubchem.ncbi.nlm.nih.gov/"&gt;PubChem&lt;/a&gt;. Written in Java, ChemPhoto runs on Windows, Mac OS X, and Linux. Future articles will discuss ChemPhoto's design and implementation.&lt;/p&gt;

&lt;p&gt;If you're interested in evaluating ChemPhoto, feel free to &lt;a href="http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address"&gt;drop me a line&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 08 Sep 2008 19:04:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e69d3005-c83f-463b-9826-e08b4339f91a</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/09/08/smarter-cheminformatics-from-sd-file-to-image-collection-with-chemphoto</link>
      <category>Tools</category>
      <category>chemphoto</category>
      <category>image</category>
      <category>png</category>
      <category>jpg</category>
      <category>swf</category>
      <category>svg</category>
      <category>eps</category>
      <category>sdfile</category>
      <category>automation</category>
    </item>
    <item>
      <title>Adobe Flash for Cheminformatics: Fast, Scalable, and Attractive 2D Depiction of Chemical Structures with Vector Graphics</title>
      <description>&lt;p&gt;&lt;a href="http://metamolecular.com/chemwriter"&gt;&lt;img src="http://depth-first.com/demo/20080610/chemwriter_small.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;The previous article in this series &lt;a href="http://depth-first.com/articles/2008/06/06/the-other-vector-graphics-markup-language"&gt;discussed the use of vector graphics markup languages for cheminformatics&lt;/a&gt;, in particular for the display of 2D chemical structures. Although vector graphics are well-suited for creating responsive and appealing cheminformatics Web applications, the lack of universal native browser support makes both &lt;a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics"&gt;Scalable Vector Graphics&lt;/a&gt; (SVG) and its cousin &lt;a href="http://www.w3.org/TR/1998/NOTE-VML-19980513"&gt;Vector Markup Language&lt;/a&gt; (VML) unattractive at this time. This article highlights Adobe Flash as a 2D chemical structure renderer for Web applications, and features a fully-functional proof of concept based on the &lt;a href="http://metamolecular.com/chemwriter"&gt;ChemWriter&lt;/a&gt; rendering engine.&lt;/p&gt;

&lt;h4&gt;About Adobe Flash&lt;/h4&gt;

&lt;p&gt;Although Adobe Flash is practically an industry unto itself today, at it's core, Flash is a lightweight vector graphics renderer. Introduced in 1996, the Flash Player can be found on millions of Internet-enable devices today. According to a &lt;a href="http://www.adobe.com/products/player_census/flashplayer/"&gt;study by Adobe&lt;/a&gt;, the Flash Player was running on nearly 99% of Internet-enabled desktops as of March 2008. The player has also found its way onto a host of handheld devices and phones.&lt;/p&gt;

&lt;p&gt;Many technologies have been layered on top of the Flash Player. One of the first was the &lt;a href="http://www.adobe.com/devnet/actionscript/articles/actionscript3_overview.html"&gt;ActionScript&lt;/a&gt; scripting language. More recently, Adobe has introduced &lt;a href="http://depth-first.com/articles/2007/05/25/flex-rich-internet-applications-and-cheminformatics"&gt;Flex&lt;/a&gt;, a full-fledged application development framework.&lt;/p&gt;

&lt;p&gt;Unlike SVG and other vector graphics systems, Flash is ready today, proven, and about as close to universal as is possible on the Web. If you want to do vector graphics on the Web with the most convenient user and developer experience, Flash is your tool.&lt;/p&gt;

&lt;p&gt;But what can Flash do for cheminformatics?&lt;/p&gt;

&lt;h4&gt;A Demonstration&lt;/h4&gt;

&lt;p&gt;The table below is composed of twelve cells, each of which display a chemical structure through the Flash Player.&lt;/p&gt;

&lt;p&gt;&lt;style type="text/css"&gt;
      .cells a {display: block; text-align: center;}
    &lt;/style&gt;
    &lt;table class="cells" cellpadding="3" border="2"&gt;
    &lt;tr&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/bicalutamide.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/bicalutamide.swf" quality="high"
             width="150" height="150" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt;
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/bicalutamide.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/budesonide.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/budesonide.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/budesonide.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/buproprion.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/buproprion.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/buproprion.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/clopidogrel.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/clopidogrel.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/clopidogrel.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/docetaxel.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/docetaxel.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/docetaxel.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/escitalopram.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/escitalopram.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/escitalopram.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/fluticasone.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/fluticasone.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/fluticasone.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/lopinavir.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/lopinavir.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/lopinavir.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/omega_conotoxin_gvia_16132374.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/omega_conotoxin_gvia_16132374.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/omega_conotoxin_gvia_16132374.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/oseltamivir.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/oseltamivir.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/oseltamivir.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/sertraline.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/sertraline.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/sertraline.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
            width="150" height="150"&gt;
      &lt;param name="movie" value="http://depth-first.com/demo/20080610/sildenafil.swf"&gt;
      &lt;embed src="http://depth-first.com/demo/20080610/sildenafil.swf" quality="high"
             width="150" height="150" name="movie" type="application/x-shockwave-flash"
             pluginspage="http://www.macromedia.com/go/getflashplayer"&gt; 
    &lt;/object&gt;
    &lt;a href="http://depth-first.com/demo/20080610/sildenafil.swf"&gt;zoom&lt;/a&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt; &lt;/p&gt;

&lt;p&gt;Several points are worth mention:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Each of the structures can be zoomed by clicking on its 'zoom' link.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each cell contains a lightweight embedded "SWF" file, or "ShockWave File," and the zoomed view displays exactly the same file. No matter how the SWF file is resized, it will always be proportionally-scaled to its smallest dimension and centered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The size of each SWF file ranges from a low of 563 bytes to a high of 8.5 KB, with an average of around 1.5KB. The larger the molecule, the more space is required. A comparable PNG with a resolution of 150x150 pixels would require on average for each structure about 6-8 KB.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each image was generated from a molfile using a development version of the &lt;a href="http://metamolecular.com/chemwriter"&gt;ChemWriter&lt;/a&gt; rendering engine via the open source &lt;a href="http://www.flagstonesoftware.com/transform/"&gt;Transform SWF&lt;/a&gt; Java toolkit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SWF Files, unlike applets, are highly optimized for multiple instance display on all major platforms and browsers. In every case, startup will be nearly instantaneous and scrolling will be smooth. The performance of Flash should be at least as good as, if not better than, raster images.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;The Right Tool for the Job (is Probably not a Raster Image)&lt;/h4&gt;

&lt;p&gt;One of the first challenges developers of cheminformatics Web applications are faced with is how to render 2D chemical structures. For an overview of the technologies now in use, see the &lt;a href="http://depth-first.com/articles/2008/06/06/the-other-vector-graphics-markup-language"&gt;previous article&lt;/a&gt; in this series. Each option has its own set of trade-offs.&lt;/p&gt;

&lt;p&gt;The most widely-used 2D structure rendering option, raster images, is both inflexible and inefficient. Unlike a vector image, a raster image by definition has only one resolution, which is fixed at creation time. If image dimensions need to change, then all structures must be re-imaged. Given the size of many of today's &lt;a href="http://depth-first.com/articles/2007/01/24/thirty-two-free-chemistry-databases"&gt;chemistry databases&lt;/a&gt;, such a system-wide re-imaging of structures can involve a non-trivial amount of processor power and bandwidth.&lt;/p&gt;

&lt;p&gt;To compensate, many sites store relatively large images, say 300x300 pixel, and then use the HTML &lt;tt&gt;&amp;lt;img&amp;gt;&lt;/tt&gt; tag to shrink it as needed. But this creates problems of its own: both storage and bandwidth requirements are far larger than they need to be, resulting in the need for more powerful server hardware and poorer application scalability. And then there are the application's users, who must wait through a 30KB or higher download for each 2D image.&lt;/p&gt;

&lt;p&gt;A significant number of structures in any compound collection will be so large that even a 300x300 pixel image will be insufficient to render the necessary detail. For example, &lt;a href="http://depth-first.com/articles/2008/05/19/building-chempedia-resizable-structures-with-chemwriter"&gt;a recent Depth-First article&lt;/a&gt; discussed a vector graphics solution this problem within the context of &lt;a href="http://chempedia.com"&gt;Chempedia&lt;/a&gt;, the free chemical encyclopedia. Vector graphics simply eliminate this issue.&lt;/p&gt;

&lt;p&gt;Many cheminformatics applications would benefit from being able to show 50 or more structures at a time, with each structure having a zoom view for closer inspection. To a non-chemist, this might seem unnecessary. But for today's chemists dealing with large chemical catalogs and high-throughput screens, it's not only possible, but a routine part of the practice of chemistry. The raster image approach makes it extremely difficult to meet this important need on the Web. Vector graphics, possibly delivered through the Flash Player, offer a much simpler and more efficient way to do it.&lt;/p&gt;

&lt;p&gt;2D chemical structures are vectorial in nature; using raster images to depict them is in most cases the more costly and lower quality option.&lt;/p&gt;

&lt;h4&gt;Summary&lt;/h4&gt;

&lt;p&gt;Vector graphics are a near-perfect match for the job of depicting 2D chemical structures on the Web. Although there are many vector graphics platforms to choose from, the Flash Player is by far the most universal option. This article has demonstrated a working example of multiple 2D chemical structures rendered as lightweight vector images via the Adobe Flash Player, the first and only such demonstration of which I'm aware.&lt;/p&gt;

&lt;p&gt;The key technologies behind this demonstration are the &lt;a href="http://metamolecular.com/chemwriter"&gt;ChemWriter&lt;/a&gt; rendering engine and the open source Flash developer toolkits available from &lt;a href="http://www.flagstonesoftware.com/transform/"&gt;Flagstone Software&lt;/a&gt;. If you're interested in learning more about how vector graphics and Flash can improve both the user and developer experience in your cheminformatics Web applications, I'd be happy to &lt;a href="http://mailhide.recaptcha.net/d?k=01_5KIPZyZx-bysSnY0HEqIw==&amp;amp;c=9ppCEFFs3OESfeieiRz1LAgTPkQmMhWOQm4RKDRkFI8=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01_5KIPZyZx-bysSnY0HEqIw==&amp;amp;c=9ppCEFFs3OESfeieiRz1LAgTPkQmMhWOQm4RKDRkFI8=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address"&gt;hear from you&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Tue, 10 Jun 2008 11:05:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9a0ab422-6515-446f-a0ef-a765519d8dd1</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/06/10/adobe-flash-for-cheminformatics-fast-scalable-and-attractive-2d-depiction-of-chemical-structures-with-vector-graphics</link>
      <category>Tools</category>
      <category>flash</category>
      <category>adobe</category>
      <category>svg</category>
      <category>vml</category>
      <category>chemwriter</category>
      <category>vectorgraphics</category>
      <category>2d</category>
      <category>chemicalstructure</category>
      <category>java</category>
      <category>swf</category>
    </item>
    <item>
      <title>The Other Vector Graphics Markup Language</title>
      <description>&lt;p&gt;&lt;img src="http://depth-first.com/demo/20080606/toucan.png" align="right"&gt;&lt;/img&gt;&lt;a href="http://en.wikipedia.org/wiki/Scalable_Vector_Graphics"&gt;Scalable Vector Graphics&lt;/a&gt; (SVG) is a technology that enables the creation and publication of high quality images that can be scaled to any resolution. SVG is ideally suited for the Web, and all major browsers now support it - except Internet Explorer (IE). This poses a problem: vector graphics are by far superior to raster images for many applications, but the lack of native IE support makes SVG a non-starter for most developers. This article discusses a little known IE capability that might provide a solution.&lt;/p&gt;

&lt;h4&gt;Oh Brother, Where Art Thou?&lt;/h4&gt;

&lt;p&gt;Way back in 1998 a group of companies including Microsoft submitted a proposal for a vector graphics language called &lt;a href="http://www.w3.org/TR/1998/NOTE-VML-19980513"&gt;Vector Markup Language&lt;/a&gt; (VML) to the W3C. This set in motion a series of events that culminated in the development of what we know today as SVG. But while use of SVG quickly expanded, VML remained almost exclusively limited to Microsoft products.&lt;/p&gt;

&lt;p&gt;Soon after, IE 5 &lt;a href="http://www.infoloom.com/gcaconfs/WEB/granada99/wu.HTM"&gt;introduced the ability&lt;/a&gt; to decode and display VML - a capability that exists today in IE 7.&lt;/p&gt;

&lt;p&gt;SVG and VML are two vector graphics languages, each designed to do essentially the same thing. For basic shape rendering, their similarities outweigh their differences.&lt;/p&gt;

&lt;h4&gt;About VML&lt;/h4&gt;

&lt;p&gt;To understand why VML never caught on, you need look no further than the documentation - or the lack thereof. The &lt;a href="http://www.w3.org/TR/1998/NOTE-VML-19980513"&gt;original VML submission&lt;/a&gt; is a decade old and has not been updated.&lt;/p&gt;

&lt;p&gt;For the most part, VML documentation is scattered and incomplete. Nevertheless, there are some useful resources. Here, in no particular order are some of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb250524(VS.85).aspx"&gt;Microsoft Documentation&lt;/a&gt; Authoritative, but lacking in examples.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://weborama.blogspot.com/2006/01/vml-svg-and-canvas.html"&gt;VML, SVG, and Canvas&lt;/a&gt; Discusses some of the differences between VML and SVG.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.robweir.com/blog/2006/07/cum-mortuis-in-lingua-mortua.html"&gt;Cum mortuis in lingua mortua&lt;/a&gt; Good history of VML.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.sjsu.edu/faculty/watkins/vml.htm"&gt;Examples of the Vector Markup Lanugauge&lt;/a&gt; There are far too few of this kind of site.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://vitali.web.cs.unibo.it/Progetti/VectorConverter"&gt;VectorConverer&lt;/a&gt;
A PHP library that uses XSLT to interconvert SVG and VML. Unfortunately, the stylesheet didn't work in my hands under &lt;a href="http://vitali.web.cs.unibo.it/Progetti/VectorConverter"&gt;Xalan&lt;/a&gt; or Ruby/xslt - and I know almost nothing about PHP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.cs.sjsu.edu/faculty/pollett/masters/Semesters/Fall03/JulieNabong/index.shtml?cs298proposal.html"&gt;Julie Nabong's Masters Thesis&lt;/a&gt; Julie wrote and documented an SVG/VML XSLT for interconverting the two languages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;JSDrawing: Interconverting Vector Languages on the Fly&lt;/h4&gt;

&lt;p&gt;One VML resource deserves special note - &lt;a href="http://www.kevlindev.com/projects/jsdrawing/index.htm"&gt;JSDrawing&lt;/a&gt;. This library seems to be capable of generating Flash, VML, or SVG from a common vector graphics language precursor. I'm not sure how practical this approach would be, but it does provide some food for thought.&lt;/p&gt;

&lt;h4&gt;Why It Matters&lt;/h4&gt;

&lt;p&gt;Chemistry is in a good position to take advantage of vector graphics. Chemical structures, being closely based on graph theoretical constructs, would seem to be a perfect match for vector languages like SVG and VML, especially on the Web. So far it hasn't happened, primarily for the reasons outlined above.&lt;/p&gt;

&lt;p&gt;Currently, if you want to display 2D chemical structures in Web pages you're faced with some tradeoffs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Raster Images.&lt;/strong&gt; This is by far the most common practice. This option unfortunately makes it very difficult to redesign the layout of a site or support multiple views of the same structure, especially with databases of one million plus compounds becoming commonplace. Even if images are never regenerated, they need to be stored and retrieved, adding to cost and complexity. Images could be dynamically generated, but at the expense of substantial memory and CPU requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Applets.&lt;/strong&gt; This is the approach currently taken by &lt;a href="http://chempedia.com"&gt;Chempedia&lt;/a&gt;, the free chemical encyclopedia, and gives complete flexibility in page layout and structure appearance. Changing the dimensions of a structure is as simple as changing the size of a div. Unfortunately, some browsers handle multiple applets better than others. Firefox on OS X is very slow at refreshing applets while scrolling, and IE requires a &lt;a href="http://depth-first.com/articles/2007/11/02/eolas-and-jactivating-working-around-a-workaround"&gt;Javascript trick&lt;/a&gt; to remove the 'click to active' message that causes some flashing when in progress.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vector Graphics Through Plugins&lt;/strong&gt; There are at least two SVG plugins for IE (&lt;a href="http://www.adobe.com/svg/viewer/install/main.html"&gt;one by Adobe&lt;/a&gt; and &lt;a href="http://www.examotion.com/index.php?id=product_player"&gt;the other from Examotion&lt;/a&gt;). Will all of your users be able to find and install them? Unless the answer to both questions is 'yes', this option is probably best left as a last resort. Another option is to render SVG on IE through the Flash or &lt;a href="http://silverlight.net/"&gt;Silverlight&lt;/a&gt; plugins. But as far as I can tell, neither approach is ready for prime-time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Native Vector Graphics&lt;/strong&gt; Available on all major browsers including Internet Explorer 5/6/7, Firefox 1/2, and Opera 8/9. Combines the flexibility, lossless depiction, inlineability and low data storage/retrieval overhead of applets with the speed of images. Interactivity and other special effects can be achieved through DOM manipulation. All of this depends, of course, on the vector graphics format being compatible with the rendering engine.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In some circumstances, serving VML to IE clients and SVG to everyone else would be a viable option - if it were possible to generate VML.&lt;/p&gt;

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

&lt;p&gt;Vector graphics have a lot to offer chemistry, especially when used with Web applications. The combination of VML and SVG offers a proven technology platform that's ready today, but only if you can generate VML.&lt;/p&gt;</description>
      <pubDate>Fri, 06 Jun 2008 14:39:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:48c29183-75ae-4e3f-b4f7-e99de2a52048</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/06/06/the-other-vector-graphics-markup-language</link>
      <category>Tools</category>
      <category>svg</category>
      <category>vml</category>
      <category>vectorgraphics</category>
      <category>silverlight</category>
      <category>flash</category>
      <category>chemicalstructure</category>
      <category>2d</category>
      <category>chemwriter</category>
      <category>chempedia</category>
    </item>
    <item>
      <title>Molecular Style Sheets: Combining SVG and CSS</title>
      <description>&lt;p&gt;&lt;a href="http://www.w3.org/Style/CSS/"&gt;Cascading Style Sheets&lt;/a&gt; (CSS) are used by Web developers to modify the appearance of an HTML document without requiring changes to the document itself. This approach has become so popular because of the power it offers: developers can achieve a consistent and re-usable look by simply editing and/or copying a single document.&lt;/p&gt;

&lt;p&gt;2-D molecular structures are like text documents in that context determines the best presentation style. For example, the way that a 2-D structure appears on a Web page, complete with atom color coding and anti-aliasing, may not be the best way for it to appear on a handheld device. Consider these use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An online publisher may want to achieve a consistent "look" for their 2-D molecular graphics, regardless of who generated them. For portability, they want to avoid hard-coding the styling information into the software they use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You want to be able to re-use the 2-D structures you've downloaded from a blog in your presentation. The appearance of these structures needs to match those you already have.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An online substructure query may return results to a user that have been highlighted to indicate the atoms and bonds where the query hit. The user may want to set his or her own highlight color, or disable the feature altogether.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Users of &lt;a href="http://www.cambridgesoft.com/software/details/?ds=2&amp;amp;dsv=9"&gt;ChemDraw&lt;/a&gt; and software like it are probably familiar with its concept of styles. This is the right idea, although limited in practice. The main limitation is that these products are aimed at single users on desktop machines that are willing to do a great deal of manual work to achieve consistency. Something far more general and automated is going to be needed, and to my knowledge it does not yet exist.&lt;/p&gt;

&lt;p&gt;Could the style sheet concept be applied to 2-D structure diagrams? It turns out that SVG may offer a solution. Just as the appearance of an HTML document can be styled with CSS, so too can the appearance of an SVG document.&lt;/p&gt;

&lt;h4&gt;A Demonstration: Highlighting Bonds&lt;/h4&gt;

&lt;p&gt;As a demonstration, we'll see how a style sheet can be used to highlight one of naphthalene's rings, possibly as a result of it being hit by a substructure search.&lt;/p&gt;

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

&lt;p&gt;Consider the above 2-D structure of naphthalene, which was generated by &lt;a href="http://depth-first.com/articles/2006/08/28/drawing-2-d-structures-with-structure-cdk"&gt;Structure-CDK&lt;/a&gt;, the latest version of which can be downloaded &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=103744"&gt;here&lt;/a&gt;. The SVG that generated this image is shown below. I have edited the commented lines.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_xml "&gt;&lt;span class="punct"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="tag"&gt;xml&lt;/span&gt; &lt;span class="attribute"&gt;version&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;1.0&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;encoding&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;UTF-8&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;?&amp;gt;&lt;/span&gt;

&lt;span class="comment"&gt;&amp;lt;!-- Edit: a stylesheet --&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="tag"&gt;xml-stylesheet&lt;/span&gt; &lt;span class="attribute"&gt;href&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;style_normal.css&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;type&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;text/css&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="tag"&gt;DOCTYPE&lt;/span&gt; &lt;span class="attribute"&gt;svg&lt;/span&gt; &lt;span class="attribute"&gt;PUBLIC&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;-//W3C//DTD SVG 1.0//EN&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd&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="tag"&gt;svg&lt;/span&gt; &lt;span class="attribute"&gt;fill-opacity&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="namespace"&gt;xmlns&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;xlink&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;http://www.w3.org/1999/xlink&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;color-rendering&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;auto&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;color-interpolation&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;auto&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;text-rendering&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;auto&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;black&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-linecap&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;square&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-miterlimit&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;10&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;shape-rendering&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;auto&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-opacity&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;black&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-dasharray&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;font-weight&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;normal&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-width&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;xmlns&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;http://www.w3.org/2000/svg&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;font-family&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="entity"&gt;&amp;amp;apos;&lt;/span&gt;&lt;span class="string"&gt;Dialog&lt;/span&gt;&lt;span class="entity"&gt;&amp;amp;apos;&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;font-style&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;normal&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-linejoin&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;miter&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;font-size&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;12&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-dashoffset&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;0&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;image-rendering&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;auto&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&amp;gt;&lt;/span&gt;

  &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;defs&lt;/span&gt; &lt;span class="attribute"&gt;id&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;genericDefs&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&gt;g&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="tag"&gt;g&lt;/span&gt; &lt;span class="attribute"&gt;text-rendering&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;optimizeLegibility&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-width&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;0.098&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;transform&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;scale(47.2947,47.2947) translate(0.049,3.1127)&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-linecap&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;round&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;stroke-linejoin&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;round&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;line&lt;/span&gt; &lt;span class="attribute"&gt;y2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-0.7&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;4.8497&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;4.8497&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;y1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-2.1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&gt;path&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;d&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;M4.8497 -2.1 L3.6373 -2.8 M4.5581 -1.945 L3.6488 -2.47&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&gt;path&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;d&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;M0 -2.1 L0 -0.7 M0.28 -1.925 L0.28 -0.875&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;class&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="comment"&gt;&amp;lt;!-- Edit: hit --&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;line&lt;/span&gt; &lt;span class="attribute"&gt;y2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-2.8&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;0&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;1.2124&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;y1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-2.1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;class&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="comment"&gt;&amp;lt;!-- Edit: hit --&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;path&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;d&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;M4.8497 -0.7 L3.6373 0 M4.5581 -0.855 L3.6488 -0.33&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&gt;line&lt;/span&gt; &lt;span class="attribute"&gt;y2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;0&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;0&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;1.2124&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;y1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-0.7&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;class&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="comment"&gt;&amp;lt;!-- Edit: hit --&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;line&lt;/span&gt; &lt;span class="attribute"&gt;y2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-2.1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;3.6373&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;2.4249&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;y1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-2.8&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&gt;path&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;d&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;M1.2124 -2.8 L2.4249 -2.1 M1.224 -2.47 L2.1333 -1.945&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;class&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="comment"&gt;&amp;lt;!-- Edit: hit --&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;line&lt;/span&gt; &lt;span class="attribute"&gt;y2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-0.7&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;3.6373&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;2.4249&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;y1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;0&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&gt;path&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;d&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;M1.2124 0 L2.4249 -0.7 M1.224 -0.33 L2.1333 -0.855&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;class&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="comment"&gt;&amp;lt;!-- Edit: hit --&amp;gt;&lt;/span&gt;
      &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;line&lt;/span&gt; &lt;span class="attribute"&gt;y2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-0.7&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;fill&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;none&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;2.4249&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;x2&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;2.4249&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;y1&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;-2.1&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;class&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hit&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="punct"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="comment"&gt;&amp;lt;!-- Edit: hit --&amp;gt;&lt;/span&gt;
    &lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="tag"&gt;g&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="tag"&gt;g&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="tag"&gt;svg&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;In the image of naphthalene rendered above, the stylesheet I used was blank. However, by applying the following one-line style sheet, I can significantly change the appearance of this image:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_css "&gt;*.hit { stroke: red }&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This line is known as a "class selector." A CSS-aware SVG renderer (such as &lt;a href="http://www.mozilla.com/firefox/"&gt;Firefox&lt;/a&gt;), after loading this style sheet, will apply the red stroke styling to all elements containing the &lt;tt&gt;hit&lt;/tt&gt; class attribute. The output, shown below, highlights one of the rings of naphthalene in red.&lt;/p&gt;

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

&lt;p&gt;Interestingly, the SVG document itself says nothing about what color the hit class should be - that's left for the style sheet to determine. So by changing one line in the style sheet, I can change the appearance of the hit highlighting to purple, green, or aquamarine. And this applies not only to colors, but to line thickness, line shape, anti-aliasing, and a variety of other properties.&lt;/p&gt;

&lt;h4&gt;Another Demonstration: Global Line Thickness&lt;/h4&gt;

&lt;p&gt;It's also possible to globally affect the appearance of naphthalene with a simple style sheet. For example, the following style sheet changes the line thickness and all line colors of naphthalene:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_css "&gt;* { stroke-width: 0.25; stroke: green; }&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;When the naphthalene SVG is rendered with this style sheet, the image shown below is produced. The "*" selector is a wildcard, applying to all elements in the SVG document. This version of the style sheet ignores our "hit" styling from the example above. The hit styling could easily be added back in by adding the appropriate class selector line to the CSS.&lt;/p&gt;

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

&lt;p&gt;You may notice in the image above that the leftmost vertical line appears clipped on its left side. This is because the SVG output from Structure-CDK exactly aligns the left line border with the leftmost side of the image area. By thickening the lines with a style sheet, we've overrun the image area. This could be fixed by moving the SVG viewport to the left. But that's a subject for another time.&lt;/p&gt;

&lt;h4&gt;A Limitation&lt;/h4&gt;

&lt;p&gt;It will probably never be possible to modify the distance between parallel lines, as for example in multiple bonds, with the CSS approach. These distances are set in the coordinate attributes of the line and path elements, and are independent of styling.&lt;/p&gt;

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

&lt;p&gt;Of course, we're just scratching the surface of what's possible with CSS and 2-D molecular structures. For example, the same principles outlined here could be used for atom coloring schemes and a variety of line and drawing properties. Various forms of interactive animation are even possible. Despite its limitations, SVG and CSS make a powerful combination for developing next-generation molecular rendering platforms.&lt;/p&gt;</description>
      <pubDate>Fri, 20 Oct 2006 14:02:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:92cce1c0-3ce1-43b9-8514-a5f6f7070085</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/10/20/molecular-style-sheets-combining-svg-and-css</link>
      <category>Graphics</category>
      <category>svg</category>
      <category>css</category>
      <category>stylesheet</category>
      <category>2</category>
      <category>d</category>
      <category>style</category>
    </item>
    <item>
      <title>The Chemically-Aware Web: Are We There Yet?</title>
      <description>&lt;p&gt;Recently, I wrote a tutorial on &lt;a href="http://depth-first.com/articles/2006/09/07/rendering-molecules-with-svg-on-the-web"&gt;embedding 2-D molecular renderings&lt;/a&gt; into webpages as Scalable Vector Graphics (SVG). This tutorial also contained a small experiment on the current chemical informatics capabilities of the Web.&lt;/p&gt;

&lt;p&gt;Here is a scenario from the near future: Joe is writing a review on Cephalosporin C that he wants to publish the modern way - directly to the Web. An entirely new concept in scientific publishing has started to take hold. Rather than submitting scientific articles to publishers, who then &lt;a href="http://wwmm.ch.cam.ac.uk/blogs/murrayrust/?p=28"&gt;make hamburger&lt;/a&gt; out of them and strip authors of their rights to reproduce their own work, a new system in which journals simply aggregate &lt;a href="http://depth-first.com/articles/2006/09/08/chemical-reviews-on-wikipedia"&gt;content already on the Web&lt;/a&gt; is gaining momentum. Some journals specialize in only including the very best scientific Web content available, and so enjoy a prestige factor. It's still a peer review system, but with inversion of control. The trick for scientists is getting their work indexed, and so noticed, in the first place.&lt;/p&gt;

&lt;p&gt;Joe just downloaded a new 2-D structure editor, FooChemPaint, that he heard can make the structure drawings in his review structure-searchable. Every chemist he knows is talking about a new free search engine called Haystac (&lt;u&gt;Hayst&lt;/u&gt;ac &lt;u&gt;A&lt;/u&gt;in't &lt;u&gt;C&lt;/u&gt;hmoogle) that lets them substructure-search the web. For some reason, you need to create your structures using FooChemPaint if you want your own documents to be included in the search results.&lt;/p&gt;

&lt;p&gt;After Joe finishes drawing Cephalosporin C with FooChemPaint, he chooses the File-&gt;Save As... menu item. Instead of saving as a JPG or PNG like he's done with other software, he saves the image as SVG. He then embeds the SVG into his review using a procedure similar to the &lt;a href="http://depth-first.com/articles/2006/09/07/rendering-molecules-with-svg-on-the-web"&gt;one I outlined previously&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From Joe's perspective, he hasn't done anything very new. But unknown to Joe, FooChemPaint has automatically inserted the &lt;a href="http://www.iupac.org/inchi/"&gt;InChI identifier&lt;/a&gt; of Cephalosporin C as metadata into his SVG document. This enables &lt;a href="http://depth-first.com/articles/2006/09/02/humanizing-line-notations"&gt;ordinary search engines&lt;/a&gt; such as &lt;a href="http://google.com"&gt;Google&lt;/a&gt; to associate the InChI with his SVG. The best part is that the entire process is essentially &lt;a href="http://depth-first.com/articles/2006/09/05/the-automatic-encoding-of-chemical-structures"&gt;invisible&lt;/a&gt; to Joe.&lt;/p&gt;

&lt;p&gt;Haystac is a web application that presents users with an &lt;a href="http://depth-first.com/articles/2006/08/21/four-free-2-d-structure-editors-for-web-applications"&gt;online structure editor&lt;/a&gt; for preparing molecular queries. When a structure query is submitted, Haystac searches its molecular database for matches. This database, in turn, was built by a web spider specifically designed to look for InChI identifiers, maybe with the &lt;a href="http://www.google.com/apis/"&gt;help of Google's Web API&lt;/a&gt;. One of Haystac's records for the structure of Cephalosporin C points to Joe's review article.&lt;/p&gt;

&lt;p&gt;Science fiction? Maybe. This is where the experiment comes in. Before I submitted the article on SVG, I manually annotated the SVG of Alprazolam with the corresponding InChI. The XML source can be viewed in Firefox by right-clicking on the SVG image and choosing &lt;strong&gt;This Frame-&gt;View Frame Source&lt;/strong&gt;, or alternatively &lt;a href="http://depth-first.com/demo/20060907/alprazolam.svg"&gt;here&lt;/a&gt;. Below is a fragment of the XML:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_xml "&gt;&lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;svg&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;RDF&lt;/span&gt;
    &lt;span class="namespace"&gt;xmlns&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;rdf&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://www.w3.org/1999/02/22-rdf-syntax-ns#&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="namespace"&gt;xmlns&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;rdfs&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://www.w3.org/2000/01/rdf-schema#&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="namespace"&gt;xmlns&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;dc&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://purl.org/dc/elements/1.1/&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;Description&lt;/span&gt; &lt;span class="attribute"&gt;about&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;http://depth-first.com&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
      &lt;span class="namespace"&gt;dc&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;title&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;InChI=1/C17H13ClN4/c1-11-20-21-16-10-19-17(12-5-3-2-4-6-12)14-9-13(18)7-8-15(14)22(11)16/h2-9H,10H2,1H3&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
      &lt;span class="namespace"&gt;dc&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;format&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;image/svg+xml&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
      &lt;span class="namespace"&gt;dc&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="attribute"&gt;language&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;en&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="namespace"&gt;dc&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;creator&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;Bag&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;li&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;Richard L. Apodaca&lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;li&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;Bag&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="namespace"&gt;dc&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;creator&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;Description&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="namespace"&gt;rdf&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;&lt;span class="tag"&gt;RDF&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="comment"&gt;&amp;lt;!-- etc. --&amp;gt;&lt;/span&gt;
&lt;span class="punct"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="tag"&gt;svg&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;Today I &lt;a href="http://www.google.com/search?hl=en&amp;amp;q=%22Rendering+Molecules+with+SVG+on+the+Web%22&amp;amp;btnG=Google+Search"&gt;searched&lt;/a&gt; for the title of my article in Google and found it. I then searched for the InChI in the SVG metadata and &lt;a href="http://www.google.com/search?hl=en&amp;amp;lr=&amp;amp;q=1%2FC17H13ClN4%2Fc1-11-20-21-16-10-19-17%2812-5-3-2-4-6-12%2914-9-13%2818%297-8-15%2814%2922%2811%2916%2Fh2-9H%2C10H2%2C1H3&amp;amp;btnG=Search"&gt;did not find it&lt;/a&gt;. Currently, a search of this InChI shows only one hit from the &lt;a href="http://redpoll.pharmacy.ualberta.ca/drugbank/"&gt;DrugBank&lt;/a&gt; database.&lt;/p&gt;

&lt;p&gt;The experiment failed in its stated goal of getting the InChI of Alprazolam indexed by Google via the metadata in its SVG rendering. Was it the formatting of my RDF tags? Is metadata just indexed more slowly than other content? Does Google just ignore metadata to avoid &lt;a href="http://www.clickz.com/showPage.html?page=3623139"&gt;keyword stuffing&lt;/a&gt; by Search Engine Optimization tricksters? Are embedded SVG documents ignored by Google altogether? Whatever the reason, the &lt;em&gt;technical&lt;/em&gt; barriers to a system like this working today are very low and dropping rapidly.&lt;/p&gt;</description>
      <pubDate>Wed, 13 Sep 2006 13:25:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:932bde09-0d72-45a6-a773-468c6711b760</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/09/13/the-chemically-aware-web-are-we-there-yet</link>
      <category>Web</category>
      <category>metadata</category>
      <category>svg</category>
      <category>google</category>
      <category>chemicalweb</category>
    </item>
    <item>
      <title>Generating and Serving 2-D Molecular SVGs</title>
      <description>&lt;p&gt;A &lt;a href="http://depth-first.com/articles/2006/09/07/rendering-molecules-with-svg-on-the-web"&gt;previous article&lt;/a&gt; showed some examples of 2-D molecular rendering using Scalable Vector Graphics (SVG) embedded in a web page. This article will outline some simple steps for generating these images and publishing them on the Web.&lt;/p&gt;

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

&lt;p&gt;This tutorial uses &lt;a href="http://depth-first.com/articles/2006/08/28/drawing-2-d-structures-with-structure-cdk"&gt;Structure-CDK&lt;/a&gt;, a &lt;a href="http://cdk.sf.net"&gt;CDK&lt;/a&gt; add-on library written in Java. You'll need to install Sun's JDK 1.4.2 or later (or an open source alternative). Although not required, &lt;a href="http://ant.apache.org/"&gt;Ant&lt;/a&gt; makes it easy to use Structure-CDK. You'll want to make sure that your browser is &lt;a href="http://depth-first.com/articles/2006/09/07/rendering-molecules-with-svg-on-the-web"&gt;SVG-enabled&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Creating a 2-D Molecular SVG File&lt;/h4&gt;

&lt;p&gt;&lt;center&gt;&lt;strong&gt;Methylenedioxymethamphetamine (MDMA)&lt;/strong&gt;&lt;/center&gt;
&lt;center&gt;
&lt;embed src="http://depth-first.com/demo/20060909/mdma.svg" TYPE="image/svg+xml" width=400" height="200" /&gt;
&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;An SVG image like the one shown above can be created with this sequence of steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download and unzip the &lt;a href="http://prdownloads.sourceforge.net/structure/structure-cdk-0.1.2.zip?download"&gt;current release&lt;/a&gt; of Structure-CDK.&lt;/li&gt;

&lt;li&gt;Move into the unzipped Structure-CDK directory and run the Structure Visual Testing Framework:&lt;br /&gt;

&lt;div class="console"&gt;
&lt;pre&gt;
$ cd structure-cdk-0.1.2
$ ant vis
&lt;/pre&gt;
&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;From the &lt;strong&gt;File&lt;/strong&gt; menu, choose &lt;strong&gt;Open...&lt;/strong&gt; and use the file dialog to open a molfile. The &lt;strong&gt;molfiles&lt;/strong&gt; directory contains some samples.&lt;/li&gt;

&lt;li&gt;Resize the image to taste and choose &lt;strong&gt;Save as SVG...&lt;/strong&gt; from the &lt;strong&gt;File&lt;/strong&gt; menu. This writes the SVG image to a directory and filename of your choice.&lt;/li&gt;

&lt;/ol&gt;

&lt;h4&gt;Viewing the SVG File&lt;/h4&gt;

&lt;p&gt;You now have several options for viewing the SVG file. One of the simplest is to open it with the &lt;a href="http://www.mozilla.com/firefox/"&gt;Firefox browser&lt;/a&gt;. Another option is to open it with the excellent, free SVG editor &lt;a href="http://www.inkscape.org/"&gt;Inkscape&lt;/a&gt;. From Inkscape, you can edit your image, apply any number of special effects from the mundane to the remarkable, and save the result to disk.&lt;/p&gt;

&lt;h4&gt;Deploying the SVG File on the Web&lt;/h4&gt;

&lt;p&gt;After uploading your SVG file to a blog or other site, you may have some additional configuration to do. Because the SVG MIME type is not configured by default on all servers, you may need to do so yourself.&lt;/p&gt;

&lt;p&gt;After uploading my first set of SVG files to my server, I tried to view them in Firefox. Instead of seeing the expected image in the browser window, I got a dialog asking if I wanted to open it with Inkscape or save it to disk.&lt;/p&gt;

&lt;p&gt;With the help of &lt;a href="http://www.mozilla.org/projects/svg/faq.html#choose-a-program"&gt;some documentation&lt;/a&gt;, I was able to track the problem down to my server, which was using the MIME type "image/svg-xml" instead of "image/svg+xml". The former is the obsolete SVG MIME type, which Firefox rejects. Internet Explorer equipped with Adobe's SVG plugin, on the other hand, accepts the obsolete MIME type, rendering SVG without presenting a dialog. &lt;a href="http://web-sniffer.net/"&gt;Web-Sniffer&lt;/a&gt;, which decodes header information from HTTP responses, may be useful for debugging your server's MIME type configuration.&lt;/p&gt;

&lt;p&gt;Having configured your server's SVG MIME type as "image/svg+xml", pointing your browser to your SVG file's URL will let you view it in its full, W3C-compliant glory.&lt;/p&gt;

&lt;h4&gt;Embedding the SVG File in HTML&lt;/h4&gt;

&lt;p&gt;There are a few options for embedding an SVG image in HTML. The most universally-applicable mechanism is the &lt;code&gt;&amp;lt;embed&amp;gt;&lt;/code&gt; tag:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_xml "&gt;&lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&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="tag"&gt;head&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="tag"&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="tag"&gt;body&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="comment"&gt;&amp;lt;!-- document body --&amp;gt;&lt;/span&gt;

  &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt;&lt;span class="tag"&gt;embed&lt;/span&gt; &lt;span class="attribute"&gt;src&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;url-to-svg-file.svg&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;TYPE&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;image/svg+xml&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;width&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;400&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt; &lt;span class="attribute"&gt;height&lt;/span&gt;&lt;span class="punct"&gt;=&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;400&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&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="tag"&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="tag"&gt;head&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;Embedding SVG into HTML carries some limitations. For example, you can't interact with the SVG DOM the way you can if the SVG is inlined, or placed directly into the HTML document itself. But that's a subject for another time.&lt;/p&gt;

&lt;p&gt;Creating and deploying 2-D molecular images as SVG documents is a straightforward process, provided that some details are taken care of. Future articles in this series will show how SVG's advanced features make it a compelling choice as a chemical informatics rendering platform.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: if your're viewing this article in a feed aggregator, the SVG images may have been stripped out. If so, please see the &lt;a href="http://depth-first.com/articles/2006/09/09/generating-and-serving-2-d-molecular-svgs"&gt;original article&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 09 Sep 2006 14:45:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:bff458bc-90f4-474f-8a46-b6e915aa34c5</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/09/09/generating-and-serving-2-d-molecular-svgs</link>
      <category>Graphics</category>
      <category>svg</category>
      <category>2d</category>
      <category>structurecdk</category>
      <category>web</category>
    </item>
    <item>
      <title>Rendering Molecules with SVG on the Web</title>
      <description>&lt;p&gt;&lt;a href="http://www.w3.org/Graphics/SVG/"&gt;Scalable Vector Graphics&lt;/a&gt; (SVG) is an XML-based language for encoding graphical content. Unlike raster image formats such as PNG, JPEG, and GIF, SVG images can be scaled to any resolution without pixelation. Given that 2-D structure diagrams are essentially line drawings, SVG seems like a natural fit for this type of representation. SVG also boasts several advanced features that make it an especially intriguing choice.&lt;/p&gt;

&lt;p&gt;In this first article of a series on SVG and chemical informatics, I'll start by showing some embedded SVG images of molecules (also see &lt;a href="http://www.adobe.com/svg/demos/devtrack/chemical.html"&gt;this demo&lt;/a&gt;). Later articles will discuss technical details such as writing, reading, animating, scripting, editing, annotating, and distributing 2-D structures encoded as SVG.&lt;/p&gt;

&lt;h4&gt;Now, the Bad News&lt;/h4&gt;

&lt;p&gt;SVG is a work in progress. Browser support and performance can vary widely. If you are using &lt;a href="http://www.mozilla.com/firefox/"&gt;Firefox&lt;/a&gt; version 1.5 or better, you should be able to see all of the images in this article without doing anything.&lt;/p&gt;

&lt;p&gt;Unfortunately for Internet Explorer users, Microsoft's browser lacks built-in SVG support. Still worse, IE 7 appears ready to continue this perplexing tradition. Fortunately, Adobe offers an &lt;a href="http://www.adobe.com/svg/viewer/install/main.html"&gt;SVG plugin for IE&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Although this page was tested in both IE 6 (with Adobe's plugin) and Firefox 1.5 (both Windows and Linux), your particular configuration may vary. Please feel free to post your experiences.&lt;/p&gt;

&lt;h4&gt;Some Simple SVG Structures&lt;/h4&gt;

&lt;p&gt;The examples below illustrate how SVG images of molecules can be embedded in an HTML document. These images just scratch the surface of what is possible. If you don't see 2-D structures, your browser may lack SVG support.&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;strong&gt;Ascorbic Acid&lt;/strong&gt;&lt;/center&gt;
&lt;center&gt;
&lt;embed src="http://depth-first.com/demo/20060907/ascorbic_acid.svg" TYPE="image/svg+xml" width=350" height="400" /&gt;
&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;strong&gt;Alprazolam&lt;/strong&gt;&lt;/center&gt;
&lt;center&gt;
&lt;embed src="http://depth-first.com/demo/20060907/alprazolam.svg" TYPE="image/svg+xml" width=350" height="400" /&gt;
&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;strong&gt;Furosemide&lt;/strong&gt;&lt;/center&gt;
&lt;center&gt;
&lt;embed src="http://depth-first.com/demo/20060907/furosemide.svg" TYPE="image/svg+xml" width=350" height="300" /&gt;
&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;strong&gt;DDT&lt;/strong&gt;&lt;/center&gt;
&lt;center&gt;
&lt;embed src="http://depth-first.com/demo/20060907/ddt.svg" TYPE="image/svg+xml" width=350" height="300" /&gt;
&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: if your're viewing this article in a feed aggregator, the SVG images may have been stripped out. If so, please see the &lt;a href="http://depth-first.com/articles/2006/09/07/rendering-molecules-with-svg-on-the-web"&gt;original article&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 07 Sep 2006 13:56:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3a3ac56e-c8a6-4853-8765-80ef16dec5a7</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/09/07/rendering-molecules-with-svg-on-the-web</link>
      <category>Graphics</category>
      <category>web</category>
      <category>svg</category>
      <category>2d</category>
      <category>firefox</category>
    </item>
    <item>
      <title>Computational Perception and Recognition of Digitized Molecular Structures</title>
      <description>&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/files/hand_drawn_1990_small.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;Summing up, the system described here, entirely developed in C (Vax C/Ultrix-32, version 1.0), can perceive and recognize complex type-printed molecular structures and allows one[sic] for the automatic input of this graphic information to a computer system. For hand-printed molecular structures however, there are some limitations for character recognition but not for graph (skeleton) recognition.&lt;/p&gt;

    &lt;p&gt;&lt;cite&gt;-M. Leonor Contreras et al. &lt;a href="http://dx.doi.org/10.1021/ci00067a014"&gt;J. Chem. Inf. Comput. Sci. 1990, 30, 302-307&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Raster images of 2-D molecular structures are everywhere - in books, in journal articles, on photocopies, in notebooks, and most importantly, on the internet (for example, on &lt;a href="http://www.lipitor.com/cwp/appmanager/lipitor/lipitorDesktop?_nfpb=true&amp;amp;_pageLabel=prescribingInformation"&gt;this page&lt;/a&gt; and &lt;a href="http://depth-first.com/articles/2006/08/24/scripting-cdk-with-jruby"&gt;this one&lt;/a&gt;). Although readily interpretable by humans, these renderings are useless to computer indexing systems - unless they can be translated into machine-readable representational schemes such as connection tables.&lt;/p&gt;

&lt;p&gt;Ideally, content providers would encode their documents in such a way that chemical structure information is machine-indexable. Sadly, there are numerous options, no standard, and few tools specifically designed for doing so. Although the recent introduction of &lt;a href="http://www.iupac.org/inchi/"&gt;InChI&lt;/a&gt; may provide a solution going forward, raising awareness to the level needed to produce a significant change will take some time. Even if an encoding system can be standardized, it can't address the problem of the thousands, if not millions, of documents already in existence.&lt;/p&gt;

&lt;p&gt;The work by Contreras and coworkers was apparently one of the earliest reported attempts at solving this problem. A &lt;a href="http://dx.doi.org/10.1021/ci034017n"&gt;more recent work&lt;/a&gt; proposes the interesting possibility of using a two step process in which a raster image is converted first to an &lt;a href="http://www.w3.org/TR/SVG/"&gt;SVG&lt;/a&gt; document. In a separate step, this SVG document is then converted into a 2-D structure representational scheme. Free software capable of performing raster-&gt;SVG conversions is available (for example, &lt;a href="http://autotrace.sourceforge.net/"&gt;Autotrace&lt;/a&gt; and &lt;a href="http://potrace.sourceforge.net/"&gt;Potrace&lt;/a&gt;). Given the heterogeneous nature of images on the web, automated image prescreening would be essential. The use of Machine Vision techniques was proposed as one solution.&lt;/p&gt;

&lt;p&gt;As more chemical content makes its way to the web, the problem only gets worse. Fortunately, most of the raster images being posted are machine-generated with regular features. Raster image conversion has never been one of the more active areas of chemical informatics. Has the time come to revisit this problem? Going forward, what kinds of tools could content providers be given help them make their documents more searchable?&lt;/p&gt;</description>
      <pubDate>Fri, 25 Aug 2006 13:52:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:06ea50ba-98e0-45d5-ae5d-b3cf6e054e46</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/08/25/computational-perception-and-recognition-of-digitized-molecular-structures</link>
      <category>Meta</category>
      <category>raster</category>
      <category>svg</category>
    </item>
  </channel>
</rss>
