MongoChem RPC API

From wiki.openchemistry.org
Revision as of 09:49, 18 January 2013 by Kyle.lutz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Retreive Chemical JSON Data

MongoChem provides a few different methods for reteiving stuctural infomation about a molecule from a unique identifier (e.g. InChI, InChIKey). Each of the requests below will query the database and return Chemical JSON data containing the molecular information.

Request (with InChI):

{
  "jsonrpc": "2.0",
  "method": "getChemicalJson",
  "id": "XXX",
  "identifier": "InChI=1S/C2H6/c1-2/h1-2H3",
  "format": "inchi"
}

Request (with InChIKey):

{
  "jsonrpc": "2.0",
  "method": "getChemicalJson",
  "id": "XXX",
  "identifier": "OTMSDBZUPAUEDD-UHFFFAOYSA-N",
  "format": "inchikey"
}

Response:

{
  "jsonrpc": "2.0",
  "id": "XXX"
  "result": {
    "chemical json": 0,
    "name": "ethane",
    "inchi": "1/C2H6/c1-2/h1-2H3",
    "formula": "C 2 H 6",
    "atoms": {
      "elements": [  1,   6,   1,   1,   6,   1,   1,   1 ]
      "coords": {
        "3d": [  1.185080, -0.003838,  0.987524,
                 0.751621, -0.022441, -0.020839,
                 1.166929,  0.833015, -0.569312,
                 1.115519, -0.932892, -0.514525,
                -0.751587,  0.022496,  0.020891,
                -1.166882, -0.833372,  0.568699,
                -1.115691,  0.932608,  0.515082,
                -1.184988,  0.004424, -0.987522 ]
      }
    },
    "bonds": {
      "connections": [ 0, 1,
                       1, 2,
                       1, 3,
                       1, 4,
                       4, 5,
                       4, 6,
                       4, 7 ]
      },
      "order": [ 1, 1, 1, 1, 1, 1, 1 ]
    }
}

Perform Molecular Similarity Queries

MongoChem can search its database and return a set of molecules that are "similar" to a given input molecule. Similarity is calculated using the Tanimoto coefficent of the FP2 fingerprint values for the molecules.

The result of the query is a list of InChIKeys of the similar molecules sorted by their similarity to the input molecule.

Request (with InChIKey):

{
  "jsonrpc": "2.0",
  "method": "findSimilarMolecules",
  "id": "XXX",
  "count": 5,
  "inchikey": "WSLDOOZREJYCGB-UHFFFAOYSA-N"
}

Response:

{
  "jsonrpc": "2.0",
  "id": "XXX",
  "result": {
    ["WSLDOOZREJYCGB-UHFFFAOYSA-N",
     "SZIFAVKTNFCBPC-UHFFFAOYSA-N",
     "FOCAUTSVDIKZOP-UHFFFAOYSA-N",
     "JLYXXMFPNIAWKQ-UHFFFAOYSA-N",
     "VEXZGXHMUGYJMC-UHFFFAOYSA-N"]
  }
}

Convert Between Molecular Identifiers

MongoChem can convert between various chemical line formats (e.g. InChI, InChIKey, SMILES) and return the results of the conversion.

Furthermore, this can be used as a InChIKey and IUPAC name resolver when the request molecule is contained within the database.

Convert From InChI to SMILES

Request:

{
  "jsonrpc": "2.0",
  "method": "convertMoleculeIdentifier",
  "id": "XXX",
  "identifier": "InChI=1S/C5H5N5O/c6-5-9-3-2(4(11)10-5)7-1-8-3",
  "inputFormat": "inchi",
  "outputFormat": "smiles"
}

Response:

{
  "jsonrpc": "2.0",
  "id": "XXX",
  "result": {
    "identifier": "c1[nH]c2c(n1)c(=O)[nH]c(n2)N"
  }
}

Convert From InChIKey to InChI

Request:

{
  "jsonrpc": "2.0",
  "method": "convertMoleculeIdentifier",
  "id": "XXX",
  "identifier": "FPKOPBFLPLFWAD-UHFFFAOYSA-N",
  "inputFormat": "inchikey",
  "outputFormat": "inchi"
}

Response:

{
  "jsonrpc": "2.0",
  "id": "XXX",
  "result": {
    "identifier": "InChI=1S/C7H5N3O6/c1-4-2-3-5(8(11)12)7(10(15)16)6(4)9(13)14/h2-3H,1H3"
  }
}