This is an R package that provides access to the BioThings APIs:
As new APIs are added, this package will be updated to provide access to them. If there is a new API and the package still hasn't been updated, you can create a new configuration object that will allow you to access such new API.
install.packages("devtools")
library(devtools)
install_github("biothings/BioThingsClient.R")
The package is intended to be simple to use, without the need to instantiate a class object (though you can! Particularly if you have an updated API configuration). For a given API and relevant id, the user can make requests from the API as follows:
library(BioThingsClient.R)
gene_client <- BioThingsClient("gene")
btGet(gene_client, "1017")
# or:
btGet("gene", "1017")
# or:
btGet("gene", "c("9606", "10030")")
library(BioThingsClient.R)
taxon_client <- BioThingsClient("taxon")
btGet(taxon_client, "9606")
# or:
btGet("taxon", "9606")
library(BioThingsClient.R)
variant_client <- BioThingsClient("variant")
btGet(variant_client, "chr7:g.140453134T>C")
library(BioThingsClient.R)
chem_client <- BioThingsClient("chem")
library(BioThingsClient.R)
biothings_clients
btQuery("chem", "drugbank.name:celecoxib")
btQuery("variant", c("rs58991260", "rs2500"))
There are some issues with requesting data frames for certain APIs and endpoints. Some chemical responses are so large that fromJSON will hang. Others have so many fields that the data frame will be heavily nested and hard to use. We recommend avoid requesting data frames without specifying certain fields.