DCGI Manual

Daylight Common Gateway Interface package

Daylight Version 4.9
Release Date 08/01/11

Copyright notice

This document is copyrighted © 1994-2011 by Daylight Chemical Information Systems, Inc. Daylight explicitly grants permission to reproduce this document under the condition that it is reproduced in its entirety, including this notice. All other rights are reserved.

Table of Contents

1. Introduction
2. Common features
3. Special-purpose DCGI programs
4. General-purpose DCGI programs
5. DCGI tools
6. DCGI Administration
7. Editor Configuration

1. Introduction

CGI (Common Gateway Interface) is a standard method to provide interactive functionality in a web-based environment. DCGI (Daylight CGI) is a set of programs and tools which perform various chemical information tasks using CGI. This document provides a description of the DCGI package as supplied with the current release of Daylight Software.

2. Common features

DCGI programs consist of a series of HTML pages which are designed to be used with a web browser such as Netscape Communicator.

The DCGI philosophy is to provide tools with interfaces which are as simple as possible. Given general familiarity with a web browser, a DCGI user should be able to click-and-play immediately without the need for special training. The DCGI system is a set of special-purpose programs which are designed to be run on an intranet. To this end, DCGI configuration is done centrally by an administrator, which frees the user from having to know things such as the names of current servers, databases and datatypes. Whenever possible, DCGI program interfaces are oriented to a "What do you want to know? Here it is." design, e.g., WDI. A small of general purpose DCGI programs are also provided for use by more advanced users (currently just two: Hyperthor and Wizard).

DCGI pages contain a standard header which identifies the program and provides links to instructions (Help), frequently asked questions (FAQ), database documentation (as appropriate) and other relevant HTML pages.

The DCGI programs all use a common mechanism for structure editing. If configured (see section 7), structure entry form elements will have one or two associated buttons. By selecting these buttons one can edit a structure using a preconfigured graphical editor. The structure can then be submitted back to the form element.

3. Special-purpose DCGI programs

Most DCGI programs are designed to perform specific chemical tasks and have very straightforward user interfaces. These programs are described in the following section, starting with the simplest ones. Most of the documentation is also available directly from the corresponding DCGI pages (HELP, FAQ, etc.).

3.1 Depict

Function: interactive display of SMILES as a structural diagram
DCGI page: on your intranet
Example: on your intranet  (diagram of H+ catalyzed esterification)
Instructions: on your intranet
Notes: The Depict CGI can be used interactively by typing (or pasting) a SMILES into the text entry field and clicking "Submit". It can also be used as a display tool by invoking it with a hex-encoded SMILES argument, which sets the initial state. Many DCGI programs link thumbnail depictions to the Depict CGI to allow users to conveniently examine structural diagrams at a larger size.

Along with SMILES for simple molecules, the Depict CGI handles isotopism, isomerism, and reactions.

3.2 CLOGP

Function: calculate n-octanol/water partition coefficient given a SMILES
DCGI page: on your intranet
Example: on your intranet  (CLOGP3 calculation for caffeine)
Reference: on your intranet
Notes: The CLOGP3 algorithm was developed by the Pomona College MedChem Project and is supported by the BioByte Corporation.

3.3 CMR

Function: calculate molar refractivity (polarizability) given a SMILES
DCGI page: on your intranet
Example: on your intranet  (CMR calculation for caffeine)
Reference: on your intranet
Notes: The CMR algorithm was developed by the Pomona College MedChem Project.

3.4 MedChem

Function: find activity, pKa, LogP and MR information about a molecule
DCGI page: on your intranet
Example: on your intranet  (data for caffeine)
Instructions: on your intranet
FAQ: on your intranet
Notes: This DCGI program integrates database lookup and calculations to provide a "one stop shop" for MedChem/BioByte-related functionality. Information displayed includes: pharmacological activity type, LogP and MR (all measured values with citations, preferred value, computed value), measured pKa values with citations, name(s), CAS number(s), molecular formula, and computed 3-D coordinates.

Useful query identifiers for Medchem include name, SMILES, WLN and CAS Number.

MedChem CGI uses the medchem database, CLOGP3 and CMR algorithms developed by the Pomona College MedChem Project and supported by the BioByte Corporation.

3.5 WDI (World Drug Index)

Function: find drug information about a molecule
DCGI page: on your intranet
Example: on your intranet  (drug data for caffeine)
Instructions: on your intranet
FAQ: on your intranet
Notes: The wdi DCGI program implements a very user-friendly interface: just enter the drug for which you want information (SMILES, name or CAS Number) and you get the results on the same "web page". If your identifier is ambiguous, i.e., it applies to more than one drug entry, you get information for all such entries (e.g., try "glucose").

Types of drug information in wdi include: indications and usage, precautions and warnings, contraindications, interactions, adverse effects, mechanism of action and various identifiers such as trade names.

Useful query identifiers for wdi include SMILES, CAS numbers and names. Name lookup is especially useful because the wdi database includes a comprehensive list of trade names, preferred names, International Names (INN) and United States Adopted Names (USAN).

This DCGI program uses the wdi database, which is compiled from, developed and supported by Derwent World Drug Index

3.6 ACD (Available Chemicals Directory)

Function: find availability, prices and ordering information for chemicals
DCGI page: on your intranet
Example: on your intranet   ACD page for caffeine**
Instructions: on your intranet
FAQ: on your intranet
Notes: The acd DCGI program implements a four-page interface: (1) a query page (enter name, SMILES, or catalog/CAS/ACD number); (2) a page summarizing results; (3) a "bookmarkable" table of catalog entries (with grade, purity, remarks) sorted by price; and (4) a page containing ordering information (supplier name, address, phone, fax, etc.)

Catalog entries include: catalog number, supplier, catalog name, grade, purity, cost/unit, normalized price in $US/g, remarks and update code.

Supplier entries include: company name, full address, telephone and fax numbers, catalog name, catalog description, number of compounds in catalog and supplier's notes.

Result pages are "bookmarkable" and include separately indexed tables for all available isomers/isotopes.

Useful query identifiers are SMILES, Name, CAS Number and especially catalog number (enter any catalog number, the result summary page will show the appropriate catalogs automatically!)

This DCGI program uses the acd database, which is maintained by MDL Information Systems, Inc. **MDLI prohibits live ACD demos on WWW, so only the single HTML page for caffeine is provided as example.

3.7 Savant

Function: find synthetic papers and patents for structures similar to a SMILES
DCGI page: on your intranet
Example: on your intranet  (synthetic literature for caffeine)
also available: query page   search summary   results/references
Instructions: on your intranet
FAQ: on your intranet
Notes: The savant DCGI program implements an easy-to-use interface which delivers essential references to synthetic literature quickly and reliably. The user (chemist) enters a structure; the program shows the structure (if available) and similar structures which are in the synthetic literature (synthetic journal articles and patents); full citations are available in all cases. This is the most painless way to do a synthetic literature search!

Literature references for isotopes and isomers are provided as separately indexed tables on Savant's bookmarkable reference pages.

This DCGI program uses the spresipreps database, which is developed and supported by Infochem, GmbH.

4 General-purpose DCGI programs

Two general purpose programs are provided in this release (4.62): Hyperthor and Wizard. These programs were part of the preliminary DCGI development suite and are not part of the supported DCGI package. They do not live up to DCGI simplified interface standards, e.g., they are not centrally configurable, the user needs to know server and database names, select datatypes, etc. Sorry! They are provided for use by "power users" until permanent replacement programs are available.

4.1 Hyperthor

Function: access and display data in Thor databases
DCGI page: on your intranet
Example: (Static examples): display choice   datatree display   table of pKa measurements
Instructions: on your intranet
FAQ: on your intranet
Notes: Hyperthor provides a general CGI interface to Thor databases. Using standard HTML/CGI FORM elements, a user selects a database on a Thor server, specifies an identifier type and value, then selects from various display options. Hypertree and HTML tables are used to display the contents of Thor datatrees.

The datatree display utility Hypertree provides a number of advanced features, such as multiple 2-D drawings using database coordinates and 3-D model downloads.

4.2 Wizard

Function: write MCL (Merlin Control Language) programs using a CGI interface
DCGI page: on your intranet
Example: (Static examples):Wizard specification  MCL program  program output
Instructions: on your intranet
FAQ: on your intranet
Notes: Wizard attempts to provide a simplified mechanism for writing exploratory data analysis programs in MCL.

5. DCGI tools

A number of utilities are available to people who would like to write their own DCGI-style programs, or to customize the programs in the standard set. Supported entry points (URLs) are described below.

5.1 smi2gif, smi2gif-bop, smi2gif-small

Function: convert a SMILES to a structural diagram in GIF format
URL: /daycgi/smi2gif /daycgi/smi2gif-bop /daycgi/smi2gif-small
Examples: <A HREF="/daycgi/smi2gif?43434f">
<A HREF="/daycgi/smi2gif-bop?43434f">
<A HREF="/daycgi/smi2gif-small?43434f">
Notes: smi2gif accepts one a hex-encoded SMILES argument and produces a depiction as a 400x200-pixel, color-on-black GIF file suitable for display on a web page. smi2gif-bop is identical to smi2gif, except that produces a black-on-paper GIF file (i.e., with transparent background) which is more suitable for printing than color-on-black. smi2gif-small is also identical to smi2gif, except that it produces a very small 96x64-pixel GIF image, suitable for use as a thumbnail, e.g.:
	  <A HREF="/daycgi/smi2gif?43434f">
            <IMG SRC="/daycgi/smi2gif-small?43434f">
	  </A>
        
Produces this thumbnail (click on it for larger image):

A more flexible utility is planned for the future (JavaDepict). However, these three smi2gif URLs will continue to be part of the supported DCGI package.

5.2 depict revisited

Function: display SMILES as a structural diagram
URL: /daycgi/depict
Examples: <A HREF="/daycgi/smi2gif?43434f">
Notes: This is the same depict DCGI program which is discussed above. It is a useful tool in DCGI programs, e.g., when access to both SMILES and a full-size structural diagram is desired, but would interrupt the flow of the page as in this reference to ethanol. The availability of SMILES in the Depict CGI entry field means that users can select and copy the SMILES for other purposes.

5.3 CLOGP revisited

Function: DCGI-oriented CLOGP calculation from a shell script
Notes: This is the same CLOGP DCGI program that was discussed previously. It is mentioned here because it is a simple /bin/sh shell script and it's a good model to start DCGI programming.

6. DCGI Administration

One of the reasons that DCGI programs are easy to use is that end-user doesn't have to know details such as server and database names. There is a price of course, which is that the Daylight Software Administrator has to configure the DCGI package properly. We have attempted to design this system so that configuration is simple and robust. If you can set up an httpd server, you should have no trouble with the following. If you have any difficulties, remember that Daylight's installation support is available to everyone.

6.1. Edit the DCGI initialization file dcgi_env.sh

CGI programs run as a special user (typically "nobody" or "http") in a very limited environment. Anything "special" needs to be defined by each CGI program. All DCGI programs execute the script /daycgi/dcgi_env.sh to set up a standard DCGI environment. As part of installation, you must edit this script (as distributed, the initial state is to fail with a warning).

    (a) Make a copy of /daycgi/dcgi_env.sh (e.g., dcgi_env.sh.orig)

    (b) Open /daycgi/dcgi_env.sh using your favorite text editor.

    (c) If this is a fresh installation, remove or comment out the initial warning section.

    (d) Edit symbols as per comments in the file. You can use the predefined settings for most things, but the following symbols typically need to be redefined:

      DY_ROOT
      The default value is /usr/local/daylight/version, but if it's installed somewhere else on your system, be sure to set DY_ROOT appropriately.

      DY_LICENSEDATA
      Should point to license file. Recommended: /usr/local/daylight/dy_license.dat.

      LD_LIBRARY_PATH
      The default value is usually correct, but this path must include $DY_ROOT/lib for all Daylight Software Releases 4.61 and later.

      CX_ROOT
      CEX is needed for RasMol 3D viewer.

      DCGI_ACDSPEC
      If you have the acd database running on a thorserver, change the default (demo) database spec to the appropriate value.

      DCGI_MEDCHEMSPEC
      If you have the medchem database running on a thorserver, change the default (demo) database spec to the appropriate value.

      DCGI_WDISPEC
      If you have the wdi database running on a thorserver, change the default (demo) database spec to the appropriate value.

      DCGI_SAVANT_MERLINSPEC
      If you have a spresi database running on a merlinserver, change the default database spec (spresi95demo) to the appropriate value. This is typically spresi95preps unless you are serving the whole spresi95 database in merlin.

      DCGI_SAVANT_THORSPEC
      If you are serving spresi95preps from merlinserver, change the change the default (spresi95demo) to the appropriate value (typically spresi95, not spresi95preps).

    6.2. Check the Daylight passwords file dy_passwords.dat

    Check that the daylight passwords file (typically /usr/local/daylight/dy_passwords.dat allows user "anonymous" access to database servers, e.g., if no server access password is required, it should include the line:

          user:anonymous:
    

    6.3. Check the system services file /etc/services

    Check that the file /etc/services defines thor and merlin services as:

          thor     5555/tcp   # Daylight server
          merlin   5556/tcp   # Daylight server
    

    6.4. Check the httpd configuration file httpd.conf

    Check that the httpd configuration file (typically httpd.conf, i.e., for Apache 1.3.9) defines the following three aliases, where /usr/local/daylight is replaced by the appropriate value for your system:

       Alias              /dayhtml/        /usr/local/daylight/v471/dayhtml/
       ScriptAlias        /daycgi/         /usr/local/daylight/v471/daycgi/
    
    You will need to restart the httpd server for these to take effect.
That's all for the installation. In order to configure graphical editors to work with Daycgi, see the next section. If you license new databases or install a new version of the Daylight Software, you may need to modify the files or repeat the above installation.

7. Editor Configuration

Daycgi uses two sets of environment variables to control graphical input of structures.

    DCGI_EDITOR1_URL
    When set, this is the URL of an editor subwindow.
    DCGI_EDITOR1_WLABEL
    This is the name of the subwindow object. Note that this must be a valid javascript object name.
    DCGI_EDITOR1_OPTIONS
    This is the option string for the creation of the new subwindow.
    DCGI_EDITOR1_BLABEL
    This is the label for the editor button in the Daycgi application windows.

    DCGI_EDITOR2_URL
    When set, this is the URL of an editor subwindow.
    DCGI_EDITOR2_WLABEL
    This is the name of the subwindow object. Note that this must be a valid javascript object name.
    DCGI_EDITOR2_OPTIONS
    This is the option string for the creation of the new subwindow.
    DCGI_EDITOR2_BLABEL
    This is the label for the editor button in the Daycgi application windows.

One (or two) editor buttons will appear on the daycgi application pages if either (or both) of the DCGI_EDITOR1_URL and DCGI_EDITOR2_URL environment variables are set. The editor buttons case a subwindow to be loaded with the appropriate URL. The subwindow should provide Javascript functions to communicate with it's parent window. It refers to the parent windows structure entry form element with the functions "opener.GetRootSmiles()" and "opener.PutRootSmiles(val)".

The default configuration provides the CGI-based grins application as EDITOR1. Example subwindow HTML pages for JME and Chemdraw Plugin are provided in the /dayhtml/edit/ directory. These will need to be configured to work with the appropriate editor on the local server. The application /daycgi/testgrins can be used to test editor and inter-window communication.