-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new functions for querying ChEMBL API, and add Vignette
- Loading branch information
Showing
9 changed files
with
422 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: AnnotationGx | ||
Title: AnnotationGx: A package for building, updating and querying an | ||
annotation database for pharmaco-genomic data | ||
Version: 0.0.0.9080 | ||
Version: 0.0.0.9081 | ||
Authors@R: c( | ||
person("Jermiah", "Joseph", role = c("aut", "cre"), | ||
email = "[email protected]"), | ||
|
@@ -32,7 +32,10 @@ Suggests: | |
covr, | ||
readxl, | ||
knitr, | ||
rmarkdown | ||
rmarkdown, | ||
BiocStyle, | ||
RefManageR, | ||
sessioninfo | ||
Config/testthat/edition: 3 | ||
Config/testthat/parallel: true | ||
Config/testthat/start-first: watcher, parallel* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
--- | ||
title: "Querying ChEMBL Database" | ||
author: | ||
- name: Jermiah Joseph, Shahzada Muhammad Shameel Farooq, and Christopher Eeles | ||
output: | ||
BiocStyle::html_document: | ||
self_contained: yes | ||
toc: true | ||
toc_float: true | ||
toc_depth: 2 | ||
code_folding: show | ||
date: "`r doc_date()`" | ||
package: "`r pkg_ver('AnnotationGx')`" | ||
vignette: > | ||
%\VignetteIndexEntry{Querying ChEMBL Database} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
|
||
```{r setup, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>", | ||
crop = NULL ## Related to https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016656.html | ||
) | ||
``` | ||
|
||
|
||
# Introduction to ChEMBL API | ||
|
||
**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](https://github.com/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. | ||
|
||
|
||
## Setup | ||
|
||
```{r setup agx} | ||
library(AnnotationGx) | ||
``` | ||
|
||
|
||
|
||
## Retrieve molecule mechanisms of action from ChEMBL {#chembl-mechanisms} | ||
|
||
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](#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() | ||
``` |
Oops, something went wrong.