Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

BOLDconnectR: An R package for streamlined retrieval, transformation, and analysis of DNA barcode data on BOLD

  • Sameer M. Padhye ,

    Contributed equally to this work with: Sameer M. Padhye, Liliana Ballesteros-Mejia, Sujeevan Ratnasingham

    Roles Conceptualization, Formal analysis, Investigation, Methodology, Validation, Writing – original draft, Writing – review & editing

    spadhye@uoguelph.ca

    Affiliation Centre for Biodiversity Genomics, University of Guelph, Guelph, Ontario, Canada

  • Liliana Ballesteros-Mejia ,

    Contributed equally to this work with: Sameer M. Padhye, Liliana Ballesteros-Mejia, Sujeevan Ratnasingham

    Roles Formal analysis, Investigation, Software, Validation, Writing – original draft, Writing – review & editing

    Current address: Direction de l’Expertise – DGD-REVE, Muséum national d’Histoire naturelle, Paris, France

    Affiliation Centre for Biodiversity Genomics, University of Guelph, Guelph, Ontario, Canada

  • Josh Agda ,

    Roles Data curation, Methodology, Software, Validation

    ‡ JA, JA and PDNH also contributed equally to this work.

    Affiliation Centre for Biodiversity Genomics, University of Guelph, Guelph, Ontario, Canada

  • Jireh Agda ,

    Roles Data curation, Methodology, Software, Validation

    ‡ JA, JA and PDNH also contributed equally to this work.

    Affiliation Centre for Biodiversity Genomics, University of Guelph, Guelph, Ontario, Canada

  • Paul D. N. Hebert ,

    Roles Funding acquisition, Project administration, Resources, Supervision, Writing – review & editing

    ‡ JA, JA and PDNH also contributed equally to this work.

    Affiliation Centre for Biodiversity Genomics, University of Guelph, Guelph, Ontario, Canada

  • Sujeevan Ratnasingham

    Contributed equally to this work with: Sameer M. Padhye, Liliana Ballesteros-Mejia, Sujeevan Ratnasingham

    Roles Conceptualization, Funding acquisition, Investigation, Project administration, Resources, Software, Supervision, Writing – review & editing

    Affiliation Centre for Biodiversity Genomics, University of Guelph, Guelph, Ontario, Canada

Abstract

DNA barcode data are essential infrastructure for biodiversity science as they enable scalable species identification and integrative analyses that link sequences to specimens, taxonomy, and geography. The Barcode of Life Data System (BOLD) is a centralized bioinformatics workbench that supports the full barcode data lifecycle: including acquisition, storage, validation, analysis, and dataset publication within a secure collaboration model. While BOLD’s web interface is optimized for interactive dataset assembly and publication, many researchers require programmatic access to both public data and permissioned private records to build reproducible pipelines for curation and analysis prior to release. We introduce BOLDconnectR, an R package that provides authenticated access to BOLD, returns records in the Barcode Core Data Model (BCDM), performs automated transformation into commonly used R data structures, and enables customizable analytic workflows that generate publication-ready outputs.

Introduction

Curated biological databases are critical to research because they consolidate observations, provide consistent data structures, and make large bodies of evidence computable [1]. In biodiversity science, the value of such infrastructure is especially clear: DNA barcode records are most informative when sequences are connected to specimen metadata, taxonomic interpretation, and collection context, allowing results to be revisited as names change, reference libraries expand, and sampling gaps are filled. DNA barcoding has accordingly become a practical, scalable method for specimen identification and biodiversity monitoring with applications that now extend across ecological networks, conservation, and broad-scale assessments [2,3].

The Barcode of Life Data Systems (BOLD) was built to support this lifecycle. Beyond being a repository, BOLD functions as a web workbench for assembling, validating, analyzing, and publishing DNA barcode data under controlled access [4]. It enables collaborative data assembly and curation within permissioned projects and includes publication workflows that create the durable datasets associated with citable DOIs. Critically, much of the scientific work occurs before release: records are iteratively cleaned, reconciled, and reviewed while they remain private within a project before being packaged into datasets suitable for publication.

While BOLD provides API access, most existing client tools such as ‘bold’ and ‘BOLDigger’ are designed for accessing and working with public data; they lack built-in support for authenticated access to private, pre-publication data into reproducible analytical workflows [5,6]. This limits a common need in barcode research: the ability to run scripted, scalable, organization-specific pipelines for curation and analysis prior to dataset publication. Such pipelines are increasingly important for teams and research networks that must harmonize metadata across contributors and labs, perform targeted diagnostics, and generate publication-ready summaries/exports that accompany dataset release and aid manuscript preparation [7,8].

Here we present BOLDconnectR, an R package that provides access to public records and authenticated, permission-respecting access to private records. BOLDconnectR retrieves records in a structured format based on BOLD’s core data model (https://github.com/boldsystems-central/BCDM) and performs automated transformation into R objects for sequence, spatial, and biodiversity analyses. By doing so, it extends BOLD’s interactive workbench into the R ecosystem, enabling custom pipelines.

Implementation and overview

BOLDconnectR is implemented in R (≥4.0) and distributed through CRAN and GitHub (https://github.com/boldsystems-central/BOLDconnectR). The package is intentionally compact, focusing on a small number of operations that recur across barcode projects: selecting candidate records, retrieving them, transforming them into analysis-ready objects, and exporting results for reuse. This design reflects the practical lifecycle in BOLD.

Access to authorized private records is enabled through token-based authentication while public records remain accessible without authentication. Tokens are generated by users through their BOLD profile and are designed to rotate periodically. Consequently, scripts should be written with plans to refresh tokens rather than embed long-lived credentials, reducing the risk of inadvertent dissemination through shared code, notebooks, or logs. Users incorporate a current token via bold.apikey(), after which retrieval and search functions operate on both public data and private records within the user’s authorization scope.

Retrieved records are returned in the Barcode Core Data Model (BCDM), preserving the links between sequences and the specimen metadata, taxonomy, identifiers, and geography. From this representation, BOLDconnectR performs transformation to the input structures required for downstream analyses in R (Fig 1 ‘Auto Conversion’). Importantly, the package provides translations to three widely used analytical ecosystems: ape [9] (sequence handling and phylogenetic workflows), vegan [10] (biodiversity measures and community summaries), and sf [11] (spatial representations and mapping). These packages are among the most broadly adopted tools for analysis of DNA and biodiversity data in R, and BOLDconnectR facilitates their use by converting BOLD records into the specific object classes required by each analysis step based on user-provided parameters.

thumbnail
Fig 1. High-level overview of the functionality of BOLDconnectR.

The package retrieves data in the BCDM format via token-authenticated APIs (https://boldsystems.org/data/api/), automatically formatting it for downstream analysis. Users can also export datasets in different formats to use within custom pipelines or third-party analytical workflows.

https://doi.org/10.1371/journal.pone.0355496.g001

Functions are organized into four groups. Search functions enable the selection of candidate records based on taxonomy, geography, institution, marker, and collection date, returning identifiers for subsequent record retrieval, with bold.public.search (using the portal API) targeting publicly available data and bold.full.search (using the Data API search) extending searches to include both public and authorized private records (Fig 1 ‘Search’). Retrieval functions download complete records based on identifiers, BINs, or dataset/project codes, with optional filters to refine the returned set (using Data API retrieve). The download function makes requests in batches to avoid straining BOLD servers. After downloading, analysis helper functions provide sequence alignment, distance calculations, biodiversity measures, and mapping via calls to ape, vegan, and sf (and associated dependencies) (Fig 1 ‘Phylogenies’, ’Biodiversity Measures’, ‘Mapping’). Export functions write BCDM and derived products to standard formats (CSV/TSV/FASTA), including parameters to customize FASTA headers assembled from selected record fields (Fig 1 ‘Export’).

BOLDconnectR has been evaluated against two public BOLD datasets spanning approximately 103 (n = 847; DS-LONO2 – [12]) – 10⁴ (n = 9087; DS-SPHD2401- [13]) records. The package is under active development, and future work will aim to extend its functionality to support additional workflows as BOLD evolves and as community needs emerge. Planned extensions will emphasize publication oriented pipeline components that support dataset preparation while enabling analyses on private data.

Use cases

BOLDconnectR supports reproducible, scriptable workflows over public and user-authorized private BOLD records during dataset preparation and publication [4].

Use case 1: Permissioned retrieval of pre-publication records.

Private access is enabled with a token generated in the user’s BOLD profile (tokens rotate periodically. bold.apikey() saves the token in the R environment for the length of the R session. Retrieval is performed with bold.fetch(), where the get_by parameter specifies the identifier type and identifiers provide one or more values (e.g., dataset codes, BINs, or process IDs).

bold.apikey(“BOLD_TOKEN”)

bcdm <- bold.fetch(get_by = “dataset_codes”, identifiers = “DS-SPHD2401”)

Optionally, filters can be applied during retrieval to narrow the result set by common facets such as taxonomy or geography which is useful during iterative curation.

bcdm_sub < - bold.fetch(get_by = “dataset_codes”, identifiers = “DS-SPHD2401”, filt_taxonomy = “Megaselia altifrons”, filt_geography = “Lkr. Rems-Murr”)

Use case 2: Search then retrieve a targeted subset.

When defining a study set, a two-step pattern is often preferable: search broadly to obtain identifiers, then retrieve full records only for those identifiers. In bold.full.search(), parameters such as taxonomy and geography can be supplied as lists; the result contains process IDs that can be passed directly to bold.fetch(). The bold.public.search() can also be used instead if dealing with public only records.

bold.apikey(“BOLD_TOKEN”)

hits < - bold.full.search(taxonomy = list(“Panthera leo”), geography = list(“India”))

bcdm <- bold.fetch(get_by = “processid”, identifiers = hits$processid)

Use case 3: Analysis-ready conversion and publication-oriented export.

BOLDconnectR reduces friction for downstream analysis by converting BCDM to formats used by widely adopted R ecosystems (ape for sequence/phylogenetic workflows, vegan for biodiversity summaries, and sf for mapping) followed by the analysis. For example, with biodiversity metric generation, users control analysis intent via parameters such as taxon_rank used (e.g., species, genus), site_type (how samples are grouped), location_type (the geographic resolution), and diversity_profile (e.g., richness). When executed, the function converts the BCDM data into a vegan occurrence matrix, analyses it, returning results.

bold.apikey(“BOLD_TOKEN”)

bcdm <- bold.fetch(get_by = “dataset_codes”, identifiers = “DS-LONO2”)

div < - bold.analyze.diversity(bcdm, taxon_rank = “species”, site_type = “locations”, location_type = “region”, diversity_profile = “richness”)

For publication-oriented outputs and downstream interoperability, bold.export() can write sequence data in FASTA format with customized headers built from selected BCDM fields (cols_for_fas_names), allowing traceable identifiers to aid phylogenetic or curation workflows.

bold.export(bcdm, export_type = “fas”, export = “lono2.fas”, cols_for_fas_names = c(“bin_uri”, “species”, “country.ocean”))

Conclusion

BOLD provides a secure, collaborative workbench for assembling, curating, analyzing, and publishing DNA barcode data within private projects. BOLDconnectR complements this environment by enabling permissioned programmatic access to BOLD records in R while preserving structured links among sequences, specimens, taxonomy, and geography. By automating conversion to formats used by widely adopted analytical tools it reduces data handling overhead. The package bridges an important gap by providing the first programmatic interface to access and analyze both public and permissioned Barcode data on BOLD. The package is under active development, with the aim of expanding support for additional workflows and interoperability as BOLD and community needs evolve.

Acknowledgments

We thank Catherine Wei and Chris Ho for helpful discussions.

References

  1. 1. Baxevanis AD, Bateman A. The importance of biological databases in biological discovery. Curr Protoc Bioinform. 2015;50:1.1.1-1.1.8. pmid:26094768
  2. 2. Hebert PDN, Cywinska A, Ball SL, deWaard JR. Biological identifications through DNA barcodes. Proc Biol Sci. 2003;270(1512):313–21. pmid:12614582
  3. 3. Valentini A, Pompanon F, Taberlet P. DNA barcoding for ecologists. Trends Ecol Evol. 2009;24(2):110–7. pmid:19100655
  4. 4. Ratnasingham S, Wei C, Chan D, Agda J, Agda J, Ballesteros-Mejia L, et al. BOLD v4: a centralized bioinformatics platform for DNA-based biodiversity data. In: DeSalle R, editor. DNA barcoding. New York, NY: Springer US; 2024. p. 403–41. https://doi.org/10.1007/978-1-0716-3581-0_26
  5. 5. Buchner D, Leese F. BOLDigger – a Python package to identify and organise sequences with the Barcode of Life Data systems. MBMG. 2020;4:e53535.
  6. 6. Dubois S, Chamberlain S. bold: Interface to bold systems API. R package version 1.3.0; 2025. Available from: https://docs.ropensci.org/bold/
  7. 7. Maitner BS, Boyle B, Casler N, Condit R, Donoghue J II, Durán SM, et al. The bien r package: a tool to access the Botanical Information and Ecology Network (BIEN) database. Methods Ecol Evol. 2017;9(2):373–9.
  8. 8. Vilela B, Villalobos F. letsR: a new R package for data handling and analysis in macroecology. Methods Ecol Evol. 2015;6(10):1229–34.
  9. 9. Paradis E, Schliep K. ape 5.0: an environment for modern phylogenetics and evolutionary analyses in R. Bioinformatics. 2019;35(3):526–8. pmid:30016406
  10. 10. Oksanen J, Simpson GL, Blanchet FG, Kindt R, Legendre P, Minchin PR, et al. vegan: Community ecology package (R package version 2.8-0); 2026.
  11. 11. Pebesma E. Simple features for R: standardized support for spatial vector data. R J. 2018;10(1):439–46.
  12. 12. González C, Ballesteros-Mejia L, Díaz-Díaz J, Toro-Vargas DM, Amarillo-Suarez AR, Gey D, et al. Deadly and venomous Lonomia caterpillars are more than the two usual suspects. PLoS Negl Trop Dis. 2023;17(2):e0011063. pmid:36821543
  13. 13. Caruso V, Hartop E, Chimeno C, Noori S, Srivathsan A, Haas M, et al. An integrative framework for dark taxa biodiversity assessment at scale: a case study using Megaselia (Diptera, Phoridae). Insect Conserv Divers. 2024;17(6):968–87.