Compounds - API endpoints

This section provides a comprehensive list of all endpoints directly related to obtaining available information about compounds.

How to read an endpoint definition?

Method Describes which HTTP method must be used for calling the given endpoint.
Pattern Specifies the suffix of the URL determining API endpoint. A final URL is created by combining the server address prefix https://molmedb.upol.cz/api with the corresponding pattern.

For example, endpoint with a pattern /compounds/detail/<id><?get_parameters> is called at address https://molmedb.upol.cz/api/compounds/detail/<id><?get_parameters> with adequately substituted parameters (<id>,...).
Parameters Describes possible parameters which can be used for query specification. All parameters can be inserted as GET_parameters, but some may be inserted as part of the URL (e.g. parameter id in the previous example). For both options, see the example in Molecule detail endpoint definition below.
Output formats Describes output formats of the data supported by the endpoint.

Molecule detail

This endpoint returns table data of all available molecule properties. Required properties currently cannot be specified and are returned altogether.

Note,

record is returned only if exact match is found. In other cases the server returns 404 - Not found.

Method GET
POST
Pattern /compounds/detail/<id><?ipassive><?iactive>
Parameters Sets the parameter to search by. 
id [string, array] (optional) - This parameter can have one of the following values:
- MolMeDB identifier of a molecule., 
- Pubchem identifier,
- Drugbank identifier,
- ChEMBL identifier,
- PDB identifier,
- SMILES,
- InChIKey,
- Molecule name. Warning! This parameter can be ambiguous.

Additional parameters can determine if the server should return passive/active interactions data:
ipassive [true/false] (default=false) - Include molecule passive interaction data. 
iactive [true/false] (default=false) - Include molecule transporter (active) interaction data.
Output formats JSON (default)
HTML - available only if the identifier parameter is set as a string (one record result)
XLSX - available only if the identifier parameter is set as a string (one record result)

A client can also set more than one identifier in a query. It can be desired if the client wants to return info about more than one molecule in one result. For more info, see the examples below.

Example 1

The following example will return detail of the Caffeine (id: MM00040) molecule from the MolMeD with all transporter interaction data in JSON format.

Query:

"url": "https://molmedb.upol.cz/api/compounds/detail/MM17305?iactive=true",
"method": GET,
"header": {
    "Accept": "application/json"
}
"url": "https://molmedb.upol.cz/api/compounds/detail/MM17305?iactive=true",
"method"
: GET,
"header"
: {
"Accept": "application/json"
}

TIP

The parameter ID from this example can also be set as GET_parameter. Therefore, the semantically equivalent URI of the query above is compounds/detail?id=MM00040&iactive=true.

Result:

{
"detail": {
"identifiers": {
"name": [
"Pyrrolidine"
],
"molmedb": "MM17305",
"smiles": "C1CCNC1",
"inchikey": "RWRDLPDLKQPQOW-UHFFFAOYSA-N",
"pubchem": [],
"pdb": [],
"drugbank": [],
"chembl": []
},
"molecular_weight": 71.12,
"logp": 0.37
},
"active_interactions": [
{
"Target": {
"Name": "SLC36A1",
"Uniprot_id": "Q7Z2H8"
},
"Type": "Non-inhibitor",
"Note": null,
"pKm": null,
"pKi": 1.42,
"pEC50": null,
"pIC50": null,
"References": {
"Primary": "Thondorf I, Voigt V, Schäfer S, Gebauer S, Zebisch K, Laug L, Brandsch M.: Three-dimensional quantitative structure-activity relationship analyses of substrates of the human proton-coupled amino acid transporter 1 (hPAT1). Bioorg Med Chem, Volume 19 (21), 


2011",
"Secondary": "ChEMBL"
}
}
]
}
{
"detail": {
"identifiers": {
"name": [
"Pyrrolidine"
],
"molmedb": "MM17305",
"smiles": "C1CCNC1",
"inchikey": "RWRDLPDLKQPQOW-UHFFFAOYSA-N",
"pubchem": [],
"pdb": [],
"drugbank": [],
"chembl": []
},
"molecular_weight": 71.12,
"logp": 0.37
},
"active_interactions": [
{
"Target": {
"Name": "SLC36A1",
"Uniprot_id": "Q7Z2H8"
},
"Type": "Non-inhibitor",
"Note": null,
"pKm": null,
"pKi": 1.42,
"pEC50": null,
"pIC50": null,
"References": {
"Primary": "Thondorf I, Voigt V, Schäfer S, Gebauer S, Zebisch K, Laug L, Brandsch M.: Three-dimensional quantitative structure-activity relationship analyses of substrates of the human proton-coupled amino acid transporter 1 (hPAT1). Bioorg Med Chem, Volume 19 (21),


2011
",
"
Secondary": "ChEMBL"
}
}
]
}

HTML output: https://molmedb.upol.cz/api/compounds/detail/MM17305?iactive=true&ipassive=false

For clarity, url prefix (https://moledb.upol.cz/api) will be omitted in the following examples.

Example 2 - multiple identifiers in one query

To set multiple parameter values, a client must send the values as an array. For that reason, the URL syntax allows setting array parameters directly by adding the two `[]` characters (URL encoded = %5B%5D) as parameter suffix. Unfortunately, this syntax is confusing, and that's why we made it possible to send these values simply as part of the POST request body.

Query returning details of two molecules - MM00040 and MM00041.

"uri": 
"compounds/detail?id%5B%5D=MM000040&id%5B%5D=MM00041",
"method": GET,
"header": {
    "Accept": "application/json"
}
"uri": 
"compounds/detail?id%5B%5D=MM000040&id%5B%5D=MM00041"
,
"method"
: GET,
"header"
: {
"Accept": "application/json"
}

Alternative query:

"method": POST,
"uri": "compounds/detail",
"header": {
    "Accept": "application/json",
    "Content-type": "application/json" # Describes the request body data format.
},
"body": {
    "data": {
        "id": ["MM00040", "MM00041"]
    }
}
"method": POST,
"uri"
: "compounds/detail",
"header"
: {
"Accept": "application/json",
"Content-type": "application/json" # Describes the request body data format.
}
,
"body"
: {
"data": {
"id": ["MM00040", "MM00041"]
}
}

Note,

POST requests must additionally specify the data format sent to the server (Content-type parameter).

Checking for the existence of a molecule record

This endpoint was developed for fast-checking of presence/absence of specific molecules in the MolMeDB database. A client sends a request with a unique identifier, and the endpoint returns true/false string response indicating success/failure of finding the molecule.

Method GET
Pattern /compounds/exists/<id>
Parameters id [string] (required) - As value can be molecule identifier:
- MolMeDB identifier of a molecule., 
- Pubchem identifier,
- Drugbank identifier,
- ChEMBL identifier,
- PDB identifier,
- SMILES,
- InChIKey,
- Molecule name. Warning! This parameter can be ambiguous.
Output format TEXT - true/false

Functional relatives

This endpoint returns all available molecules differing from query molecule by addition/deletion/substitution of one functional group. Note that the query molecule must be available in the MolMeDB database. Otherwise, the server returns 404 - Not found.

Method GET
Pattern /compounds/frelatives/<id>
Parameters id [string] (required) - As value can be molecule identifier:
- MolMeDB identifier of a molecule., 
- Pubchem identifier,
- Drugbank identifier,
- ChEMBL identifier,
- PDB identifier,
- SMILES,
- InChIKey,
- Molecule name. Warning! This parameter can be ambiguous.
Output formats HTML (default) - Recommended for clear data visualisation.
JSON

Molecular structure

Returns a 2D or 3D structure of the molecule in the output format specified in the request header.

Method GET
Pattern /compounds/structure/<id>
Parameters id [string] (required) - As value can be molecule identifier:
- MolMeDB identifier of a molecule., 
- Pubchem identifier,
- Drugbank identifier,
- ChEMBL identifier,
- PDB identifier,
- SMILES,
- InChIKey,
- Molecule name. Warning! This parameter can be ambiguous.
Output formats SMI - Returns SMILES notation of given molecule.
Image - Returns a PNG image of a 2D molecule structure.
HTML (default) - Returns HTML page with SMILES, 2D structure and interactive 3D structure.
SDF - Returns SDF file of a 3D molecule structure.
JSON - Returns object with SMILES and SDF content.

Example 1 - 3D structure

The following query returns the structure data file (SDF) for given molecule generated by RDKIT software.

Query:

"url": "compounds/structure/MM00040"
"header": {
    "Accept": "chemical/x-mdl-sdfile"
}
"url": "compounds/structure/MM00040"
"header"
: {
"Accept": "chemical/x-mdl-sdfile"
}

Tip

Changing header Accept parameter to value text/html returns web page with the interactive 3D structure of molecule generated by LiteMol software. Try it here!

Example 2 - SMILES

The following query returns SMILES of a given molecule.

Query:

"url": "compounds/structure/MM00040"
"header": {
    "Accept": "chemical/x-daylight-smiles"
}
"url": "compounds/structure/MM00040"
"header"
: {
"Accept": "chemical/x-daylight-smiles"
}

Tip

Changing header Accept parameter to value image/svg+xml returns 2D structure vector image of a given molecule.

Result:

Cn1c(=O)c2c(ncn2C)n(C)c1=O
Cn1c(=O)c2c(ncn2C)n(C)c1=O