How moosa-r/rbioapi works
Purpose and Runtime
rbioapi is an R package that provides a consistent, user-facing API over biological web services. Users load the package and call exported rba_<service>_<resource> functions; package startup behavior is in R/zzz.R, namespace/export wiring in NAMESPACE, and package dependencies/metadata in DESCRIPTION.
Entry Points and Shared Request Layer
Public calls are organized by remote service but rely on common request, validation, parsing, error, and option behavior implemented in shared modules. The principal cross-cutting boundary is from R-facing resource functions to HTTP requests and normalized R objects.
• R/internal_functions.R
• R/helper_functions.R
• R/zzz.R
Global or per-call options govern timeout, retry, diagnostics, verbosity, saving raw responses, error skipping, and request metadata. rba_connection_test(), pagination, and metadata support are package-wide operational entry points rather than service-specific APIs.
Service Adapter Families
Each supported external service has a dedicated adapter module exposing resource-oriented functions. These modules encode endpoint-specific arguments and response transformation while conforming to the shared rba_* conventions.
• Enrichr: R/enrichr.R
• JASPAR: R/jaspar.R
• miEAA and PANTHER: R/mieaa.R, R/panther.R
• STRING: R/stringdb.R
The external-service boundary includes Enrichr, JASPAR, miEAA, PANTHER, STRING, Reactome, and UniProt. Ensembl is also contacted for connection checking according to the README.
Reactome Split: Content vs. Analysis Workflows
Reactome is separated into content-service access and analysis-service workflows. Content access covers pathway/entity/search/export-style resources; analysis handles submission, token/status, result retrieval, imports, downloads, and PDFs. This separation reflects materially different control flows: mostly synchronous content requests versus analysis jobs that may require token/status polling and artifact retrieval.
• R/reactome_content.R
• R/reactome_analysis.R
UniProt Domain Adapters
UniProt is decomposed by resource domain rather than held in one endpoint module. The package supports protein, proteome, taxonomy, UniParc, coordinate, and proteomics-oriented calls, each translating service-specific requests into R results through the common infrastructure.
• R/uniprot_proteins.R
• R/uniprot_taxonomy.R
• R/uniprot_proteomes.R
• R/uniprot_uniparc.R
• R/uniprot_coordinates.R
• R/uniprot_proteomics.R
Data, Pagination, and Provenance Flow
Typical flow is: caller supplies validated arguments and optional call-scoped options → service adapter builds and executes HTTP request(s) → shared parsers convert responses to lists/data frames → result may retain raw-response files and request metadata. Metadata includes calls, HTTP responses, timestamps, and parsers when enabled.
For paginated endpoints, rba_pages() evaluates a quoted resource call repeatedly with requested page values and returns a page-keyed collection; individual page results retain their own metadata. Multi-request operations likewise aggregate request provenance on the returned result.
Distribution and Documentation Boundary
This is a CRAN-oriented R package, not a hosted application. User documentation is generated from the README/vignettes and installed Rd manuals; service-specific vignettes describe intended workflows.
• README.Rmd
• vignettes/rbioapi.Rmd
• vignettes/rbioapi_reactome.Rmd
• vignettes/rbioapi_uniprot.Rmd
CI is GitHub Actions-based R CMD checking, with package documentation site generation configured separately.
• .github/workflows/R-CMD-check.yaml
• .github/workflows/pkgdown.yaml
Main entry points: internal_functions.R HTTP request layer · helper_functions.R Options and validation · reactome_analysis.R Reactome analysis · uniprot_proteins.R UniProt domain adapters
Components 22
Package surface
- Package metadata
DESCRIPTION - Exports and namespace
NAMESPACE - Package startup
R/zzz.R - rba_* public API · Resource-oriented calls are organized by remote service.
Shared request layer
- Options and validation · Applies call-scoped timeout, retry, diagnostics, and error behavior.
R/helper_functions.R - HTTP request layer · Executes requests and normalizes errors and responses.
R/internal_functions.R - Parsed R results · Can retain raw files and request provenance.
- Pagination and metadata · Repeats quoted resource calls and aggregates page-level provenance.
R/internal_functions.R
Service adapters
- Enrichr adapter
R/enrichr.R - JASPAR adapter
R/jaspar.R - miEAA and PANTHER
R/mieaa.R - STRING adapter
R/stringdb.R - Reactome content · Synchronous pathway, entity, search, and export resources.
R/reactome_content.R - Reactome analysis · Submits analysis jobs, polls status, and retrieves artifacts.
R/reactome_analysis.R - UniProt domain adapters · Protein, taxonomy, proteome, UniParc, coordinate, and proteomics resources.
R/uniprot_proteins.R
Distribution
- README and user guides · Introduces package and service workflows.
README.Rmd - Reactome vignette
vignettes/rbioapi_reactome.Rmd - UniProt vignette
vignettes/rbioapi_uniprot.Rmd - R CMD check CI
.github/workflows/R-CMD-check.yaml - Documentation site CI
.github/workflows/pkgdown.yaml
Other components
- Biological web services · Enrichr, JASPAR, miEAA, PANTHER, STRING, Reactome, and UniProt.
- Ensembl · Used by package connection checking.
Connections 28
- Package metadata → Exports and namespace: defines package
- Exports and namespace → rba_* public API: exports
- Package startup → Options and validation: initializes
- rba_* public API → Options and validation: validates options
- Options and validation → HTTP request layer: configures requests
- rba_* public API → Enrichr adapter: routes calls
- rba_* public API → JASPAR adapter: routes calls
- rba_* public API → miEAA and PANTHER: routes calls
- rba_* public API → STRING adapter: routes calls
- rba_* public API → Reactome content: routes calls
- rba_* public API → Reactome analysis: routes calls
- rba_* public API → UniProt domain adapters: routes calls
- Pagination and metadata → rba_* public API: re-evaluates resource calls
- HTTP request layer → Parsed R results: parses and records metadata
- Enrichr adapter → HTTP request layer: builds requests
- JASPAR adapter → HTTP request layer: builds requests
- miEAA and PANTHER → HTTP request layer: builds requests
- STRING adapter → HTTP request layer: builds requests
- Reactome content → HTTP request layer: content requests
- Reactome analysis → HTTP request layer: jobs and polling
- UniProt domain adapters → HTTP request layer: builds requests
- HTTP request layer → Biological web services: HTTP
- HTTP request layer → Ensembl: connection check
- README and user guides → rba_* public API: documents
- Reactome vignette → Reactome analysis: documents workflow
- UniProt vignette → UniProt domain adapters: documents workflow
- R CMD check CI → Package metadata: checks package
- Documentation site CI → README and user guides: publishes docs