Home   |   Products   |   Consulting Services   |   Contact us    



  Chemical Registration
  Reaction-based Libraries
  DocScan - NEW!
  NMRPredict Version 2
  Chemical Supplier Catalogue
  Database Integration
  Structure Drawing Control
  Imaging Suite
  Barcode Solutions





smi2image.cgi - Web CGI to create images from SMILES


smi2image.cgi is a CGI program that converts SMILES into images using the Daylight Depict Toolkit, for showing molecules in a web page. It can either create a drawing ``from scratch'' using Daylight's depict algorithm, or it can use X/Y coordinates supplied in the URL. Images can be GIF, PNG or JPEG format.

smi2image.cgi is designed to be used with the Apache web server (see http://www.apache.org/ ) but should work with any CGI-compliant web server.

smi2image.cgi is written in Perl, and uses the DayPerl2.pm module, which is freely available. (Contact Modgraph, http://www.modgraph.co.uk if you need the source code for DayPerl2.)


All parameters are specified in the URL, for example:


The SMILES string of the molecule that is to be drawn. This is the only required parameter.

Note that SMILES must be properly ``quoted'' to eliminate characters that are disallowed or have special meaning in a URL. In particular, the following characters that are legal in a SMILES must be ``escaped'', or converted to the three-character %NN code:

    %   %25          /   %2F
    #   %23          <   %3C
    $   %24          >   %3E
    &   %26          [   %5B
    *   %2A          \   %5C
    +   %2B          ]   %5D
    -   %2D          |   %7C

X/Y coordinate pairs for each atom in the SMILES. Coordinates are specified in SMILES order, two numbers per atom, and are separated by commas. For example:


Image width in pixels (default: 300)

Image height in pixels (default: 200)

cob, cow, bow, wob, for color-on-black, color-on-white, etc. These are actually filenames in the colorscheme directory, for example ./colorscheme/blue_theme would be '-c blue_theme'. Other colorschemes can be created in a subdirectory called 'colorscheme' in the current directory. Colorscheme names must be lowercase. If no colorscheme is specified, or if the specified colorscheme can't be found, color-on-black is used.

Colors the atoms by highlighting the atoms indicated in the parameter's string. The string is in canonical-smiles order, and each character is a single number that corresponds to the colors in the colorscheme file (i.e. 0 = first color, 1 = second color, ...).

For example, the following would color the first two atoms (the N-C) using the second color in the color scheme, and the rest of the atoms in the cyclohexane using the first color in the color scheme:


transparent yes | no
If ``transparent'' is ``yes'', uses a transparent background for GIF or PNG images (ignored for JPG images). This has the effect of drawing the atoms and bonds on top of the background color or texture of the web page. (Default: no)

(NOTE: Incredibly, Internet Explorer can't show transparent colors in PNG images. They are shown non-transparent. Other browsers such as Firefox will show the transparent images correctly.)


the Modgraph Imaging Suite main page

the mol2image main page

the dmol2image main page

the reg2image main page