User Tools

Site Tools


api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
api [2020/07/06 18:49] – [Multiple queries exact search] flackapi [2020/08/03 18:00] – [Substructure search] flack
Line 426: Line 426:
 </code> </code>
  
-Please note that in case the queries are InChIKeys, matching_level and matching_level_display will always be **null** in the response. +Please note that in case the queries are InChIKeys, **matching_level** and **matching_level_display** will always be **null** in the response. 
  
 ===== Multiple queries exact search with availability ===== ===== Multiple queries exact search with availability =====
Line 525: Line 525:
 </code> </code>
  
 +Please note that in case the queries are InChIKeys, **matching_level** and **matching_level_display** will always be **null** in the response. 
 +
 +
 +===== Similarity search =====
 +Similarity search currently accepts the following input identifiers: mcule ID, SMILES.
 +
 +== Endpoint: ==
 +<code>/search/sim/</code>
 +
 +== Example API request: ==
 +<code>
 +echo '{"query": "MCULE-3601132784", "limit": 3, "threshold": 0.8}' | http https://mcule.com/api/v1/search/sim/ "Authorization: Token <your_token>" --print HBhb
 +</code>
 +
 +or
 +
 +<code>
 +echo '{"query": "CC1=C(C(CC2NC(=O)C3=C(SC(C4=CC=CC=C4)=C3)N=2)=O)C=CO1", "limit": 3, "threshold": 0.8}' | http https://mcule.com/api/v1/search/sim/ "Authorization: Token <your_token>" --print HBhb
 +</code>
 +
 +== Request: ==
 +<code>
 +POST /api/v1/search/sim/ HTTP/1.1
 +Accept: application/json
 +Accept-Encoding: gzip, deflate
 +Authorization: Token <your_token>
 +Content-Type: application/json
 +
 +{
 +    "limit": 3,
 +    "query": "MCULE-3601132784",
 +    "threshold": 0.8
 +}
 +</code>
 +
 +== Response: ==
 +<code>
 +HTTP/1.1 200 OK
 +Allow: POST, OPTIONS
 +Content-Encoding: gzip
 +Content-Type: application/json
 +
 +{
 +    "results": [
 +        {
 +            "mcule_id": "MCULE-3601132784",
 +            "sim": 1.0,
 +            "smiles": "CC1=C(C(CC2NC(=O)C3=C(SC(C4=CC=CC=C4)=C3)N=2)=O)C=CO1",
 +            "url": "https://mcule.com/MCULE-3601132784/"
 +        },
 +        {
 +            "mcule_id": "MCULE-1000774360",
 +            "sim": 0.8540706605222734,
 +            "smiles": "O=C(C1OC=CC=1)CC1NC(=O)C2=C(SC(C3=CC=CC=C3)=C2)N=1",
 +            "url": "https://mcule.com/MCULE-1000774360/"
 +        },
 +        {
 +            "mcule_id": "MCULE-9463088657",
 +            "sim": 0.8529886914378029,
 +            "smiles": "CC1SC2=C(C(NC(=N2)CC(C2=C(C)OC=C2)=O)=O)C=1",
 +            "url": "https://mcule.com/MCULE-9463088657/"
 +        }
 +    ]
 +}
 +</code>
 +
 +The **threshold** field accepts values between 0.7 and 1.0, the default is 0.9.
 +
 +The **limit** field accepts values between 1 and 1000, the default is 100.
 +
 +
 +===== Substructure search =====
 +Substructure search currently accepts the following input identifiers: mcule ID, SMILES.
 +
 +== Endpoint: ==
 +<code>/search/sss/</code>
 +
 +== Example API request: ==
 +<code>
 +echo '{"query": "CC1=CC2=C(S1)N=CNC2=O", "limit": 5}' | http https://mcule.com/api/v1/search/sss/ "Authorization: Token <your_token>" --print HBhb
 +</code>
 +
 +== Request: ==
 +<code>
 +POST /api/v1/search/sss/ HTTP/1.1
 +Accept: application/json
 +Accept-Encoding: gzip, deflate
 +Authorization: Token <your_token>
 +Content-Type: application/json
 +
 +{
 +    "limit": 5,
 +    "query": "CC1=CC2=C(S1)N=CNC2=O"
 +}
 +</code>
 +
 +== Response: ==
 +<code>
 +HTTP/1.1 200 OK
 +Allow: POST, OPTIONS
 +Content-Encoding: gzip
 +Content-Type: application/json
 +
 +{
 +    "results": [
 +        {
 +            "mcule_id": "MCULE-8112694353",
 +            "smiles": "C12C(C)=C(SC=1N=CN(CC(NCCCC(=O)NC1CCCCC1)=O)C2=O)C",
 +            "url": "https://mcule.com/MCULE-8112694353/"
 +        },
 +        {
 +            "mcule_id": "MCULE-8986577308",
 +            "smiles": "C12SC3=C(CCCC3)C=1C(NC(SCC#C)=N2)=O",
 +            "url": "https://mcule.com/MCULE-8986577308/"
 +        },
 +        {
 +            "mcule_id": "MCULE-4695228882",
 +            "smiles": "C12SC3=C(CCCC3)C=1C(NC(SCCCC)=N2)=O",
 +            "url": "https://mcule.com/MCULE-4695228882/"
 +        },
 +        {
 +            "mcule_id": "MCULE-1137030903",
 +            "smiles": "N1(CC2C=NN(C)C=2)C(=O)C2C=C(SC=2N=C1S)CC",
 +            "url": "https://mcule.com/MCULE-1137030903/"
 +        },
 +        {
 +            "mcule_id": "MCULE-1308684767",
 +            "smiles": "C12SC3=C(CCCC3)C=1C(NC(SCC=C)=N2)=O",
 +            "url": "https://mcule.com/MCULE-1308684767/"
 +        }
 +    ]
 +}
 +</code>
 +
 +The **limit** field accepts values between 1 and 1000, the default is 100.
  
  
api.txt · Last modified: 2023/06/03 07:19 by flack