Overview
This project is based on InChI, an open-source binary tool that generates InChI and InChI Key of molecules from their structural information (MOL / SDF file).
This REST-API offers the same type of functionality, and can generate the InChI and the InChI Key of a molecule from its MOL/SDF in plain text or as a file.
It was developed in order to be use in a microservice architecture.
Prerequisites
To run the application on your machine you must :
Install the management tool Maven. If you don’t already have it, you can, on Linux, download it with the following command :
$ sudo apt install maven
Download the binary program InChI (INCHI-BIN.zip) and put it in a folder called
bin
at the root of the project.
Caution
Check that the binary has the correct rights and can be executed.
Installation
You can install this API by different ways.
Locally
You can install the API on your machine to use it locally.
First clone the git repository :
$ git clone https://git.mesocentre.uca.fr/unh-metabocloud/inchi-api.git
Move into the newly created folder inchi-api
and launch the following command to compile the REST API into a JAR (.jar) :
$ cd inchi-api
$ mvn -Dmaven.test.skip=true package
Note
The option -Dmaven.test.skip=true
enables to launch the application without running the unit tests.
If you want to execute the tests, you just have to remove it or set the option to false
.
Then you can run the application from the newly created JAR :
$ java -jar target/metabocloud-inchi-api-1.06.jar
Note
By default, the application is launched on port 8082
with the log level set to INFO
. But you can configure both parameters.
Use the option
-Dserver.port
to choose the port on which you want the application to listen :$ java -Dserver.port=8080 -jar target/metabocloud-inchi-api-1.06.jarUse the option
--debug
to run the application inDEBUG
level :$ java -jar target/metabocloud-inchi-api-1.06.jar --debugYou can of course use both options in the same time :
$ java -Dserver.port=8080 -jar target/metabocloud-inchi-api-1.06.jar --debugThe application will then be launched in debug mode on the port 8080.
With Docker
You can also launch the application by building a Docker image from the Dockerfile
. This method enables to build a container with the application
and all the required dependencies in a single command.
First, clone the git repository if not already done :
$ git clone https://git.mesocentre.uca.fr/unh-metabocloud/inchi-api.git
Then move into the repository and run the bash script build_docker_image.sh :
$ cd inchi-api
$ ./build_docker_image.sh
You can now launched the application from the docker image :
$ docker run -p 8082:8082 inchi
Note
You can also parameter the port and the log level :
$ docker run -e DEBUG=true -p 8080:8082 inchi
This command will launched the application on the port 8080 in debug mode.
Web usage
You can use this application locally on your machine after installing it as explained in the section above, but you can also use it directly from the
MetaboCloud Web Portal by querying it at the following domain : https://metabocloud.mesocentre.uca.fr/inchi/
See the Swagger documentation below for details of the endpoints available.
Documentation
You can find information on the use of this REST API :
Here on this documentation, for the generic information about the API and some examples of use.
On the Swagger documentation for the information about the different endpoints available such as accepted requests, required parameters, possible responses, as well as examples.
References
Heller, S.R., McNaught, A., Pletnev, I. et al. InChI, the IUPAC International Chemical Identifier. J Cheminform 7, 23 (2015). https://doi.org/10.1186/s13321-015-0068-4