dbparser

CRAN_Status_Badge JOSS Paper rOpenSci Peer-Reviewed DOI codecov metacran downloads CII Best Practices Lifecycle: stable

Overview

dbparser is an rOpenSci peer-reviewed R package that parses and integrates major pharmacological databases into standardized, analysis-ready R objects called dvobjects (drugverse objects).

Pharmacological databases use incompatible formats and structures, forcing researchers to write custom parsing scripts — a process that consumes 60–80% of analysis time. dbparser eliminates this bottleneck with unified parsing functions, chainable merge operations, and a consistent output structure that enables reproducible, cross-database analyses.

With recent updates, dbparser has evolved into an integration engine, allowing you to merge mechanistic data (DrugBank) with real-world phenotypic data (OnSIDES) and drug-drug interaction risks (TWOSIDES).

Installation

# From CRAN (stable)
install.packages("dbparser")

# From GitHub (development)
# install.packages("pak")
pak::pak("ropensci/dbparser")

Supported Databases

Parser Source Reads Tables returned Licence of the source data Since
parseDrugBank() DrugBank The full database XML, or the zip it comes in drugs; with options also salts, products, references, cett not stated 2.0.0
parseOnSIDES() OnSIDES A folder with product_label.csv, product_adverse_effect.csv, product_to_rxnorm.csv, vocab_meddra_adverse_effect.csv, vocab_rxnorm_ingredient.csv, vocab_rxnorm_product.csv, vocab_rxnorm_ingredient_to_product.csv, optionally high_confidence.csv One table per file: product_label, product_adverse_effect, product_to_rxnorm, vocab_meddra_adverse_effect, vocab_rxnorm_ingredient, vocab_rxnorm_product, vocab_rxnorm_ingredient_to_product, optionally high_confidence CC-BY-4.0 2.2.1
parseTWOSIDES() TWOSIDES TWOSIDES.csv.gz drug_drug_interactions not stated 2.2.1
parseHPO() Human Phenotype Ontology, as distributed by Harmonizome gene_attribute_edges.txt, plain or gzip-compressed associations, genes, phenotypes CC-BY-NC-SA-4.0 2.3.0
parseHGNC() HGNC hgnc_complete_set.txt, optionally withdrawn.txt gene, gene_name, withdrawn CC0-1.0 2.3.0
parseHealthCanadaDPD() Health Canada Drug Product Database allfiles.zip, allfiles_ap.zip, allfiles_ia.zip, allfiles_dr.zip (or their unzipped folders) and inactive.zip drug_product, active_ingredients, companies, form, packaging, pharmaceutical_std, route, schedule, status, therapeutic_class, veterinary_species, biosimilars, inactive_products OGL-Canada-2.0 2.3.0
parseOpenFDA() openFDA drug-drugsfda-0001-of-0001.json.zip, drug-ndc-0001-of-0001.json.zip (or the unzipped JSON) drugsfda_application, drugsfda_product, drugsfda_active_ingredient, drugsfda_submission, drugsfda_submission_property_type, drugsfda_application_doc, drugsfda_openfda, ndc_product, ndc_active_ingredient, ndc_route, ndc_pharm_class, ndc_packaging, ndc_openfda CC0-1.0 2.3.0

Each source keeps its own licence; check its terms before use. “Not stated” means the source’s own pages give no licence for the data; every parsed object records the source’s licence, terms page and requested citation (see get_source_metadata()).

The DrugBank XML is downloaded from DrugBank with a free account; versions 5.1.0 through 5.1.12 have been tested. If you find errors with any DrugBank version, please submit an issue.

Tutorials: Getting started, and the worked examples on DrugBank, integrated pharmacovigilance and HPO target phenotypes.

Quick Start

Parse a Single Database

library(dbparser)

# Parse DrugBank
drugbank_db <- parseDrugBank("data/drugbank.xml")

# Parse OnSIDES
onsides_db <- parseOnSIDES("data/onsides/")

# Parse TWOSIDES
twosides_db <- parseTWOSIDES("data/TWOSIDES.csv.gz")

Integration Pipeline

The power of dbparser lies in its ability to chain parsers and mergers together. Here is how you can build a complete pharmacovigilance dataset:

library(dbparser)
library(dplyr)

# 1. Parse the raw databases
drugbank_db <- parseDrugBank("data/drugbank.xml")
onsides_db  <- parseOnSIDES("data/onsides/")
twosides_db <- parseTWOSIDES("data/TWOSIDES.csv.gz")

# 2. Build the Integrated Knowledge Graph
#    DrugBank serves as the hub. Chain the merges.
final_db <- drugbank_db %>%
  merge_drugbank_onsides(onsides_db) %>%
  merge_drugbank_twosides(twosides_db)

# 3. Analyze Results
head(final_db$integrated_data$drug_drug_interactions)

For a detailed case study, see the Integrated Pharmacovigilance Vignette.

The dvobject Structure

Every parser returns a dvobject: a named list of tibbles (DrugBank’s are nested in lists by section), with a source_metadata record of the source’s release, licence and file hashes. The tables and columns each parser returns are listed in dvobject structures by parser.

Commercial support and extensions

dbparser is free and open source, and it stays that way: every parser for an open database is part of this package.

It is maintained by Interstellar, which also offers:

Questions or early access: info@interstellar-egypt.com

dbparser (free, open source) dbparser Pro
Parsers: DrugBank XML (from your own download), OnSIDES, TWOSIDES, HPO, HGNC, Health Canada DPD, openFDA (Drugs@FDA, NDC) (more coming). Each source keeps its own licence. ✓ ✓
dvobject format with source, release, licence and checksum metadata ✓ ✓
Merge DrugBank with OnSIDES, TWOSIDES and HPO, and subset parsed DrugBank and OnSIDES datasets ✓ ✓
Documentation, vignettes and examples ✓ ✓
Community help on GitHub Discussions ✓ ✓
Cross-source matching: products, ingredients and salt forms joined across DrugBank, Health Canada, FDA and other registers ✓
Licensed sources (for example DrugBank, under your own licence) and your private data loaded into PostgreSQL, with a licence gate per deployment ✓
Your private data joined to public sources ✓
Scheduled refresh when a source releases ✓
Release-to-release comparison ✓
Validation reports ✓
DrugVerse Scope integration ✓
Setup help and priority support ✓

Used in published research

dbparser is listed in the CRAN Epidemiology Task View and described in our JOSS paper.

Ecosystem

Package Description Links
dbdataset Pre-parsed DrugBank datasets ready for analysis GitHub
covid19dbcand COVID-19 drug candidate datasets GitHub
periscope2 Shiny framework for interactive dashboards CRAN

Citation

If you use dbparser in published research, please cite our JOSS paper:

Ali et al., (2026). dbparser: An R Package for Parsing and Integrating
Pharmacological Databases. Journal of Open Source Software, 11(118),
9950, https://doi.org/10.21105/joss.09950
citation("dbparser")

If you find dbparser useful, consider ⭐ starring the GitHub repository and sharing it with colleagues.

Contributing

We welcome contributions! Please review our Contributing Guide.

Please note that the dbparser project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

ropensci_footer