Welcome to MINE-Server’s documentation!¶
All API Routes¶
To see source code for each route, see app.routes module.
In the spec below, if an argument is not present in the URL path, it should be submitted as form data in POST request. If GET request, ignore arguments not in URL path (they are incorrectly autogenerated by autoflask).
The following table lists all resources, along with their endpoints. Note that for some resources, multiple endpoints exist (e.g. ‘Exact structure search’ has 4 endpoints). See routing table (link in upper right hand corner) for endpoints ordered by path rather than resource.
For example usage, see this Jupyter Notebook at the MINE-Server GitHub repo.
-
GET/mineserver/get-adduct-names/(adduct_type)¶
-
GET/mineserver/get-adduct-names¶ Get names of all adducts for the specified adduct type.
- Parameters
adduct_type (str,optional) – Options are ‘positive’, ‘negative’, or ‘all’. Defaults to ‘all’.
- Return
JSON array of adduct names. If adduct_type == ‘all’, then this is an array of two arrays, with the first element being positive adducts and the second adduct being negative adducts.
- Rtype
flask.Response
-
GET/mineserver/structure-search/(db_name)/smiles=(smiles)/stereo=(stereo)¶
-
GET/mineserver/structure-search/(db_name)/smiles=(smiles)¶ Perform an exact structure search and return results.
If GET request, uses smiles. If POST, uses mol.
- Parameters
db_name (str) – Name of Mongo database to query against.
smiles (str) – SMILES string describing molecular structure of query molecule.
mol (str,optional) – mol object in str format (should contain a lot of strange chars like “%20” and end with “END”). Used only for the MINE website backend because MarvinJS on the front end only generates mol objects from input structures, and cannot convert it to SMILES. Captured from form data. Defaults to None.
stereo (bool,optional) – If true, uses sterochemistry in finding exact match. Defaults to True.
model (str,optional) – KEGG organism code (e.g. ‘hsa’). Adds annotations to each compound based on whether it is in or could be derived from the KEGG compounds in this organism (provided in the ‘Likelihood_score’ field of each compound document). Defaults to None.
- Return
JSON Document of match (empty if no match).
- Rtype
flask.Response
-
POST/mineserver/structure-search/(db_name)/stereo=(stereo)¶
-
POST/mineserver/structure-search/(db_name)¶ Perform an exact structure search and return results.
If GET request, uses smiles. If POST, uses mol.
- Parameters
db_name (str) – Name of Mongo database to query against.
smiles (str) – SMILES string describing molecular structure of query molecule.
mol (str,optional) – mol object in str format (should contain a lot of strange chars like “%20” and end with “END”). Used only for the MINE website backend because MarvinJS on the front end only generates mol objects from input structures, and cannot convert it to SMILES. Captured from form data. Defaults to None.
stereo (bool,optional) – If true, uses sterochemistry in finding exact match. Defaults to True.
model (str,optional) – KEGG organism code (e.g. ‘hsa’). Adds annotations to each compound based on whether it is in or could be derived from the KEGG compounds in this organism (provided in the ‘Likelihood_score’ field of each compound document). Defaults to None.
- Return
JSON Document of match (empty if no match).
- Rtype
flask.Response
-
GET/mineserver/substructure-search/(db_name)/smiles=(smiles)/(int: limit)¶
-
GET/mineserver/substructure-search/(db_name)/smiles=(smiles)¶ Perform a substructure search and return results.
If GET request, uses smiles. If POST, uses mol.
- Parameters
db_name (str) – Name of Mongo database to query against.
smiles (str) – SMILES string describing molecular substructure to search for.
mol (str,optional) – mol object in str format (may contain a lot of whitespace hex-chars like “%20” and end with “END”). Used only for the MINE website backend because MarvinJS on the front end only generates mol objects from input structures, and cannot convert it to SMILES. Captured from form data. Defaults to None.
limit (int) – Maximum number of results (compounds) to return. By default, returns all results (limit=-1).
- Return
JSON Documents of compounds containing given substructure.
- Rtype
flask.Response
-
POST/mineserver/substructure-search/(db_name)/(int: limit)¶
-
POST/mineserver/substructure-search/(db_name)¶ Perform a substructure search and return results.
If GET request, uses smiles. If POST, uses mol.
- Parameters
db_name (str) – Name of Mongo database to query against.
smiles (str) – SMILES string describing molecular substructure to search for.
mol (str,optional) – mol object in str format (may contain a lot of whitespace hex-chars like “%20” and end with “END”). Used only for the MINE website backend because MarvinJS on the front end only generates mol objects from input structures, and cannot convert it to SMILES. Captured from form data. Defaults to None.
limit (int) – Maximum number of results (compounds) to return. By default, returns all results (limit=-1).
- Return
JSON Documents of compounds containing given substructure.
- Rtype
flask.Response
-
GET/mineserver/similarity-search/(db_name)/smiles=(smiles)/(float: min_tc)/(int: limit)¶
-
GET/mineserver/similarity-search/(db_name)/smiles=(smiles)/(int: limit)¶
-
GET/mineserver/similarity-search/(db_name)/smiles=(smiles)/(float: min_tc)¶
-
GET/mineserver/similarity-search/(db_name)/smiles=(smiles)¶ Perform a similarity search for a SMILES string and return results.
Either a SMILES string or mol object string is required. SMILES is the recommended format. If GET request, uses smiles. If POST, uses mol.
- Parameters
db_name (str) – Name of Mongo database to query against.
smiles (str) – SMILES string describing molecular structure of query molecule. Either smiles or mol arg is required (smiles arg recommended over mol arg).
mol (str,optional) – mol object in str format (should contain a lot of strange chars like “%20” and end with “END”). Used only for the MINE website backend because MarvinJS on the front end only generates mol objects from input structures, and cannot convert it to SMILES. Captured from form data. Defaults to None.
min_tc (float,optional) – Minimum Tanimoto Coefficient required for similarity match. Defaults to 0.7.
limit (int,optional) – Maximum number of results (compounds) to return. By default, returns all results (limit=-1).
model (str,optional) – KEGG organism code (e.g. ‘hsa’). Adds annotations to each compound based on whether it is in or could be derived from the KEGG compounds in this organism (provided in the ‘Likelihood_score’ field of each compound document). Defaults to None.
- Return
JSON Document of similar compounds.
- Rtype
flask.Response
-
POST/mineserver/similarity-search/(db_name)/(float: min_tc)/(int: limit)¶
-
POST/mineserver/similarity-search/(db_name)/(int: limit)¶
-
POST/mineserver/similarity-search/(db_name)/(float: min_tc)¶
-
POST/mineserver/similarity-search/(db_name)¶ Perform a similarity search for a SMILES string and return results.
Either a SMILES string or mol object string is required. SMILES is the recommended format. If GET request, uses smiles. If POST, uses mol.
- Parameters
db_name (str) – Name of Mongo database to query against.
smiles (str) – SMILES string describing molecular structure of query molecule. Either smiles or mol arg is required (smiles arg recommended over mol arg).
mol (str,optional) – mol object in str format (should contain a lot of strange chars like “%20” and end with “END”). Used only for the MINE website backend because MarvinJS on the front end only generates mol objects from input structures, and cannot convert it to SMILES. Captured from form data. Defaults to None.
min_tc (float,optional) – Minimum Tanimoto Coefficient required for similarity match. Defaults to 0.7.
limit (int,optional) – Maximum number of results (compounds) to return. By default, returns all results (limit=-1).
model (str,optional) – KEGG organism code (e.g. ‘hsa’). Adds annotations to each compound based on whether it is in or could be derived from the KEGG compounds in this organism (provided in the ‘Likelihood_score’ field of each compound document). Defaults to None.
- Return
JSON Document of similar compounds.
- Rtype
flask.Response
-
POST/mineserver/spectra-download/(db_name)/q=(mongo_query)¶
-
POST/mineserver/spectra-download/(db_name)¶ Download one or more spectra for compounds matching a given query.
- Parameters
db_name (str) – Name of DB containing compound documents to search.
mongo_query (str,optional) – A valid Mongo query as a literal string. If None, all compound spectra are returned. Defaults to None.
parent_filter (str,optional) – If set to a metabolic model’s Mongo _id, only get spectra for compounds in or derived from that metabolic model. Defaults to None.
putative (bool,optional) – If False, only find known compounds (i.e. in Generation 0). Otherwise, finds both known and predicted compounds. Defaults to True.
- Return
Text of all matching spectra, including headers and peak lists.
- Rtype
flask.Response
-
GET/mineserver/spectra-download/(db_name)/q=(mongo_query)¶
-
GET/mineserver/spectra-download/(db_name)¶ Download one or more spectra for compounds matching a given query.
- Parameters
db_name (str) – Name of DB containing compound documents to search.
mongo_query (str,optional) – A valid Mongo query as a literal string. If None, all compound spectra are returned. Defaults to None.
parent_filter (str,optional) – If set to a metabolic model’s Mongo _id, only get spectra for compounds in or derived from that metabolic model. Defaults to None.
putative (bool,optional) – If False, only find known compounds (i.e. in Generation 0). Otherwise, finds both known and predicted compounds. Defaults to True.
- Return
Text of all matching spectra, including headers and peak lists.
- Rtype
flask.Response
-
GET/mineserver/database-query/(db_name)/q=(mongo_query)¶ Perform a direct query built with Mongo syntax.
- Parameters
db_name (str) – Name of Mongo database to query against.
mongo_query (str) – A valid Mongo query (e.g. …/q={“ID”: “cpd00001”}).
- Return
JSON Documents matching provided Mongo query.
- Rtype
flask.Response
-
GET/mineserver/model-search/q=(query)¶ Perform a model search and return results.
- Parameters
query (str) – KEGG Org Code or Org Name of model(s) to search for (e.g. ‘hsa’ or ‘yeast’). Can provide multiple search terms by separating each term with a space. TODO: change from space delimiter to something else
- Return
JSON Document with KEGG org codes matching query.
- Rtype
flask.Response
-
GET/mineserver/quick-search/(db_name)/q=(query)¶ Perform a quick search and return results.
- Parameters
db_name (str) – Name of Mongo database to query against.
query (str) – A MINE id, KEGG code, ModelSEED id, Inchikey, or Name.
- Return
JSON Documents matching query.
- Rtype
flask.Response
-
GET/mineserver/get-ids/(db_name)/(collection_name)/q=(query)¶
-
GET/mineserver/get-ids/(db_name)/(collection_name)¶ Get Mongo IDs for a subset of a given database collection.
- Parameters
db_name (str) – Name of Mongo database to query against.
collection_name (str) – Name of Mongo collection within database to query against.
query (str,optional) – Specifies subset of collection to retrieve ids for. Formatted as a python dict as you would have in argument to db.collection.find(). Defaults to None.
- Return
List of ids matching query in JSON format.
- Rtype
flask.Response
-
POST/mineserver/ms-adduct-search/(db_name)¶ Search for commpound-adducts matching precursor mass(es).
Attach all arguments besides db_name as JSON data in POST request.
- Parameters
db_name (str) – Name of Mongo database to query against.
tolerance (float) – Specifies tolerance for m/z, in mDa by default. Can specify in ppm if ppm is set to True.
charge (bool) – Positive or negative mode. (True for positive, False for negative).
text (str) – Text as in metabolomics datafile for specific peak.
text_type (str,optional) – Type of metabolomics datafile (mgf, mzXML, and msp are supported). If None, assumes m/z values are separated by newlines. Default is None.
adducts (list,optional) – List of adducts to use. If not specified, uses all adducts (adducts=None).
models (list,optional) – List of model _ids. If supplied, score compounds higher if present in metabolic model. Defaults to None.
ppm (bool,optional) – Specifies whether tolerance is in ppm. Defaults to False.
logp (tuple,optional) – Length 2 tuple specifying min and max logp to filter compounds (e.g. (-1, 2)). Defaults to None.
halogen (bool,optional) – Specifies whether to filter out compounds containing F, Cl, or Br. Filtered out if set to True. Defaults to False.
verbose (bool,optional) – If True, verbose output. Defaults to False.
- Return
JSON array of compounds that match m/z within defined tolerance and after passing other defined filters (such as logP).
- Rtype
flask.Response
-
GET/mineserver/get-op-w-rxns/(db_name)/(op_id)¶ Get operator with all its associated reactions in selected database.
- Parameters
db_name (str) – Name of Mongo database to query against.
op_id (str) – Either operator id (e.g. 1.1.-1.h) or Mongo ID (_id) for operator.
- Return
Operator JSON document (including associated reactions).
- Rtype
flask.Response
-
POST/mineserver/ms2-search/(db_name)¶ Search for commpound-adducts matching precursor mass(es).
Attach all arguments besides db_name as form data in POST request.
- Parameters
db_name (str) – Name of Mongo database to query against.
tolerance (float) – Specifies tolerance for m/z, in mDa by default. Can specify in ppm if ppm is set to True.
charge (bool) – Positive or negative mode. (True for positive, False for negative).
energy_level (int) – Fragmentation energy level to use. May be 10, 20, or 40.
scoring_function (str) – Scoring function to use. Can be either ‘jaccard’ or ‘dot product’.
text (str) – Text as in metabolomics datafile for specific peak.
text_type (str,optional) – Type of metabolomics datafile (mgf, mzXML, and msp are supported). If None, assumes m/z values are separated by newlines. Default is None.
adducts (list,optional) – List of adducts to use. If not specified, uses all adducts. (adducts=None)
models (list,optional) – List of model _ids. If supplied, score compounds higher if present in metabolic model. Defaults to None.
ppm (bool,optional) – Specifies whether tolerance is in ppm. Defaults to False.
logp (tuple,optional) – Length 2 tuple specifying min and max logp to filter compounds (e.g. (-1, 2)). Defaults to None.
halogens (bool,optional) – Specifies whether to filter out compounds containing F, Cl, or Br. Filtered out if set to True. Defaults to False.
- Return
JSON array of compounds that match m/z within defined tolerance and after passing other defined filters (such as logP).
- Rtype
flask.Response
-
POST/mineserver/get-comps/(db_name)¶ Get compounds for specified ids in database.
- Parameters
db_name (str) – Name of Mongo database to query against.
id_list (list) – List of compound ids. Attach as “dict” to POST request. For example, requests.post(<this_uri>, data=”{‘id_list’: [‘id1’, ‘id2’, ‘id3’]}”). IDs can be either MINE IDs or Mongo IDs (_id).
- Return
List of compound JSON documents.
- Rtype
flask.Response
-
GET/mineserver/get-comps/(db_name)¶ Get compounds for specified ids in database.
- Parameters
db_name (str) – Name of Mongo database to query against.
id_list (list) – List of compound ids. Attach as “dict” to POST request. For example, requests.post(<this_uri>, data=”{‘id_list’: [‘id1’, ‘id2’, ‘id3’]}”). IDs can be either MINE IDs or Mongo IDs (_id).
- Return
List of compound JSON documents.
- Rtype
flask.Response
-
POST/mineserver/get-rxns/(db_name)¶ Get reactions for specified ids in database.
- Parameters
db_name (str) – Name of Mongo database to query against.
id_list (list) – List of reaction ids. Attach as “dict” to POST request. For example, requests.post(<this_uri>, data=”{‘id_list’: [‘id1’, ‘id2’, ‘id3’]}”). IDs can be either MINE IDs or Mongo IDs (_id).
- Return
List of reaction JSON documents.
- Rtype
flask.Response
-
POST/mineserver/get-ops/(db_name)¶ Get operators for specified ids in database.
- Parameters
db_name (str) – Name of Mongo database to query against.
id_list (list,optional) – List of operator ids. Attach as “dict” to POST request. For example, requests.post(<this_uri>, data=”{‘id_list’: [‘id1’, ‘id2’, ‘id3’]}”). IDs can be either operator ids (e.g. 1.1.-1.h) or Mongo IDs (_id). If not provided, all operators are returned (id_list=None).
- Return
List of operator JSON documents.
- Rtype
flask.Response