chembl_query: Query ChEMBL using ChEMBL IDs

View source: R/chembl.R

chembl_queryR Documentation

Query ChEMBL using ChEMBL IDs

Description

Retrieve ChEMBL data using a vector of ChEMBL IDs.

Usage

chembl_query(
  query,
  resource = "molecule",
  cache_file = NULL,
  verbose = getOption("verbose"),
  test_service_down = FALSE
)

Arguments

query

character; a vector of ChEMBL IDs.

resource

character; the ChEMBL resource to query. Use [chembl_resources()] to see all available resources.

cache_file

character; the name of the cache file without the file extension. If NULL, results are not cached.

verbose

logical; should a verbose output be printed on the console?

test_service_down

logical; this argument is only used for testing.

Details

Each entry in ChEMBL has a unique ID. Data in ChEMBL is organized in databases called resources. An entry may or may not have a record in a particular resource. An entry may have a record in more than one resource, e.g. a compound may be present in both the "molecule" and the "drug" resource. This function queries a vector of ChEMBL IDs from a specific ChEMBL resource.

If you are unsure which ChEMBL resource contains your ChEMBL ID, use this function with the "chembl_id_lookup" resource to find the appropriate resource for a ChEMBL ID. Note that "chembl_id_lookup" is not a separate function but a resource used by chembl_query.

If cache_file is not NULL the function creates a cache directory in the working directory and a cache file in the cache directory. This file is used in subsequent calls of the function. The function first tries to retrieve query results from the cache file and only accesses the webservice if the ChEMBL ID cannot be found in the cache file. The cache file is extended as new ChEMBL ID-s are queried during the session.

Value

The function returns a list of lists, where each element of the list contains a list of respective query results. Results are simplified, if possible.

Note

Links to the webservice documentation:

References

Gaulton, A., Bellis, L. J., Bento, A. P., Chambers, J., Davies, M., Hersey, A., ... & Overington, J. P. (2012). ChEMBL: a large-scale bioactivity database for drug discovery. Nucleic acids research, 40(D1), D1100-D1107.

Examples

## Not run: 
# Might fail if API is not available

# Search molecules
chembl_query("CHEMBL1082", resource = "molecule")
chembl_query(c("CHEMBL25", "CHEMBL1082"), resource = "molecule")

# Look up ChEMBL IDs in ChEMBL "resources", returns one resource per query.
chembl_query("CHEMBL771355", "chembl_id_lookup")

# Search assays
chembl_query("CHEMBL771355", resource = "assay")

## End(Not run)

webchem documentation built on July 9, 2023, 5:30 p.m.