Get Data from PubChem API
get_pubchem.Rd
This function constructs a URL to query the PubChem API based on the provided parameters and returns the response content.
Usage
get_pubchem(
identifier,
namespace = "cid",
domain = "compound",
operation = NULL,
output = "JSON",
searchtype = NULL,
options = NULL
)
Arguments
- identifier
A vector of positive integers (e.g. cid, sid, aid) or identifier strings (source, inchikey, formula). In some cases, only a single identifier string (name, smiles, xref; inchi, sdf by POST only).
- namespace
Specifies the namespace for the query. For the 'compound' domain, possible values include 'cid', 'name', 'smiles', 'inchi', 'sdf', 'inchikey', 'formula', 'substructure', 'superstructure', 'similarity', 'identity', 'xref', 'listkey', 'fastidentity', 'fastsimilarity_2d', 'fastsimilarity_3d', 'fastsubstructure', 'fastsuperstructure', and 'fastformula'. For other domains, the possible namespaces are domain-specific.
- domain
Specifies the domain of the query. Possible values are 'substance', 'compound', 'assay', 'gene', 'protein', 'pathway', 'taxonomy', 'cell', 'sources', 'sourcetable', 'conformers', 'annotations', 'classification', and 'standardize'.
- operation
Specifies the operation to be performed on the input records. For the 'compound' domain, possible operations include 'record', 'property', 'synonyms', 'sids', 'cids', 'aids', 'assaysummary', 'classification', 'xrefs', and 'description'. The available operations are domain-specific.
- output
Specifies the desired output format. Possible values are 'XML', 'ASNT', 'ASNB', 'JSON', 'JSONP', 'SDF', 'CSV', 'PNG', and 'TXT'.
- searchtype
Specifies the type of search to be performed. For structure searches, possible values are combinations of 'substructure', 'superstructure', 'similarity', 'identity' with 'smiles', 'inchi', 'sdf', 'cid'. For fast searches, possible values are combinations of 'fastidentity', 'fastsimilarity_2d', 'fastsimilarity_3d', 'fastsubstructure', 'fastsuperstructure' with 'smiles', 'smarts', 'inchi', 'sdf', 'cid', or 'fastformula'.
- options
Additional arguments passed to
request
.
Examples
get_pubchem(
identifier = "aspirin",
namespace = "name"
)
#> [1] "{\n \"PC_Compounds\": [\n {\n \"id\": {\n \"id\": {\n \"cid\": 2244\n }\n },\n \"atoms\": {\n \"aid\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21\n ],\n \"element\": [\n 8,\n 8,\n 8,\n 8,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 6,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1\n ]\n },\n \"bonds\": {\n \"aid1\": [\n 1,\n 1,\n 2,\n 2,\n 3,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 8,\n 8,\n 9,\n 9,\n 10,\n 12,\n 13,\n 13,\n 13\n ],\n \"aid2\": [\n 5,\n 12,\n 11,\n 21,\n 11,\n 12,\n 6,\n 7,\n 8,\n 11,\n 9,\n 14,\n 10,\n 15,\n 10,\n 16,\n 17,\n 13,\n 18,\n 19,\n 20\n ],\n \"order\": [\n 1,\n 1,\n 1,\n 1,\n 2,\n 2,\n 1,\n 2,\n 2,\n 1,\n 1,\n 1,\n 1,\n 1,\n 2,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1\n ]\n },\n \"coords\": [\n {\n \"type\": [\n 1,\n 5,\n 255\n ],\n \"aid\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21\n ],\n \"conformers\": [\n {\n \"x\": [\n 3.732,\n 6.3301,\n 4.5981,\n 2.866,\n 4.5981,\n 5.4641,\n 4.5981,\n 6.3301,\n 5.4641,\n 6.3301,\n 5.4641,\n 2.866,\n 2,\n 4.0611,\n 6.8671,\n 5.4641,\n 6.8671,\n 2.31,\n 1.4631,\n 1.69,\n 6.3301\n ],\n \"y\": [\n -0.06,\n 1.44,\n 1.44,\n -1.56,\n -0.56,\n -0.06,\n -1.56,\n -0.56,\n -2.06,\n -1.56,\n 0.94,\n -0.56,\n -0.06,\n -1.87,\n -0.25,\n -2.68,\n -1.87,\n 0.4769,\n 0.25,\n -0.5969,\n 2.06\n ],\n \"style\": {\n \"annotation\": [\n 8,\n 8,\n 8,\n 8,\n 8,\n 8\n ],\n \"aid1\": [\n 5,\n 5,\n 6,\n 7,\n 8,\n 9\n ],\n \"aid2\": [\n 6,\n 7,\n 8,\n 9,\n 10,\n 10\n ]\n }\n }\n ]\n }\n ],\n \"charge\": 0,\n \"props\": [\n {\n \"urn\": {\n \"label\": \"Compound\",\n \"name\": \"Canonicalized\",\n \"datatype\": 5,\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"ival\": 1\n }\n },\n {\n \"urn\": {\n \"label\": \"Compound Complexity\",\n \"datatype\": 7,\n \"implementation\": \"E_COMPLEXITY\",\n \"version\": \"3.4.8.18\",\n \"software\": \"Cactvs\",\n \"source\": \"Xemistry GmbH\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"fval\": 212\n }\n },\n {\n \"urn\": {\n \"label\": \"Count\",\n \"name\": \"Hydrogen Bond Acceptor\",\n \"datatype\": 5,\n \"implementation\": \"E_NHACCEPTORS\",\n \"version\": \"3.4.8.18\",\n \"software\": \"Cactvs\",\n \"source\": \"Xemistry GmbH\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"ival\": 4\n }\n },\n {\n \"urn\": {\n \"label\": \"Count\",\n \"name\": \"Hydrogen Bond Donor\",\n \"datatype\": 5,\n \"implementation\": \"E_NHDONORS\",\n \"version\": \"3.4.8.18\",\n \"software\": \"Cactvs\",\n \"source\": \"Xemistry GmbH\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"ival\": 1\n }\n },\n {\n \"urn\": {\n \"label\": \"Count\",\n \"name\": \"Rotatable Bond\",\n \"datatype\": 5,\n \"implementation\": \"E_NROTBONDS\",\n \"version\": \"3.4.8.18\",\n \"software\": \"Cactvs\",\n \"source\": \"Xemistry GmbH\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"ival\": 3\n }\n },\n {\n \"urn\": {\n \"label\": \"Fingerprint\",\n \"name\": \"SubStructure Keys\",\n \"datatype\": 16,\n \"parameters\": \"extended 2\",\n \"implementation\": \"E_SCREEN\",\n \"version\": \"3.4.8.18\",\n \"software\": \"Cactvs\",\n \"source\": \"Xemistry GmbH\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"binary\": \"00000371C0703800000000000000000000000000000000000000300000000000000000010000001A00000800000C04809800320E80000600880220D208000208002420000888010608C80C273684351A827B60A5E01108B98788C8208E00000000000800000000000000100000000000000000\"\n }\n },\n {\n \"urn\": {\n \"label\": \"IUPAC Name\",\n \"name\": \"Allowed\",\n \"datatype\": 1,\n \"version\": \"2.7.0\",\n \"software\": \"Lexichem TK\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"2-acetoxybenzoic acid\"\n }\n },\n {\n \"urn\": {\n \"label\": \"IUPAC Name\",\n \"name\": \"CAS-like Style\",\n \"datatype\": 1,\n \"version\": \"2.7.0\",\n \"software\": \"Lexichem TK\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"2-acetyloxybenzoic acid\"\n }\n },\n {\n \"urn\": {\n \"label\": \"IUPAC Name\",\n \"name\": \"Markup\",\n \"datatype\": 1,\n \"version\": \"2.7.0\",\n \"software\": \"Lexichem TK\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"2-acetyloxybenzoic acid\"\n }\n },\n {\n \"urn\": {\n \"label\": \"IUPAC Name\",\n \"name\": \"Preferred\",\n \"datatype\": 1,\n \"version\": \"2.7.0\",\n \"software\": \"Lexichem TK\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"2-acetyloxybenzoic acid\"\n }\n },\n {\n \"urn\": {\n \"label\": \"IUPAC Name\",\n \"name\": \"Systematic\",\n \"datatype\": 1,\n \"version\": \"2.7.0\",\n \"software\": \"Lexichem TK\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"2-acetyloxybenzoic acid\"\n }\n },\n {\n \"urn\": {\n \"label\": \"IUPAC Name\",\n \"name\": \"Traditional\",\n \"datatype\": 1,\n \"version\": \"2.7.0\",\n \"software\": \"Lexichem TK\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"2-acetoxybenzoic acid\"\n }\n },\n {\n \"urn\": {\n \"label\": \"InChI\",\n \"name\": \"Standard\",\n \"datatype\": 1,\n \"version\": \"1.0.6\",\n \"software\": \"InChI\",\n \"source\": \"iupac.org\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)\"\n }\n },\n {\n \"urn\": {\n \"label\": \"InChIKey\",\n \"name\": \"Standard\",\n \"datatype\": 1,\n \"version\": \"1.0.6\",\n \"software\": \"InChI\",\n \"source\": \"iupac.org\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"BSYNRYMUTXBXSQ-UHFFFAOYSA-N\"\n }\n },\n {\n \"urn\": {\n \"label\": \"Log P\",\n \"name\": \"XLogP3\",\n \"datatype\": 7,\n \"version\": \"3.0\",\n \"source\": \"sioc-ccbg.ac.cn\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"fval\": 1.2\n }\n },\n {\n \"urn\": {\n \"label\": \"Mass\",\n \"name\": \"Exact\",\n \"datatype\": 1,\n \"version\": \"2.2\",\n \"software\": \"PubChem\",\n \"source\": \"ncbi.nlm.nih.gov\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"180.04225873\"\n }\n },\n {\n \"urn\": {\n \"label\": \"Molecular Formula\",\n \"datatype\": 1,\n \"version\": \"2.2\",\n \"software\": \"PubChem\",\n \"source\": \"ncbi.nlm.nih.gov\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"C9H8O4\"\n }\n },\n {\n \"urn\": {\n \"label\": \"Molecular Weight\",\n \"datatype\": 1,\n \"version\": \"2.2\",\n \"software\": \"PubChem\",\n \"source\": \"ncbi.nlm.nih.gov\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"180.16\"\n }\n },\n {\n \"urn\": {\n \"label\": \"SMILES\",\n \"name\": \"Canonical\",\n \"datatype\": 1,\n \"version\": \"2.3.0\",\n \"software\": \"OEChem\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"CC(=O)OC1=CC=CC=C1C(=O)O\"\n }\n },\n {\n \"urn\": {\n \"label\": \"SMILES\",\n \"name\": \"Isomeric\",\n \"datatype\": 1,\n \"version\": \"2.3.0\",\n \"software\": \"OEChem\",\n \"source\": \"OpenEye Scientific Software\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"CC(=O)OC1=CC=CC=C1C(=O)O\"\n }\n },\n {\n \"urn\": {\n \"label\": \"Topological\",\n \"name\": \"Polar Surface Area\",\n \"datatype\": 7,\n \"implementation\": \"E_TPSA\",\n \"version\": \"3.4.8.18\",\n \"software\": \"Cactvs\",\n \"source\": \"Xemistry GmbH\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"fval\": 63.6\n }\n },\n {\n \"urn\": {\n \"label\": \"Weight\",\n \"name\": \"MonoIsotopic\",\n \"datatype\": 1,\n \"version\": \"2.2\",\n \"software\": \"PubChem\",\n \"source\": \"ncbi.nlm.nih.gov\",\n \"release\": \"2021.10.14\"\n },\n \"value\": {\n \"sval\": \"180.04225873\"\n }\n }\n ],\n \"count\": {\n \"heavy_atom\": 13,\n \"atom_chiral\": 0,\n \"atom_chiral_def\": 0,\n \"atom_chiral_undef\": 0,\n \"bond_chiral\": 0,\n \"bond_chiral_def\": 0,\n \"bond_chiral_undef\": 0,\n \"isotope_atom\": 0,\n \"covalent_unit\": 1,\n \"tautomers\": -1\n }\n }\n ]\n}\n"