MongoChem RPC API: Difference between revisions

From wiki.openchemistry.org
Jump to navigation Jump to search
(Created page with "=== Retreive Chemical JSON Data From An Identifier === ChemData provides a few different methods for reteiving stuctural infomation about a molecule from a unique identifier ...")
 
No edit summary
Line 57: Line 57:
       "order": [ 1, 1, 1, 1, 1, 1, 1 ]
       "order": [ 1, 1, 1, 1, 1, 1, 1 ]
     }
     }
}
</source>
=== Molecule Similarity Queries ===
ChemData 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 InChI):
<source lang="JavaScript">
{
  "jsonrpc": "2.0",
  "method": "findSimilarMolecules",
  "id": "XXX",
  "count": 5
  "inchikey": "WSLDOOZREJYCGB-UHFFFAOYSA-N"
}
</source>
Response:
<source lang="JavaScript">
{
  "jsonrpc": "2.0",
  "id": "XXX",
  "result": {
    ["WSLDOOZREJYCGB-UHFFFAOYSA-N",
    "SZIFAVKTNFCBPC-UHFFFAOYSA-N",
    "FOCAUTSVDIKZOP-UHFFFAOYSA-N",
    "JLYXXMFPNIAWKQ-UHFFFAOYSA-N",
    "VEXZGXHMUGYJMC-UHFFFAOYSA-N"]
  }
}
}
</source>
</source>

Revision as of 13:30, 7 July 2012

Retreive Chemical JSON Data From An Identifier

ChemData 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": "getChemicalJsonFromInchi",
  "id": "XXX",
  "inchi": "InChI=1S/C2H6/c1-2/h1-2H3"
}

Request (with InChIKey):

{
  "jsonrpc": "2.0",
  "method": "getChemicalJsonFromInchiKey",
  "id": "XXX",
  "inchikey": "OTMSDBZUPAUEDD-UHFFFAOYSA-N"
}

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 ]
    }
}

Molecule Similarity Queries

ChemData 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 InChI):

{
  "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"]
  }
}