Learn R Programming

dbparser

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

ParserSourceReadsTables returnedLicence of the source dataSince
parseDrugBank()DrugBankThe full database XML, or the zip it comes indrugs; with options also salts, products, references, cettnot stated2.0.0
parseOnSIDES()OnSIDESA 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.csvOne 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_confidenceCC-BY-4.02.2.1
parseTWOSIDES()TWOSIDESTWOSIDES.csv.gzdrug_drug_interactionsnot stated2.2.1
parseHPO()Human Phenotype Ontology, as distributed by Harmonizomegene_attribute_edges.txt, plain or gzip-compressedassociations, genes, phenotypesCC-BY-NC-SA-4.02.3.0
parseHGNC()HGNChgnc_complete_set.txt, optionally withdrawn.txtgene, gene_name, withdrawnCC0-1.02.3.0
parseHealthCanadaDPD()Health Canada Drug Product Databaseallfiles.zip, allfiles_ap.zip, allfiles_ia.zip, allfiles_dr.zip (or their unzipped folders) and inactive.zipdrug_product, active_ingredients, companies, form, packaging, pharmaceutical_std, route, schedule, status, therapeutic_class, veterinary_species, biosimilars, inactive_productsOGL-Canada-2.02.3.0
parseOpenFDA()openFDAdrug-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_openfdaCC0-1.02.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:

  • dbparser Pro: loads licensed sources (for example DrugBank, under your own licence) and your private data into PostgreSQL, matches products and ingredients across sources, with scheduled refresh, release-to-release comparison and validation reports.
  • Services: data integration, custom sources, analysis apps and training for life-science teams.
  • DrugVerse Scope: one sourced evidence page for any drug or target, built on dbparser.

Questions or early access: [email protected]

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

  • Hammoud Z, et al. (2025). Multipath2.0: extending multilayer reproducible pathway models with omics data. Computer Methods and Programs in Biomedicine Update. doi:10.1016/j.cmpbup.2025.100189
  • Su Y, et al. (2024). Multi-ancestry proteome-phenome-wide Mendelian randomization offers a comprehensive protein-disease atlas. medRxiv (preprint). doi:10.1101/2024.10.17.24315553
  • Rischke S, et al. (2023). Machine learning identifies right index finger tenderness as key signal of DAS28-CRP based psoriatic arthritis activity. Scientific Reports. doi:10.1038/s41598-023-49574-4
  • Namiot ED, et al. (2023). The international clinical trials registry platform (ICTRP): data integrity and the trends in clinical trials, diseases, and drugs. Frontiers in Pharmacology. doi:10.3389/fphar.2023.1228148
  • Parolo S, et al. (2023). Single-cell-led drug repurposing for Alzheimer’s disease. Scientific Reports. doi:10.1038/s41598-023-27420-x
  • Schubert NMA, et al. (2022). Transcriptome-guided identification of drugs for repurposing to treat age-related hearing loss. Biomolecules. doi:10.3390/biom12040498
  • Mercatelli D, et al. (2022). Detection of pan-cancer surface protein biomarkers via a network-based approach on transcriptomics data. Briefings in Bioinformatics. doi:10.1093/bib/bbac400
  • Yang C, et al. (2021). Mapping the landscape of synthetic lethal interactions in liver cancer. Theranostics. doi:10.7150/thno.63416
  • Pérez-Moraga R, et al. (2021). A COVID-19 drug repurposing strategy through quantitative homological similarities using a topological data analysis-based framework. Pharmaceutics. doi:10.3390/pharmaceutics13040488
  • Hammoud Z, Kramer F (2020). Mulath: an R package to generate integrated reproducible pathway models. Biology. doi:10.3390/biology9120483

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

Ecosystem

PackageDescriptionLinks
dbdatasetPre-parsed DrugBank datasets ready for analysisGitHub
covid19dbcandCOVID-19 drug candidate datasetsGitHub
periscope2Shiny framework for interactive dashboardsCRAN

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.

Copy Link

Version

Install

install.packages('dbparser')

Monthly Downloads

667

Version

2.3.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mohammed Ali

Last Published

November 8th, 2026

Functions in dbparser (2.3.0)

dpd_extract_folders

DPD product sets: folder (and zip) name and file-name suffix
build_metadata

Build Metadata Data Frame
.resolve_targets_gi

Resolve targets general_information table
cett_poly_pfms_doc

Carriers/ Enzymes/ Targets/ Transporters Polypeptide PFAMS parsers
cett_poly_syn_doc

Carriers/ Enzymes/ Targets/ Transporters Polypeptide Synonyms parsers
cett_actions_doc

Carriers/ Enzymes/ Targets/ Transporters Actions parsers
drug_general_information

Drugs General Information parser
drug_exp_prop

Drug Experimental Properties parser
drug_ex_identity

Drug External Identifiers parser
drug_classification

Drug Classification parser
dpd_table_specs

DPD tables as in Health Canada's read-me
drug_affected_organisms

Drug Affected Organism parser
drug_external_links

Drug External Links parser
drug_dosages

Drug Dosages parser
drug_food_interactions

Drug Groups parser
.resolve_polypeptides_gi

Resolve polypeptides general_information table
.resolve_drug_names

Resolve drug name lookup from a DrugBank dvobject
drug_node_options

returns drug node valid options.
cett_doc

Carriers/ Enzymes/ Targets/ Transporters parsers
check_openfda_tables

Check openFDA keys and references
drug_manufacturers

Drug Manufacturers parser
drug_mixtures

Drug Mixtures parser
drug_pdb_entries

Drug pdb-entries parser
drug_packagers

Drug Packagers parser
drug_sequences

Drug Sequences parser
drug_salts

Drug Salts parser
drug_pharmacology

Drug Pharmacology parser
cett_nodes_options

returns carriers, enzymes,targets and transporters node valid options.
cett_poly_doc

Carriers/ Enzymes/ Targets/ Transporters Polypeptide parsers
drug_pathway_drugs

Drug Pathway Drugs parser
drug_groups

Drug Groups parser
drug_snp_adverse_reactions

Drug SNP Adverse Drug Reactions parser
flatten_ndc

NDC directory records into their tables
count_top_level_lists

Count Top Level Lists
drug_reactions

Drug Reactions Parsers
drug_snp_effects

Drug SNP Effects parser
drug_pathway_enzyme

Drug Pathway Enzymes parser
drug_reactions_enzymes

Drug Reactions Enzymes Parsers
get_source_metadata

Get the source metadata of a dvobject
find_second_database

Find Second Database in Attributes
flatten_drugsfda

Drugs@FDA records into their tables
init_dvobject

init_dvobject initialize dvobject
openfda_field

A field's value as text, NA when absent or null
openfda_table_specs

openFDA tables: columns in order, date, logical and key columns
drug_prices

Drug Prices Parsers
parseHPO

Parse HPO Gene-Phenotype Associations
parseHGNC

Parse the HGNC Gene Nomenclature Files
drug_calc_prop

Drug Calculated Properties parser
drug_products

Drug Products parser
merge_drugbank_hpo

Merge DrugBank and HPO Gene-Phenotype Database Objects
openfda_list_rows

One row per element of each record's list field
links

Drugs/ Carriers/ Enzymes/ Targets/ Transporters links element parser
drug_interactions

Drug Interactions parser
drug_intern_brand

Drug International Brands parser
drug_categories

Drug Categories parser
parseHealthCanadaDPD

Parse the Health Canada Drug Product Database (DPD) Data Extract
get_genes_for_phenotype

Get Genes Associated with a Phenotype
parseOnSIDES

Parse the OnSIDES Core Relational Database
parse_references_node

Drugs/ Carriers/ Enzymes/ Targets/ Transporters references element parser
parseDrugBank

parseDrugBank
parseTWOSIDES

Parse the TWOSIDES Drug-Drug Interaction Database
parseOpenFDA

Parse the openFDA Drugs@FDA and NDC Directory Downloads
set_source_metadata

set_source_metadata Attach a metadata block to a dvobject
parse_cett_node

Run all CETT related parsers
shape_openfda_table

Shape an openFDA table: its columns in order, dates and logicals typed
parse_dpd_date

Parse DPD dates ("22-MAR-2025")
read_dpd_file

Read one DPD file
openfda_annotation_rows

Each record's openfda block as (key, field, value) rows
metadata_text

metadata_text Single string or NA
show_dvobject_metadata

Display dvobject Metadata
parse_openfda_date

Parse openFDA dates (YYYYMMDD)
source_metadata

source_metadata Build the source metadata block that every parser attaches to its dvobject.
read_hgnc_complete_set

Read hgnc_complete_set.txt
parse_drug_nodes

Run all drug related parsers
read_drugbank_xml_db

Reads DrugBank xml database and load it into memory.
search_phenotypes

Search HPO Phenotypes by Keyword
subset_onsides_dvobject

Subset an OnSIDES dvobject by a vector of RxNorm Ingredient IDs (Schema-Aware)
subset_drugbank_dvobject

Subset a DrugBank dvobject by a vector of DrugBank IDs
references_node_options

returns references node valid options.
metadata_date

metadata_date Date from a Date or a "YYYY-MM-DD" string, else NA with a message
drug_patents

Drug Patents parser A property right issued by the United States Patent and Trademark Office (USPTO) to an inventor for a limited time, in exchange for public disclosure of the invention when the patent is granted. Drugs may be issued multiple patents.
drug_pathway

Drug Pathway parser
drug_syn

Drug Synonyms parser
read_openfda_json

Read an openFDA download (zip or JSON)
merge_drugbank_onsides

Merge DrugBank and OnSIDES Database Objects
merge_drugbank_twosides

Merge a DrugBank dvobject with a TWOSIDES dvobject
metadata_files

metadata_files File names and SHA-256 hashes
read_hgnc_withdrawn

Read withdrawn.txt
find_dataframes_recursive

Find All Data Frames Recursively
books

Drugs/ Carriers/ Enzymes/ Targets/ Transporters books element parser
add_database_info

add_database_info Assign passed databases db metadata to passed dvobject
cett_go_doc

Carriers/ Enzymes/ Targets/ Transporters Polypeptide GO Classifier parsers
drug_ahfs_codes

Drug ahfs-codes parser
attachments

Drugs/ Carriers/ Enzymes/ Targets/ Transporters attachments element parser
.find_table_with_columns

Generic fallback: search an object tree for a data frame with required columns
dbparser

dbparser: A package for reading and parsing DrugBank xml database.
check_dpd_tables

Check DPD keys
articles

Drugs/ Carriers/ Enzymes/ Targets/ Transporters articles element parser
cett_ex_identity_doc

Carriers/ Enzymes/ Targets/ Transporters Polypeptide External Identifiers parsers
check_hgnc_path

Check an HGNC input path
drug_atc_codes

Drug ATC Codes element parser
build_hgnc_gene_names

Build the HGNC gene_name table