Examples

The examples below were obtained using the InDex REST API on MetaboCloud Web Portal. The InChI Key used as input were obtained from Chemical Entities of Biological Interest (ChEBI).

Note

All examples described below are using GET type request.


Get a file associated with a molecule

This application offers the functionality of retrieving a structure/representation file associated with a molecule in a specific community from an InChI Key of a compound, along with associated metadata returned in the HTTP response headers. It is provided by the /compounds/{inchiKey}.{format} endpoint.

Currently, only one community is available, which is chebi containing files coming from the ChEBI database.

Two types of format are available in the chebi community :

  • png : to retrieve a PNG image along with its associated metadata

    X-Metadata-Chebi-Id : XXXX # The ChEBI ID
    X-Metadata-Creation-Date : YYYY-MM-DD # The date on which the MOL file was stored in the S3
    X-Metadata-Data-License : Creative Commons License (CC BY 4.0) # The MOL file license
    X-Metadata-Data-Source : Chemical Entities of Biological Interest (ChEBI) Database # The MOL file provenance
    X-Metadata-Image-Size : XXX x XXX px # The image size (in pixels)
    
  • mol : to retrieve a MOL file along with its associated metadata

    X-Metadata-Chebi-Id : XXXX # The ChEBI ID
    X-Metadata-Creation-Date : YYYY-MM-DD # The date on which the MOL file was stored in the S3
    X-Metadata-Data-License : Creative Commons License (CC BY 4.0) # The MOL file license
    X-Metadata-Data-Source : Chemical Entities of Biological Interest (ChEBI) Database # The MOL file provenance
    

In addition of the two mandatory parameters inchiKey and format, three optional parameters are available :

  • community (“chebi” by default) : to indicate from which community the file must be retrieved (currently, only chebi is available)

  • outputType (“url” by default) : to choose the type of output wanted, either as a URL or as the resource directly (url or resource)

  • size (“medium” by default) : when retrieving a PNG image only, it is for choosing the size of the image among three available. (small : 50 x 50 px, medium : 350 x 350 px or large : 700 x 700 px)

Here are some examples of output obtained after querying the /compounds/{inchiKey}.{format} application endpoint.

Retrieve a PNG image of a molecule

Example of the retrieval of the Caffeine small PNG image from ChEBI using its InChI Key

Request URL :

https://metabocloud.mesocentre.uca.fr/index/compounds/RYYVLZVUVIJVGH-UHFFFAOYSA-N.png?community=chebi&size=small&outputType=resource

Output :

Body :

PNG representation of the Caffeine

Headers :

HTTP/1.1 200
# Standard response headers
...

### Start custom headers with metadata related to the requested file
X-Metadata-Image-Size: 50 x 50 px
X-Metadata-Data-Source: Chemical Entities of Biological Interest (ChEBI) Database
X-Metadata-Chebi-Id: 27732
X-Metadata-Creation-Date: 2024-04-20
X-Metadata-Data-License: Creative Commons License (CC BY 4.0)
### End custom headers with metadata related to the requested file

# Standard response headers
...

Retrieve a MOL file of a molecule

Example of the retrieval of the Caffeine MOL file from ChEBI using its InChI Key

Request URL :

https://metabocloud.mesocentre.uca.fr/index/compounds/RYYVLZVUVIJVGH-UHFFFAOYSA-N.mol?community=chebi&outputType=resource

Output :

Body :

 Marvin  02080816422D

14 15  0  0  0  0            999 V2000
  -0.7145   -0.4125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -0.7145    0.4125    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   0.7145   -0.4125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   0.7145    0.4125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   0.0000   -0.8250    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   0.0000    0.8250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   1.4992    0.6674    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   1.4992   -0.6675    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   1.9841    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -1.4289   -0.8250    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
   0.0001    1.6500    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
   0.0001   -1.6500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   1.7541    1.4520    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -1.4289    0.8250    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
 10  1  2  0  0  0  0
  1  2  1  0  0  0  0
 14  2  1  0  0  0  0
  8  3  1  0  0  0  0
  4  3  2  0  0  0  0
  7  4  1  0  0  0  0
  1  5  1  0  0  0  0
  5  3  1  0  0  0  0
 12  5  1  0  0  0  0
  6  2  1  0  0  0  0
  6  4  1  0  0  0  0
 11  6  2  0  0  0  0
  9  7  1  0  0  0  0
 13  7  1  0  0  0  0
  9  8  2  0  0  0  0
M  END

Headers :

HTTP/1.1 200
# Standard response headers
...

### Start custom headers with metadata related to the requested file
X-Metadata-Data-Source: Chemical Entities of Biological Interest (ChEBI) Database
X-Metadata-Chebi-Id: 27732
X-Metadata-Creation-Date: 2024-04-20
X-Metadata-Data-License: Creative Commons License (CC BY 4.0)
### End custom headers with metadata related to the requested file

# Standard response headers
...