M1 Hub
Back to user guides

M1 RetroScore API User Guide

Get search results

Request

GET

http://localhost:2222/api/v2/batch-search-result/{id}

#{id}
string
required

ID of the search.

Query string parameters

#only
string
optional

Fetch only a subset of fields of the returned search results.

Example values:

  • single field: ?only[]=target_smiles
  • multiple fields: ?only[]=target_smiles&only[]=result

Example

curl http://localhost:2222/api/v2/batch-search-result/{id} \
  -H "Authorization: ApiToken-v1 YOUR_API_TOKEN"

Fetch only a subset of fields

curl http://localhost:2222/api/v2/batch-search-result/{id}?only[]=target_smiles&only[]=result \
  -H "Authorization: ApiToken-v1 YOUR_API_TOKEN"

Response

Bodyapplication/json

A list of search results conforming to the following schema:

#target_smiles
string

SMILES of the target compound.

#status
'ok' | 'running' | 'error'

Status of a given search. Pending searches are currently not listed in the output.

#result
float

Estimated synthetic complexity of the target compound is a value between 1 and 10 that describes how hard it is to synthesize a given compound - the higher, the harder the synthesis is. Number of reactions in a pathway is the most important factor.

  • 1 - 2 - The compound is commercially available and is relatively cheap.
  • 2 - 4 - There is a short and straightforward synthesis found for this compound.
  • 4 - 6 - A relatively long pathway, pathway with some uncertain reactions or with expensive starting materials was found.
  • 6 - 10 - A long pathway with a lot of unlikely reactions was found or there is no synthesis found at all.
#reaction_count
integer

Number of reactions in the best synthesis pathway.

Default value: null

#price
integer | float

Estimated price (in USD) of starting materials needed for synthesis of fixed number of moles of the target compound.

Default value: null

#timed_out
boolean

Informs whether the search exceeded maximal allowed duration. This should only happen for compounds that are much bigger or much more complex than regular medicinal chemistry targets. Subsequent searches for the same compound may yield different results because of the variability of the search duration. If synthesis was found before exceeding the maximal duration, it will be used to compute the values above.

#started_at
string

Search created date and time as an ISO 8601 formatted string.

#finished_at
string

Search completed date and time as an ISO 8601 formatted string.

#running_time
integer

Search running time in seconds.

#url
string

URL address to RetroScore UI, where the search result is presented in a human-readable way.

#target_metadata_name
string

Target name specified by the user as an input in the search request.

Default value: null

If the search was run with the detail_level set to 'best_path' or 'all_paths', additional fields synthesis and decomposition will be returned:

#synthesis
dictionary

Structure containing the best synthetic pathway found by the system.

Default value: null

#target_id
string

ID of the target compound.

#reactions
nested dictionary

A dictionary of reactions, where the key represents the reaction ID and the value is a dictionary that conforms to the following schema:

#id
string

ID of the target compound.

#type
'reaction'
#smiles
string

Mapped SMILES of the reaction.

#product_id
string

ID of the reaction product.

#substrates_ids
list of strings

IDs of the reaction substrates.

#compounds
nested dictionary

A dictionary of compounds, where the key represents the compound ID and the value is a dictionary that conforms to the following schema:

#id
string

ID of the reaction.

#type
'compound'
#smiles
string

SMILES of the compound.

#substrate_of
string

ID of the reaction that the current compound is a substrate of.

Default value: null if compound not a substrate

#product_of
string

ID of the reaction that the current compound is a product of.

Default value: null if compound not a product

#decomposition
nested dictionary

Structure that describes how the reactions generated by the system can be used to decompose the target compound into the available starting materials.

#mapped_smiles
string

Mapped SMILES of the reaction.

#atoms
list of integers

Mapping numbers of atoms in mapped_smiles.

#atoms_purchased
list of integers

Contains the mapping numbers of all product atoms which can be sourced from the available starting materials used in a synthetic pathway found during the search. This synthetic pathway may be incomplete, meaning not all starting materials need to be available.

#atoms_not_purchased
list of integers

Mapping numbers of atoms that don't fall into atoms_purchased.

#bonds
list of tuples

List of all bonds where each bond is a 2-element tuple of integers that specify the mapping numbers of the connected atoms within mapped_smiles.

#bonds_broken
list of tuples

Contains all product bonds that may be broken by any reaction found during the search. This reaction doesn't need to lead to the product - it may lead an intermediate compound that is further used in a synthetic pathway. This reaction doesn't need to belong to any complete synthetic pathway, meaning it doesn't necessarily start at the available starting materials.

#bonds_not_broken
list of tuples

Bonds that don't fall into bonds_broken.

Example

[
  {
    "target_smiles": "O=C(Nc1cc(Nc2nc(-c3cnccc3)ccn2)c(cc1)C)c3ccc(cc3)CN3CCN(CC3)C",
    "status": "ok",
    "result": 1.1640496253967285,
    "reaction_count": 0,
    "price": 18.079999923706055,
    "timed_out": false,
    "started_at": "2023-04-19T10:12:33.909Z",
    "finished_at": "2023-04-19T10:14:11.641Z",
    "running_time": 97.732,
    "url": "http://localhost:2222/dashboard/synthesis-plans/batch/04301d9f-d00f-4bdf-bef1-7760358711f6/result/cb9b2f6b-9dd1-4a3e-b93f-9e2ef6d3bf84",
    "target_metadata_name": null
  }
]

When detail_level set to 'best_path' or 'all_paths'

[
  {
    "target_smiles": "O=C(Nc1cc(Nc2nc(-c3cnccc3)ccn2)c(cc1)C)c3ccc(cc3)CN3CCN(CC3)C",
    "status": "ok",
    "result": 7.571075439453125,
    "reaction_count": 1,
    "price": 59425.68359375,
    "timed_out": false,
    "started_at": "2023-04-19T15:47:24.027Z",
    "finished_at": "2023-04-19T15:47:47.043Z",
    "running_time": 23.016,
    "url": "http://localhost:2222/dashboard/synthesis-plans/batch/ac9f9f11-51e4-49c2-ab29-f8ab8746a44c/result/4b769980-410b-4203-ba83-2f2982d875ab",
    "target_metadata_name": null,
    "synthesis": {
      "target_id": "0",
      "reactions": {
        "67": {
          "id": "67",
          "type": "reaction",
          "smiles": "[O:1]=[C:2]([OH:5])[c:25]1[cH:30][cH:29][c:28]([cH:27][cH:26]1)[CH2:31][N:32]1[CH2:33][CH2:34][N:35]([CH2:36][CH2:37]1)[CH3:38].[n:10]1[c:9]([n:20][cH:19][cH:18][c:11]1-[c:12]1[cH:13][n:14][cH:15][cH:16][cH:17]1)[NH:8][c:7]1[c:21]([cH:22][cH:23][c:4]([NH2:3])[cH:6]1)[CH3:24]>>[O:1]=[C:2]([NH:3][c:4]1[cH:6][c:7]([NH:8][c:9]2[n:10][c:11](-[c:12]3[cH:13][n:14][cH:15][cH:16][cH:17]3)[cH:18][cH:19][n:20]2)[c:21]([cH:22][cH:23]1)[CH3:24])[c:25]1[cH:26][cH:27][c:28]([cH:29][cH:30]1)[CH2:31][N:32]1[CH2:33][CH2:34][N:35]([CH2:36][CH2:37]1)[CH3:38]",
          "product_id": "0",
          "substrates_ids": ["194", "195"]
        }
      },
      "compounds": {
        "0": {
          "id": "0",
          "type": "compound",
          "smiles": "O=C(Nc1cc(Nc2nc(-c3cnccc3)ccn2)c(cc1)C)c1ccc(cc1)CN1CCN(CC1)C",
          "substrate_of": null,
          "product_of": "67",
          "data": {}
        },
        "194": {
          "id": "194",
          "type": "compound",
          "smiles": "O=C(O)c1ccc(cc1)CN1CCN(CC1)C",
          "substrate_of": "67",
          "product_of": null,
          "data": {}
        },
        "195": {
          "id": "195",
          "type": "compound",
          "smiles": "n1c(nccc1-c1cnccc1)Nc1c(ccc(N)c1)C",
          "substrate_of": "67",
          "product_of": null,
          "data": {}
        }
      },
      "decomposition": {
        "mapped_smiles": "[O:1]=[C:2]([NH:3][c:4]1[cH:5][c:6]([NH:7][c:8]2[n:9][c:10](-[c:11]3[cH:12][n:13][cH:14][cH:15][cH:16]3)[cH:17][cH:18][n:19]2)[c:20]([cH:21][cH:22]1)[CH3:23])[c:24]1[cH:25][cH:26][c:27]([cH:28][cH:29]1)[CH2:30][N:31]1[CH2:32][CH2:33][N:34]([CH2:35][CH2:36]1)[CH3:37]",
        "atoms": [
          1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37
        ],
        "atoms_purchased": [
          1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37
        ],
        "atoms_not_purchased": [],
        "bonds": [
          [1, 2],
          [2, 3],
          [2, 24],
          [3, 4],
          [4, 5],
          [4, 22],
          [5, 6],
          [6, 7],
          [6, 20],
          [7, 8],
          [8, 9],
          [8, 19],
          [9, 10],
          [10, 11],
          [10, 17],
          [11, 12],
          [11, 16],
          [12, 13],
          [13, 14],
          [14, 15],
          [15, 16],
          [17, 18],
          [18, 19],
          [20, 21],
          [20, 23],
          [21, 22],
          [24, 25],
          [24, 29],
          [25, 26],
          [26, 27],
          [27, 28],
          [27, 30],
          [28, 29],
          [30, 31],
          [31, 32],
          [31, 36],
          [32, 33],
          [33, 34],
          [34, 35],
          [34, 37],
          [35, 36]
        ],
        "bonds_broken": [
          [1, 2],
          [2, 3],
          [2, 24],
          [3, 4],
          [6, 7],
          [7, 8],
          [8, 9],
          [9, 10],
          [10, 11],
          [17, 18],
          [18, 19],
          [20, 23],
          [27, 30],
          [30, 31],
          [31, 32],
          [31, 36],
          [33, 34],
          [34, 35],
          [34, 37]
        ],
        "bonds_not_broken": [
          [4, 5],
          [4, 22],
          [5, 6],
          [6, 20],
          [8, 19],
          [10, 17],
          [11, 12],
          [11, 16],
          [12, 13],
          [13, 14],
          [14, 15],
          [15, 16],
          [20, 21],
          [21, 22],
          [24, 25],
          [24, 29],
          [25, 26],
          [26, 27],
          [27, 28],
          [28, 29],
          [32, 33],
          [35, 36]
        ]
      }
    }
  ]