Rbioapi
rbioapi: User-Friendly R Interface to Biologic Web Services' API
Install / Use
/learn @moosa-r/RbioapiREADME
rbioapi: User-Friendly R Interface to Biologic Web Services’ API
Moosa Rezwani 2025-06-29
<img src="man/figures/logo.svg" align="right" width="200"/>
<!-- badges: start --> <!-- badges: end -->What does rbioapi do?
Currently fully supports Enrichr, JASPAR, miEAA, PANTHER, Reactome, STRING, and UniProt!
The goal of rbioapi is to provide a user-friendly and consistent interface to biological databases and services: In a way that insulates the user from technicalities of using web services API and creates a unified and easy-to-use interface to biological and medical web services.
With rbioapi, you do not need to have technical knowledge about web services API or learn how to work with a new package for every biologic service or database. This an ongoing project; New databases and services will be added periodically. Feel free to suggest any databases or services you often use.
What is Supported by rbioapi?
rbioapi is dedicated to Biological or Medical databases and web services. Currently, rbioapi supports and covers every API resources in the following services: (in alphabetical order):
On CRAN (Stable) version: (https://cran.r-project.org/package=rbioapi)
- Enrichr (rbioapi vignette article) <sup>(new)</sup>
- JASPAR (rbioapi vignette article) <sup>(new)</sup>
- miEAA (rbioapi vignette article)
- PANTHER (rbioapi vignette article)
- Reactome (rbioapi vignette article)
- STRING (rbioapi vignette article)
- UniProt (rbioapi vignette article)
Only on Github (Developmental) version: (https://github.com/moosa-r/rbioapi/):
- currently none
Each of the services has its dedicated vignette article. In this article, I will write about the general framework of rbioapi. Make sure to check the vignette article of each service to learn more about how to use them.
Note That: rbioapi is an ongoing project. New databases and services will be implemented periodically in order to gradually make the package as comprehensive as possible. Do you see yourself often using a certain database/service? Feel free to suggest any database/service by creating an issue on our GitHub repository. I will appreciate any suggestions.
How to install?
You can install the stable release version of rbioapi from CRAN with:
install.packages("rbioapi")
However, the CRAN version is released at longer intervals, You can install the most recent -development- version from GitHub with:
install.packages("remotes")
remotes::install_github("moosa-r/rbioapi")
Now, we can load the package:
library(rbioapi)
Naming conventions
To keep the namespace organized, functions names follow this pattern:
rba_[service_name]_[resource_name]
For example, rba_string_version() will call
STRING’s
version resource.
rba_string_version()
#> Retrieving the STRING database version and address used by rbioapi.
#> $string_version
#> [1] "12.0"
#>
#> $stable_address
#> [1] "https://version-12-0.string-db.org"
Thus, to this version, rbioapi function will have one of the following naming schema:
- rba_enrichr_*
- rba_jaspar_*
- rba_mieaa_*
- rba_panther_*
- rba_reactome_*
- rba_string_*
- rba_uniprot_*
There are three exceptions: rba_options(), rba_connection_test(),
and rba_pages(); these are helper functions. More on that later.
Changing the options
To give users greater control, rbioapi offers multiple configurable
options. See the manual of rba_options() function for a full
description of available options. In short, some of the options will
govern rbioapi’s connection with servers (e.g. timeout, retry) and some
of the options will modify your experience with rbioapi (e.g. verbose,
diagnostics, save_file). There are two ways that you may use to change
any option. Also, you can get table of available rbioapi options and
their current values by calling rba_options()without any argument:
rba_options()
#> rbioapi_option current_value allowed_value
#> 1 diagnostics FALSE Logical (TRUE/FALSE)
#> 2 dir_name rbioapi Character
#> 3 progress FALSE Logical (TRUE/FALSE)
#> 4 retry_max 0 Numeric (0 or greater)
#> 5 retry_wait 10 Numeric (0 or greater)
#> 6 save_file FALSE Logical (TRUE/FALSE)
#> 7 skip_error TRUE Logical (TRUE/FALSE)
#> 8 timeout 30 Numeric (0.1 or greater)
#> 9 verbose TRUE Logical (TRUE/FALSE)
Now, let us consider the ways in which we can alter the settings:
Change the option globally
Changing an option globally means that for the rest of your R session,
any rbioapi function will respect the changed option. To do this, use
rba_options(). Each argument in this function corresponds to a certain
option; Thus by running this function with your desired new values, you
could globally alter that rbioapi option. for example:
rba_options(save_file = TRUE)
## From now on, the raw file of server's response will be saved to your working directory.
rba_options(verbose = FALSE)
## From now on, the package will be quiet.
Change the option only within a function call
You can pass additional arguments to any rbioapi function using
“ellipsis” (the familiar … or dot dot dot!). Meaning that you can call
any function with additional arguments where each is ‘option = value’
pair. This way, any changes in options will be confined within that
particular function call. For example:
## Save the server's raw response file:
x <- rba_reactome_species(
only_main = TRUE,
save_file = "reactome_species.json"
)
## Also, in the case of connection failure, retry up to 10 times:
x <- rba_reactome_species(
only_main = TRUE,
save_file = "reactome_species.json",
retry_max = 10
)
## Run these codes in your own R session to see the difference:
## show internal diagnostics boring details
x <- rba_uniprot_proteins_crossref(
db_id = "CD40",
db_name = "HGNC",
diagnostics = TRUE
)
## The next function you call, will still use the default rbioapi options
x <- rba_uniprot_proteins_crossref(
db_id = "CD40",
db_name = "HGNC"
)
Connection test
The second exception in functions’ naming schema is
rba_connection_test(). Run this simple function to check your
connection with the supported services/databases. If you encounter
errors when using rbioapi, kindly run this function to make sure that
your internet connection or the servers are fine.
rba_connection_test(print_output = TRUE)
#> Checking Your connection to the Databases currently supported by rbioapi:
#> --->>> Internet :
#> +++ Connected to the Internet.
#> --->>> Enrichr :
#> +++ The server is responding.
#> --->>> Ensembl :
#> +++ The server is responding.
#> --->>> JASPAR :
#> +++ The server is responding.
#> --->>> miEAA :
#> +++ The server is responding.
#> --->>> PANTHER :
#> +++ The server is responding.
#> --->>> Reactome Content Service :
#> +++ The server is responding.
#> --->>> Reactome Analysis Service :
#> +++ The server is responding.
#> --->>> STRING :
#> +++ The server is responding.
#> --->>> UniProt :
#> +++ The server is responding.
Iterating over paginated results
Some API resources will return paginated responses. This is particularly
common in API resources which return potentially very large responses.
In rbioapi, for these cases, there are arguments such as “page_number”
(with default value of 1) and -if the API resource allows- “page_size”.
To save your time, you may use rba_pages(). This function will iterate
over the pages you have specified.
Take rba_uniprot_taxonomy_name as an example. This function allows you to search taxonomic nodes in UniProt. The response can potentially have a huge size, so [UniProt](https://www.un
