MongoChem RPC API: Difference between revisions

From wiki.openchemistry.org
Jump to navigation Jump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Retreive Chemical JSON Data From An Identifier ===
== Retreive Chemical JSON Data ==


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.
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):
Request (with InChI):
Line 7: Line 7:
{
{
   "jsonrpc": "2.0",
   "jsonrpc": "2.0",
   "method": "getChemicalJsonFromInchi",
   "method": "getChemicalJson",
   "id": "XXX",
   "id": "XXX",
   "inchi": "InChI=1S/C2H6/c1-2/h1-2H3"
   "identifier": "InChI=1S/C2H6/c1-2/h1-2H3",
  "format": "inchi"
}
}
</source>
</source>
Line 17: Line 18:
{
{
   "jsonrpc": "2.0",
   "jsonrpc": "2.0",
   "method": "getChemicalJsonFromInchiKey",
   "method": "getChemicalJson",
   "id": "XXX",
   "id": "XXX",
   "inchikey": "OTMSDBZUPAUEDD-UHFFFAOYSA-N"
   "identifier": "OTMSDBZUPAUEDD-UHFFFAOYSA-N",
  "format": "inchikey"
}
}
</source>
</source>
Line 60: Line 62:
</source>
</source>


=== Perform Molecular Similarity Queries ===
== Perform Molecular 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.
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.
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):
Request (with InChIKey):
<source lang="JavaScript">
<source lang="JavaScript">
{
{
Line 71: Line 73:
   "method": "findSimilarMolecules",
   "method": "findSimilarMolecules",
   "id": "XXX",
   "id": "XXX",
   "count": 5
   "count": 5,
   "inchikey": "WSLDOOZREJYCGB-UHFFFAOYSA-N"
   "inchikey": "WSLDOOZREJYCGB-UHFFFAOYSA-N"
}
}
Line 87: Line 89:
     "JLYXXMFPNIAWKQ-UHFFFAOYSA-N",
     "JLYXXMFPNIAWKQ-UHFFFAOYSA-N",
     "VEXZGXHMUGYJMC-UHFFFAOYSA-N"]
     "VEXZGXHMUGYJMC-UHFFFAOYSA-N"]
  }
}
</source>
== 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:
<source lang="JavaScript">
{
  "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"
}
</source>
Response:
<source lang="JavaScript">
{
  "jsonrpc": "2.0",
  "id": "XXX",
  "result": {
    "identifier": "c1[nH]c2c(n1)c(=O)[nH]c(n2)N"
  }
}
</source>
=== Convert From InChIKey to InChI ===
Request:
<source lang="JavaScript">
{
  "jsonrpc": "2.0",
  "method": "convertMoleculeIdentifier",
  "id": "XXX",
  "identifier": "FPKOPBFLPLFWAD-UHFFFAOYSA-N",
  "inputFormat": "inchikey",
  "outputFormat": "inchi"
}
</source>
Response:
<source lang="JavaScript">
{
  "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"
   }
   }
}
}
</source>
</source>

Latest revision as of 08:49, 18 January 2013

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