HOME CONSULTING WEB LINUX ARTICLES PROGRAMS REFERENCES
scicomp
Dr. Marco B.R. Engeler

InchiServlet

InChI (= IUPAC International Chemical Identifier) is an identifier for a chemical substance. There also exists a hashed version known as InChIKey. The InChI project aims at providing a standard for identifying and searching chemicals on the web. The C source code to create InChIs and InChIKeys is released by IUPAC under the LGPL.
The InchiServlet presented here is an all Java solution. Lately we had the need to create InChiKeys. Ease of deployment of the program was more of concern than performance. We therefore decided to use the NestedVM to create a Java version of the original IUPAC program and to call it from a Servlet.
The InChiServlet and the associated Connector are also released under the LGPL and without any warranty. The InchiServlet.war has been tested under Tomcat 6 on Linux and Windows XP.

Installation

To install the servlet you can simply download the InchiServlet.war and deploy it in your application server. The index.html of the project contains a form which lets you test the capabilities of the servlet. A small usage guide is included below.

Using the servlet

 

The servlet accepts the following input parameters

  • inputFormat (requried)
    At the moment the only accepted input format is mol. This works also works for SDF files.
  • outputFormat (required)
    Possible values for output format are
    • xml: Returnes the full content of the outFile, logFile and problemFile produce by the InChI program wraped up in an XML document (Example)
    • inchiOnly: returnes a tab separated list containing structure number and InChI
  • file (required if url is not set)
    Contains the MOL or SDF file when submitting the data as multipart/form-data
  • url (required if file is no set)
    An URL that points towards a MOL or SDF file
  • hash (option)
    If hash is set to true InChIKeys will also be created

 

Sending multipart requests

In order to simplify connecting to the servlet from a java program the project includes the InchiServletConnector.jar which is based upon the Apache Commons http client 3.x.

Examples

All examples are based on an SDF file which contains the PubChem compounds 1-1000 (download).

Full XML output with InChiKey

URL:

localhost:8080/InchiServlet/InchiServlet?inputFormat=mol&outputFormat=xml&hash=true&url=http://localhost/compound.sdf

 

Output: download

InChi only

URL:

localhost:8080/InchiServlet/InchiServlet?inputFormat=inchiOnly&outputFormat=xml&hash=false&url=http://localhost/compound.sdf

 

Output: download

InChi only with InChiKey

URL:

localhost:8080/InchiServlet/InchiServlet?inputFormat=mol&outputFormat=xml&hash=true&url=http://localhost/compound.sdf

 

Output: download

Performance

As the servlet needs to start up an external JVM to run the Java version of the InChI code there is quite a high latency. We therefore recommend to input multiple structures using SDF.

Download