Skip to main content

BAGS: an automated barcode, audit & grade system for DNA barcode reference libraries

Cite this dataset

Fontes, João Tadeu et al. (2020). BAGS: an automated barcode, audit & grade system for DNA barcode reference libraries [Dataset]. Dryad.


Biodiversity studies greatly benefit from molecular tools, such as DNA metabarcoding, which provides an effective identification tool in biomonitoring and conservation programmes. The accuracy of species-level assignment, and consequent taxonomic coverage, relies on comprehensive DNA barcode reference libraries. The role of these libraries is to support species identification, but accidental errors in the generation of the barcodes may compromise their accuracy. Here we present an R-based application, BAGS (Barcode, Audit & Grade System;, that performs automated auditing and annotation of cytochrome c oxidase subunit I (COI) sequences libraries, for a given taxonomic group of animals, available in the Barcode of Life Data System (BOLD). This is followed by implementing a qualitative ranking system that assigns one of five grades (A to E) to each species in the reference library, according to the attributes of the data and congruency of species names with sequences clustered in Barcode Index Numbers (BINs). Our goal is to allow researchers to obtain the most useful and reliable data, highlighting and segregating records according to their congruency. Different tests were performed to perceive its usefulness and limitations. BAGS fulfils a significant gap in the current landscape of DNA barcoding research tools by quickly screening reference libraries to gauge the congruence status of data and facilitate the triage of ambiguous data for posterior review. Thereby, BAGS has the potential to become a valuable addition in forthcoming DNA metabarcoding studies, in the long term contributing to globally improve the quality and reliability of the public reference libraries.


BAGS was totally developed in the R language. Shinnyapps was used to deploy the application in order to be run remotely. 

The R script here presented contains the BAGS version used during the performance assessments. Any development of BAGS and further information can be found at:

To use BAGS remotely, please use:


Usage notes

File list (Files within Appendixes_Fontes_etal_2020.rar)








File descriptions

fontes_et_al_BAGS.R – R script of the BAGS application which can be used to launch BAGS locally within your R environment (e.g. using the R gui or R studio).

fontes_et_al_ambiguous_expressions_appendix1.txt – List of ambiguous expressions removed from the species name in the BAGS pipeline. The records with species names containing these expressions are not filtered out, although the expression is removed from the name. IUPAC nucleotides used to count the number of bases in each sequence are also shown.

fontes_et_al_reference_libraries_palaemonidae_appendix2.xlsx – Reference libraries (all taxa, marine and non-marine) generated with BAGS for the Palaemonidae family in order to test the marine / non-marine filter.

fontes_et_al_reference_libraries_gradeassessment_appendix3.xlsx – Reference libraries generated with BAGS used for the grade assignment performance test.

fontes_et_al_manual_curation_appendix4.xlsx – List of species manually curated for the grading assignment.

fontes_et_al_grade_c_nj_trees_appendix5.rar – Neighbour-joining trees created within the BOLD platform which were used in order to categorize the grade C species into monophyletic and non-monophyletic.



BAGS manuscript:

João T Fontes, Pedro E Vieira, Torbjørn Ekrem, Pedro Soares, Filipe O Costa. BAGS: an automated Barcode, Audit & Grade System for DNA barcode reference libraries. Molecular Ecology Resources. 2020.

A Pre-print version can be found in Authorea:


Comments and requests should be addressed to Filipe Costa ( For specific questions regarding the R script, please contact João Fontes ( or Pedro Vieira (


PORTUGAL 2020 Partnership Agreement, through the European Regional Development Fund (ERDF), Award: NORTE-01-0145-FEDER-000032