The UniChem database provides a publicly available REST API for
programmatic retrieval of mappings from standardized structural compound
identifiers to unique compound IDs across a range of large online
cheminformatic databases such as PubChem, ChEMBL, DrugBank and many
more. The service accepts POST requests to two different end-points:
/compound and /connectivity. Both endpoints
accept query parameters via the POST body in JSON format. The
/compound API returns exact matches for the queried
compound, while the /connectivity API uses layers of the
International Chemical Identifier (InChI) of the query compound to
return exact matches as well as structurally related compounds such as
isomers, salts, ionizations and more. [@UniChemBeta;
@chambersUniChemUnifiedChemical2013]
The functions in AnnotationGx have been designed to
allow package users to easily query UniChem resources without any
pre-existing knowledge of HTTP requests or the API specifications. In
doing so we hope to provide an R native interface for mapping between
various cheminformatic databases, accessible to anyone familar with
using R functions!
UniChem is provided under the EMBL-EBI Terms of Use. Source: https://www.ebi.ac.uk/licencing/
To see a table of database identifiers available via UniChem, you can
call the getUniChemSources function. By default, just the
database shortname (“Name”) and UniChem’s ID for it (“SourceID”) columns
are returned. To return all columns, pass the
all_columns = TRUE argument
run_unichem_example(getUnichemSources())
#> Name SourceID
#> <char> <int>
#> 1: surechembl 15
#> 2: rcsb_pdb 3
#> 3: chembl 1
#> 4: chebi 7
#> 5: hmdb 18
#> 6: pdbe 5
#> 7: gtopdb 4
#> 8: nmrshiftdb2 24
#> 9: fdasrs 14
#> 10: pubchem 22
#> 11: molport 28
#> 12: drugbank 2
#> 13: rhea 38
#> 14: lipidmaps 33
#> 15: comptox 32
#> 16: drugcentral 34
#> 17: brenda 37
#> 18: bindingdb 31
#> 19: swisslipids 41
#> 20: CCDC 50
#> 21: clinicaltrials 46
#> 22: wikipedia 84
#> 23: foodb 51
#> 24: probes_and_drugs 49
#> 25: glygen 53
#> Name SourceID
#> <char> <int>When mapping using the queryUnichemCompound function,
these are the sources that can be used from, and the databases to which
the compound mappings will be returned.
The queryUnichemCompound function allows you to query
the UniChem Compound API to retrieve mappings for a given compound
identifier. The function takes two mandatory arguments. The first is the
compound argument which is the compound identifier to be
queried. The second is the type argument which is the type
of compound identifier to search for. Options are “uci”, “inchi”,
“inchikey”, and “sourceID”. The sourceID argument is
optional and is only required if the type argument is
“sourceID”.
The function returns a list of:
data.table containing the mapping
to other Databases with the following headings:
character The compound identifiercharacter The name of the databasecharacter The long name of the databasecharacter The UniChem Source IDcharacter The URL of the sourcelist of the following six mappings:
character The UniChem Identifiercharacter The InChIKeycharacter The InChIcharacter The molecular formulacharacter connection representation
“1-6(10)13-8-5-3-2-4-7(8)9(11)12”character hydrogen atom connections
“2-5H,1H3,(H,11,12)”uci (UniChem Identifier)Note: This type of query requires you to know the UniChem Identifier for the compound.
run_unichem_example(
queryUnichemCompound(compound = "161671", type = "uci")
)
#> $External_Mappings
#> compoundID Name NameLong sourceID
#> <char> <char> <char> <int>
#> 1: CHEMBL25 chembl ChEMBL 1
#> 2: DB00945 drugbank DrugBank 2
#> 3: AIN rcsb_pdb RCSB PDB 3
#> 4: 4139 gtopdb Guide to Pharmacology 4
#> 5: AIN pdbe Protein Data Bank in Europe 5
#> ---
#> 1013: NCT06478537 clinicaltrials Clinical Trials 46
#> 1014: PD002467 probes_and_drugs Probes&Drugs 49
#> 1015: ACSALA CCDC CSD (Cambridge Structural Database) 50
#> 1016: FDB000894 foodb The Food Database 51
#> 1017: Aspirin wikipedia Wikipedia 84
#> sourceURL
#> <char>
#> 1: https://www.ebi.ac.uk/chembldb/compound/inspect/CHEMBL25
#> 2: https://go.drugbank.com/drugs/DB00945
#> 3: https://www.rcsb.org/ligand/AIN
#> 4: https://www.guidetopharmacology.org/GRAC/LigandDisplayForward?ligandId=4139
#> 5: https://www.ebi.ac.uk/pdbe-srv/pdbechem/chemicalCompound/show/AIN
#> ---
#> 1013: https://clinicaltrials.gov/study/NCT06478537
#> 1014: https://www.probes-drugs.org/compounds/PD002467
#> 1015: https://www.ccdc.cam.ac.uk/structures/search?sid=UNICHEM&pid=csd:ACSALA
#> 1016: https://foodb.ca/compounds/FDB000894
#> 1017: https://en.wikipedia.org/wiki/Aspirin
#>
#> $UniChem_Mappings
#> $UniChem_Mappings$UniChem.UCI
#> [1] 161671
#>
#> $UniChem_Mappings$UniChem.InchiKey
#> [1] "BSYNRYMUTXBXSQ-UHFFFAOYSA-N"
#>
#> $UniChem_Mappings$UniChem.Inchi
#> [1] "InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)"
#>
#> $UniChem_Mappings$UniChem.formula
#> [1] "C9H8O4"
#>
#> $UniChem_Mappings$UniChem.connections
#> [1] "1-6(10)13-8-5-3-2-4-7(8)9(11)12"
#>
#> $UniChem_Mappings$UniChem.hAtoms
#> [1] "2-5H,1H3,(H,11,12)"sessionInfo()
#> R version 4.6.2 (2026-10-29)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] data.table_1.18.6.1 AnnotationGx_0.99.15 BiocStyle_2.41.0
#>
#> loaded via a namespace (and not attached):
#> [1] bit_4.6.0 jsonlite_2.0.0 crayon_1.5.3
#> [4] dplyr_1.2.1 compiler_4.6.2 BiocManager_1.30.27
#> [7] filelock_1.0.3 tidyselect_1.2.1 xml2_1.6.0
#> [10] blob_1.3.0 parallel_4.6.2 jquerylib_0.1.4
#> [13] yaml_2.3.12 fastmap_1.2.0 R6_2.6.1
#> [16] generics_0.1.4 curl_8.1.0 httr2_1.3.0
#> [19] knitr_1.52 backports_1.5.1 checkmate_2.3.4
#> [22] tibble_3.3.1 maketools_1.3.2 DBI_1.3.0
#> [25] bslib_0.12.0 pillar_1.11.1 rlang_1.3.0
#> [28] cachem_1.1.0 xfun_0.62 sass_0.5.0
#> [31] sys_3.4.3 bit64_4.8.6 otel_0.3.0
#> [34] RSQLite_3.53.3 memoise_2.0.1 cli_3.6.6
#> [37] withr_3.0.3 magrittr_2.0.5 digest_0.6.39
#> [40] dbplyr_2.6.0 lifecycle_1.0.5 BiocFileCache_3.3.3
#> [43] vctrs_0.7.3 evaluate_1.0.5 glue_1.8.1
#> [46] buildtools_1.0.0 purrr_1.2.2 rmarkdown_2.32
#> [49] tools_4.6.2 pkgconfig_2.0.3 htmltools_0.5.9