knitr::opts_chunk$set( collapse = TRUE, comment = "#>", crop = NULL ## Related to https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016656.html )
WARNING: This vignette is a work in progress. If you have questions or would like to see more features, please open an issue at bhklab/AnnotationGx
The ChEMBL database contains information on bioactive drug-like small molecules. The information includes 2-D structures, calculated properties; logP, Molecular Weight, Lipinski Parameters, and abstracted bioactivities; binding constants and ADMET data. The data is curated from primary scientific literature. The ChEMBL API allows for the data to be made available for retrieval in a programmatic fashion. We can use the API to query CHEMBL ID of a compound, retrieve all molecule mechanisms of action, query compound_record resource and molecule resource from the ChEMBL database.
library(AnnotationGx)
Given a ChEMBL ID, we can retrieve the molecule mechanisms of action from the
ChEMBL database using the getChemblMechanism()
function.
NOTE: This is a specialized function that queries the API for the mechanism resource only. To query other resources, please see the Custom Queries section.
``` {r run one query} mechs <- getChemblMechanism("CHEMBL1413") mechs
In the above example, multiple mechanisms of action are returned. ## Custom Queries {#custom-queries} The ChEMBL API allows for a wide range of queries. We have specialized one function, but are open to incorporating more. Please open an issue at [bhklab/AnnotationGx](https://github.com/bhklab/AnnotationGx) with an idea of a specialized function that meets a use case. A query to the API follows the following format:
https://www.ebi.ac.uk/chembl/api/data/[resource]?[field]__[filter_type]=[value]&format=[format]
More information can be found at the [API Documentation](https://chembl.gitbook.io/chembl-interface-documentation/web-services/chembl-data-web-**services******) In summary, the requirements for a query are: 1. The `resource` to be queried 2. The reource `field` to be queried 3. The `filter_type` to be used 4. The `value` to be used for the filter 5. (optional) The `format` of the returned data (default is JSON) For example, the query for the example in [the above section](#chembl-mechanisms) would be: "https://www.ebi.ac.uk/chembl/api/data/mechanism?molecule_chembl_id__in=CHEMBL1413&format=json" where: - `resource` is "mechanism" - `field` is "molecule_chembl_id" - `filter_type` is "in" - `value` is "CHEMBL1413" - `format` is "json" These parameters can be used in the `queryChemblAPI(resource, field, filter_type, value, format = "json")` function to query the ChEMBL API. **NOTE: unlike the `getChemblMechanism()` function which returns a `data.table`, the `queryChemblAPI()` function returns the raw data unformatted** ``` {r run custom query} queryChemblAPI("mechanism", "molecule_chembl_id", "in", "CHEMBL1413")
The getChemblResources()
function returns a list of possible
resources that can be queried:
``` {r query resources} getChemblResources()
The `getChemblResourceFields(resource)` function returns a list of possible fields that can be queried for a given resource: ``` {r query resource fields} getChemblResourceFields("mechanism")
The getChemblFilterTypes()
function returns a list of possible filter types.
{r query filter types}
getChemblFilterTypes()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.