knitr::opts_chunk$set( comment = "#>", collapse = TRUE, warning = FALSE, message = FALSE )
bold
accesses BOLD barcode data.
The Barcode of Life Data Systems (BOLD) is designed to support the generation and application of DNA barcode data. The platform consists of four main modules: a data portal, a database of barcode clusters, an educational portal, and a data collection workbench.
This package retrieves data from the BOLD database of barcode clusters, and allows for searching of over 1.7M public records using multiple search criteria including sequence data, specimen data, specimen plus sequence data, as well as trace files.
Documentation for the BOLD API: http://v4.boldsystems.org/index.php/api_home
See also the taxize book for more options for taxonomic workflows with BOLD: https://taxize.dev/
Installation instructions
Stable Version
install.packages("bold")
Development Version
Install sangerseqR
first (used in function bold::bold_trace()
only)
For R < 3.5
source("http://bioconductor.org/biocLite.R") biocLite("sangerseqR")
For R >= 3.5
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("sangerseqR")
Then install bold
remotes::install_github("ropensci/bold")
library("bold")
By default you download fasta
file, which is given back to you as a data.frame
res <- bold_seq(taxon='Coelioxys') head(res)
You can optionally get back the crul
response object
res <- bold_seq(taxon='Coelioxys', response=TRUE) res$response_headers
By default you download tsv
format data, which is given back to you as a data.frame
res <- bold_specimens(taxon='Osmia') head(res[,1:8])
By default you download tsv
format data, which is given back to you as a data.frame
res <- bold_seqspec(taxon='Osmia', sepfasta=TRUE) res$fasta[1:2]
Or you can index to a specific sequence like
res$fasta['GBAH0293-06']
This function downloads files to your machine - it does not load them into your R session - but prints out where the files are for your information.
x <- bold_trace(ids = 'ACRJP618-11', progress = FALSE) read_trace(x$ab1)
Sometimes with bold_seq()
you request a lot of data, which can cause problems due
to BOLD's servers.
An example is the taxonomic name Arthropoda. When you send a request like
bold_seq(taxon = "Arthropoda")
BOLD attempts to give you back sequences
for all records under Arthropoda. This, as you can imagine, is a lot of
sequences.
library("taxize")
Using taxize::downstream
get children of Arthropoda
x <- downstream("Arthropoda", db = "ncbi", downto = "class") nms <- x$Arthropoda$childtaxa_name
Optionally, check that the name exists in BOLD's data. Any that are not in BOLD will give back a row of NAs
checks <- bold_tax_name(nms) # all is good checks[,1:5]
Then pass those names to bold_seq()
. You could pass all names in at once,
but we're trying to avoid the large data request problem here, so run each
one separately with lapply
or a for loop like request.
out <- lapply(nms, bold_seq)
Get citation information for bold
in R by running: citation(package = 'bold')
bold
in R doing citation(package = 'bold')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.