This package serves as a query interface for important community collections of
small molecules, while also allowing users to include custom compound
collections. Both annotation and structure information is provided. The
annotation data is stored in an SQLite database, while the structure
information is stored in Structure Definition Files (SDF). Both are hosted
on Bioconductor’s AnnotationHub
. A detailed description of the included
data types is provided under the Supplemental Material section of this vignette.
At the time of writing, the following community databases are included:
In addition to providing access to the above compound collections, the package
supports the integration of custom collections of compounds, that will be
automatically stored for the user in the same data structure as the
preconfigured databases. Both custom collections and those provided by this
package can be queried in a uniform manner, and then further analyzed with
cheminformatics packages such as ChemmineR
, where SDFs are imported into
flexible S4 containers (Cao et al. 2008).
As Bioconductor package customCMPdb
can be installed with the
BiocManager::install()
function.
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("customCMPdb")
To obtain the most recent updates of the package immediately, one can also install it directly from GitHub as follows.
devtools::install_github("yduan004/customCMPdb", build_vignettes=TRUE)
Next the package needs to be loaded in a user’s R session.
library(customCMPdb)
library(help = "customCMPdb") # Lists package info
Open vignette of this package.
browseVignettes("customCMPdb") # Opens vignette
The following introduces how to load and query the different datasets.
The compound annotation tables are stored in an SQLite database. This data can be
loaded into a user’s R session as follows (here for drugAgeAnnot
).
conn <- loadAnnot()
library(RSQLite)
dbListTables(conn)
## [1] "DrugBankAnnot" "cmapAnnot" "drugAge4" "drugAgeAnnot"
## [5] "id_mapping" "lincs2" "lincsAnnot" "myCustom"
## [9] "myCustom2"
drugAgeAnnot <- dbReadTable(conn, "drugAgeAnnot")
head(drugAgeAnnot)
## drugage_id compound_name synonyms species
## 1 ida00001 Vitexin <NA> Caenorhabditis elegans
## 2 ida00002 Cyclosporin A <NA> Caenorhabditis elegans
## 3 ida00003 Histidine L-histidine Caenorhabditis elegans
## 4 ida00004 SRT1720 <NA> Mus musculus
## 5 ida00005 Cordyceps sinensis oral liquid <NA> Drosophila melanogaster
## 6 ida00006 Lysine <NA> Caenorhabditis elegans
## strain dosage avg_lifespan_change max_lifespan_change gender
## 1 N2 50 µM 8 5.3 <NA>
## 2 <NA> 88 µM 18 <NA> <NA>
## 3 N2 5 mM 10 <NA> <NA>
## 4 C57BL/6J 100 mg/kg body weight 8.8 0 <NA>
## 5 Oregon-K 0.20 mg/ml 32 15.4 Male
## 6 N2 5 mM 8 <NA> <NA>
## significance pubmed_id Comment pref_name pubchem_cid DrugBank_id
## 1 <NA> 26535084 <NA> VITEXIN 5280441 <NA>
## 2 <NA> 24134630 <NA> <NA> <NA> DB00091
## 3 <NA> 25643626 <NA> HISTIDINE 6274, 6971009 DB00117
## 4 <NA> 24582957 <NA> <NA> <NA> <NA>
## 5 <NA> 26239097 Mix <NA> <NA> <NA>
## 6 <NA> 25643626 <NA> LYSINE 5962, 122198194 DB00123, DB11101
dbDisconnect(conn)
The corresponding structures for the above DrugAge example can be loaded into an SDFset
object as follows.
da_sdfset <- loadSDFwithName(source="DrugAge")
Instructions on how to work with SDFset
objects are provided in the ChemmineR
vignette
here. For instance, one can plot any of
the loaded structures with the plot
function.
ChemmineR::cid(da_sdfset) <- ChemmineR::sdfid(da_sdfset)
ChemmineR::plot(da_sdfset[1])
The SDF from DrugBank can be loaded into R the same way. The
corresponding SDF file was downloaded from
here. During the import
into R ChemmineR
checks the validity of the imported compounds.
db_sdfset <- loadSDFwithName(source="DrugBank")
The import of the SDF of the CMAP02 database works the same way.
cmap_sdfset <- loadSDFwithName(source="CMAP2")
The same applies to the SDF of the small molecules included in the LINCS database.
lincs_sdfset <- loadSDFwithName(source="LINCS")
For reproducibility, the R code for generating the above datasets is included
in the inst/scripts/make-data.R
file of this package. The file location
on a user’s system can be obtained with system.file("scripts/make-data.R", package="customCMPdb")
.
The SQLite Annotation Database is hosted on Bioconductor’s AnnotationHub
.
Users can download it to a local AnnotationHub
cache directory. The path to this
directory can be obtained as follows.
library(AnnotationHub)
ah <- AnnotationHub()
annot_path <- ah[["AH79563"]]
The following introduces how users can import to the SQLite database
their own compound annotation tables. In this case, the corresponding
ChEMBL IDs need to be included under the chembl_id
column.
The name of the custom data set can be specified under the annot_name
argument. Note, this name is case insensitive.
chembl_id <- c("CHEMBL1000309", "CHEMBL100014", "CHEMBL10",
"CHEMBL100", "CHEMBL1000", NA)
annot_tb <- data.frame(cmp_name=paste0("name", 1:6),
chembl_id=chembl_id,
feature1=paste0("f", 1:6),
feature2=rnorm(6))
addCustomAnnot(annot_tb, annot_name="myCustom")
## Warning in addCustomAnnot(annot_tb, annot_name = "myCustom"): The annot_name
## exists in the SQLite database, the old table is not overwritten, set
## 'overwrite=TRUE' to overwrite the existing one
The following shows how to delete custom annotation tables
by referencing them by their name. To obtain a list of custom
annotation tables present in the database, the listAnnot
function
can be used.
listAnnot()
## [1] "DrugBankAnnot" "cmapAnnot" "drugAge4" "drugAgeAnnot"
## [5] "lincs2" "lincsAnnot" "myCustom" "myCustom2"
deleteAnnot("myCustom")
listAnnot()
## [1] "DrugBankAnnot" "cmapAnnot" "drugAge4" "drugAgeAnnot"
## [5] "lincs2" "lincsAnnot" "myCustom2"
The defaultAnnot
function sets the annotation SQLite database back to the
original version provided by customCMPdb
. This is achieved by deleting the
existing (e.g. custom) database and re-downloading a fresh instance from
AnnotationHub
.
defaultAnnot()
The queryAnnotDB
function can be used to query the compound annotations from
the default resources as well as the custom resources stored in the SQLite
annotation database. The query can be a set of ChEMBL IDs. In this case it
returns a data.frame
containing the annotations of the matching compounds
from the selected annotation resources specified under the
argument. The listAnnot
function returns the names that can be assigned to
the annot
argument.
query_id <- c("CHEMBL1064", "CHEMBL10", "CHEMBL113", "CHEMBL1004", "CHEMBL31574")
listAnnot()
## [1] "DrugBankAnnot" "cmapAnnot" "drugAge4" "drugAgeAnnot"
## [5] "lincs2" "lincsAnnot" "myCustom2"
qres <- queryAnnotDB(query_id, annot=c("drugAgeAnnot", "lincsAnnot"))
qres
## chembl_id species strain dosage
## 1 CHEMBL10 Drosophila melanogaster Oregon R 300 µM
## 2 CHEMBL1004 <NA> <NA> <NA>
## 3 CHEMBL1064 Drosophila melanogaster <NA> 240 µM
## 4 CHEMBL113 Drosophila melanogaster Oregon R 0.01 mg/ml
## 5 CHEMBL31574 Saccharomyces cerevisiae PSY316AT MAT_ 10 µM
## avg_lifespan_change max_lifespan_change gender significance lincs_id
## 1 30.3 <NA> <NA> <NA> BRD-A37704979
## 2 <NA> <NA> <NA> <NA> BRD-A44008656
## 3 25 <NA> <NA> <NA> BRD-K22134346
## 4 -10.1 <NA> Male NS BRD-K02404261
## 5 55 <NA> <NA> <NA> <NA>
## pert_iname is_touchstone inchi_key pubchem_cid
## 1 SB-203580 0 CDMGBJANTYXAIV-UHFFFAOYSA-N 176155
## 2 doxylamine 1 HCFDWZZGGLSKEP-UHFFFAOYSA-N -666
## 3 simvastatin 0 RYMZZMVNJRMUDD-HGQWONQESA-N -666
## 4 caffeine 1 RYYVLZVUVIJVGH-UHFFFAOYSA-N -666
## 5 <NA> NA <NA> <NA>
# query the added custom annotation
addCustomAnnot(annot_tb, annot_name="myCustom")
qres2 <- queryAnnotDB(query_id, annot=c("lincsAnnot", "myCustom"))
qres2
## chembl_id lincs_id pert_iname is_touchstone
## 1 CHEMBL10 BRD-A37704979 SB-203580 0
## 2 CHEMBL1004 BRD-A44008656 doxylamine 1
## 3 CHEMBL1064 BRD-K22134346 simvastatin 0
## 4 CHEMBL113 BRD-K02404261 caffeine 1
## 5 CHEMBL31574 <NA> <NA> NA
## inchi_key pubchem_cid cmp_name feature1 feature2
## 1 CDMGBJANTYXAIV-UHFFFAOYSA-N 176155 name3 f3 -0.2507677
## 2 HCFDWZZGGLSKEP-UHFFFAOYSA-N -666 <NA> <NA> NA
## 3 RYMZZMVNJRMUDD-HGQWONQESA-N -666 <NA> <NA> NA
## 4 RYYVLZVUVIJVGH-UHFFFAOYSA-N -666 <NA> <NA> NA
## 5 <NA> <NA> <NA> <NA> NA
Since the supported compound databases use different identifiers, a ChEMBL ID mapping table is used to connect identical entries across databases as well as to link out to other resources such as ChEMBL itself or PubChem. For custom compounds, where ChEMBL IDs are not available yet, one can use alternative and/or custom identifiers.
query_id <- c("BRD-A00474148", "BRD-A00150179", "BRD-A00763758", "BRD-A00267231")
qres3 <- queryAnnotDB(chembl_id=query_id, annot=c("lincsAnnot"))
qres3
## lincs_id pert_iname is_touchstone inchi_key
## 2 BRD-A00150179 5-hydroxytryptophan 0 QSHLMQDRPXXYEE-UHFFFAOYSA-N
## 3 BRD-A00267231 hemado 1 KOCIMZNSNPOGOP-UHFFFAOYSA-N
## 5 BRD-A00474148 BRD-A00474148 0 RCGAUPRLRFZAMS-UHFFFAOYSA-N
## 10 BRD-A00763758 BRD-A00763758 0 MASIPYZIHWNUPA-UHFFFAOYSA-N
## pubchem_cid
## 2 589768
## 3 4043357
## 5 44825297
## 10 43209100
The DrugAge database is manually curated by experts. It contains an extensive
compilation of drugs, compounds and supplements (including natural products and
nutraceuticals) with anti-aging properties that extend longevity in model
organisms (Barardo et al. 2017). The DrugAge build2 database was downloaded from
here as a CSV file. The
downloaded drugage.csv
file contains compound_name
, synonyms
, species
, strain
,
dosage
, avg_lifespan_change
, max_lifespan_change
, gender
, significance
,
and pubmed_id
annotation columns. Since the DrugAge database only contains the
drug name as identifiers, it is necessary to map the drug name to other uniform
drug identifiers, such as ChEMBL IDs. In this package,
the drug names have been mapped to ChEMBL (Gaulton et al. 2012),
PubChem (Kim et al. 2019) and DrugBank IDs semi-manually
and stored under the inst/extdata
directory named as drugage_id_mapping.tsv
.
Part of the id mappings in the drugage_id_mapping.tsv
table is generated
by the function for compound names that have ChEMBL
ids from the ChEMBL database (version 24). The missing IDs were added
manually. A semi-manual approach was to use this
web service. After the semi-manual process,
the left ones were manually mapped to ChEMBL, PubChem and DrugBank ids. The
entries that are mixture like green tee extract or peptide like Bacitracin were commented.
Then the drugage_id_mapping
table was built into the annotation SQLite database
named as compoundCollection_0.1.db
with table name of drugAgeAnnot
by buildDrugAgeDB
function.
The DrugBank annotation table (DrugBankAnnot
) was downloaded from the DrugBank database
in xml file.
The most recent release version at the time of writing this document is 5.1.5.
The extracted xml file was processed by the function in this package.
dbxml2df
and df2SQLite
functions in this package were used to load the xml
file into R and covert to a data.frame R object, then stored in the
compoundCollection
SQLite annotation database.
There are 55 annotation columns in the DrugBank annotation table, such as
drugbank_id
, name
, description
, cas-number
, groups
, indication
,
pharmacodynamics
, mechanism-of-action
, toxicity
, metabolism
, half-life
,
protein-binding
, classification
, synonyms
, international-brands
, packagers
,
manufacturers
, prices
, dosages
, atc-codes
, fda-label
, pathways
, targets
.
The DrugBank id to ChEMBL id mappings were obtained from
UniChem.
The CMAP02 annotation table (cmapAnnot
) was processed from the downloaded compound
instance table
using the buildCMAPdb
function defined by this package. The CMAP02 instance table contains
the following drug annotation columns: instance_id
, batch_id
, cmap_name
, INN1
,
concentration (M)
, duration (h)
, cell2
, array3
, perturbation_scan_id
,
vehicle_scan_id4
, scanner
, vehicle
, vendor
, catalog_number
, catalog_name
.
Drug names are used as drug identifies. The buildCMAPdb
function maps the drug
names to external drug ids including UniProt
(The UniProt Consortium 2017),
PubChem
, DrugBank
and ChemBank
(Seiler et al. 2008) ids. It also adds additional
annotation columns such as directionality
, ATC codes
and SMILES structure
.
The generated cmap.db
SQLite database from buildCMAPdb
function contains both
compound annotation table and structure information. The ChEMBL id mappings were
further added to the annotation table via PubChem CID to ChEMBL id mappings from
UniChem.
The CMAP02 annotation table was stored in the compoundCollection
SQLite annotation
database. Then the CMAP internal IDs to ChEMBL id mappings were added to the ID
mapping table.
The LINCS 2017 compound annotation table (lincsAnnot
) was downloaded from
GEO
where only compounds were selected. The annotation columns are lincs_id
, pert_name
,
pert_type
, is_touchstone
, inchi_key_prefix
, inchi_key
, canonical_smiles
, pubchem_cid
.
The annotation table was stored in the compoundCollection
SQLite annotation database.
Since the annotation only contains LINCS id to PubChem CID mapping, the LINCS ids
were also mapped to ChEMBL ids via inchi key.
The SQLite annotation database also contains compound annotation tables of
drugAge4
and lincs2
. They contain annotations for compounds
in DrugAge build 4 database, and the newest LINCS beta database released in 2020
at CLUE.
sessionInfo()
## R Under development (unstable) (2024-10-21 r87258)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.21-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [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: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] AnnotationHub_3.15.0 BiocFileCache_2.15.0 dbplyr_2.5.0
## [4] BiocGenerics_0.53.0 RSQLite_2.3.7 ChemmineR_3.59.0
## [7] customCMPdb_1.17.0 BiocStyle_2.35.0
##
## loaded via a namespace (and not attached):
## [1] KEGGREST_1.47.0 gtable_0.3.6 ggplot2_3.5.1
## [4] rjson_0.2.23 xfun_0.48 bslib_0.8.0
## [7] htmlwidgets_1.6.4 Biobase_2.67.0 vctrs_0.6.5
## [10] tools_4.5.0 bitops_1.0-9 generics_0.1.3
## [13] stats4_4.5.0 curl_5.2.3 tibble_3.2.1
## [16] fansi_1.0.6 AnnotationDbi_1.69.0 highr_0.11
## [19] blob_1.2.4 pkgconfig_2.0.3 S4Vectors_0.45.0
## [22] lifecycle_1.0.4 GenomeInfoDbData_1.2.13 compiler_4.5.0
## [25] Biostrings_2.75.0 tinytex_0.53 munsell_0.5.1
## [28] GenomeInfoDb_1.43.0 htmltools_0.5.8.1 sass_0.4.9
## [31] RCurl_1.98-1.16 yaml_2.3.10 pillar_1.9.0
## [34] crayon_1.5.3 jquerylib_0.1.4 DT_0.33
## [37] cachem_1.1.0 magick_2.8.5 mime_0.12
## [40] tidyselect_1.2.1 digest_0.6.37 purrr_1.0.2
## [43] dplyr_1.1.4 bookdown_0.41 BiocVersion_3.21.1
## [46] rsvg_2.6.1 grid_4.5.0 fastmap_1.2.0
## [49] colorspace_2.1-1 cli_3.6.3 magrittr_2.0.3
## [52] base64enc_0.1-3 XML_3.99-0.17 utf8_1.2.4
## [55] withr_3.0.2 scales_1.3.0 filelock_1.0.3
## [58] UCSC.utils_1.3.0 rappdirs_0.3.3 bit64_4.5.2
## [61] rmarkdown_2.28 XVector_0.47.0 httr_1.4.7
## [64] bit_4.5.0 gridExtra_2.3 png_0.1-8
## [67] memoise_2.0.1 evaluate_1.0.1 knitr_1.48
## [70] IRanges_2.41.0 rlang_1.1.4 Rcpp_1.0.13
## [73] glue_1.8.0 DBI_1.2.3 BiocManager_1.30.25
## [76] jsonlite_1.8.9 R6_2.5.1 zlibbioc_1.53.0