Interface to Bold Systems API

A programmatic interface to the Web Service methods provided by Bold Systems (< http://www.boldsystems.org/>) for genetic 'barcode' data. Functions include methods for searching by sequences by taxonomic names, ids, collectors, and institutions; as well as a function for searching for specimens, and downloading trace files.


bold accesses BOLD barcode data.

Documentation for the BOLD API.

Stable CRAN version

install.packages("bold")

Development version from Github

Install sangerseqR first

source("http://bioconductor.org/biocLite.R")
biocLite("sangerseqR")

Then bold

devtools::install_github("ropensci/bold")
library("bold")

Default is to get a list back

bold_seq(taxon='Coelioxys')[[1]]
#> $id
#> [1] "FBAPB481-09"
#> 
#> $name
#> [1] "Coelioxys afra"
#> 
#> $gene
#> [1] "FBAPB481-09"
#> 
#> $sequence
#> [1] "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TTTCCACGAATAAATAATGTAAGATTTTGACTATTACCTCCCTCAATTTTCTTATTATTATCAAGAACCCTAATTAACCCAAGTGCTGGTACTGGATGAACTGTATATCCTCCTTTATCCTTATATACATTTCATGCCTCACCTTCCGTTGATTTAGCAATTTTTTCACTTCATTTATCAGGAATTTCATCAATTATTGGATCAATAAATTTTATTGTTACAATCTTAATAATAAAAAATTTTTCTTTAAATTATAGACAAATACCATTATTTTCATGATCAGTTTTAATTACTACAATTTTACTTTTATTATCATTACCAATTTTAGCTGGAGCAATTACTATACTCCTATTTGATCGAAATTTAAATACCTCATTCTTTGACCCAATAGGAGGAGGAGATCCAATTTTATATCAACATTTATTT"

You can optionally get back the httr response object

res <- bold_seq(taxon='Coelioxys', response=TRUE)
res$headers
#> $date
#> [1] "Mon, 28 Mar 2016 20:35:02 GMT"
#> 
#> $server
#> [1] "Apache/2.2.15 (Red Hat)"
#> 
#> $`x-powered-by`
#> [1] "PHP/5.3.15"
#> 
#> $`content-disposition`
#> [1] "attachment; filename=fasta.fas"
#> 
#> $connection
#> [1] "close"
#> 
#> $`transfer-encoding`
#> [1] "chunked"
#> 
#> $`content-type`
#> [1] "application/x-download"
#> 
#> attr(,"class")
#> [1] "insensitive" "list"

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])
#>      processid         sampleid recordID       catalognum         fieldnum
#> 1  ASGCB255-13   BIOUG07489-F04  3955532                    BIOUG07489-F04
#> 2 BCHYM1493-13 BC ZSM HYM 19353  4005342 BC ZSM HYM 19353 BC ZSM HYM 19353
#> 3  CHUBE002-06    CHU05-BEE-002   516711    CHU05-BEE-002    CHU05-BEE-002
#> 4  FBAPB679-09 BC ZSM HYM 02154  1289040 BC ZSM HYM 02154 BC ZSM HYM 02154
#> 5  FBAPB730-09 BC ZSM HYM 02205  1289091 BC ZSM HYM 02205 BC ZSM HYM 02205
#> 6  FBAPB743-09 BC ZSM HYM 02218  1289104 BC ZSM HYM 02218 BC ZSM HYM 02218
#>                                            institution_storing
#> 1                            Biodiversity Institute of Ontario
#> 2                    SNSB, Zoologische Staatssammlung Muenchen
#> 3 University of Manitoba, Wallis Roughley Museum of Entomology
#> 4                    SNSB, Zoologische Staatssammlung Muenchen
#> 5                    SNSB, Zoologische Staatssammlung Muenchen
#> 6                    SNSB, Zoologische Staatssammlung Muenchen
#>        bin_uri phylum_taxID
#> 1 BOLD:ABZ2181           20
#> 2 BOLD:AAK6070           20
#> 3 BOLD:AAD4181           20
#> 4 BOLD:AAI1788           20
#> 5 BOLD:AAK5820           20
#> 6                        20

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]
#> $`ASGCB255-13`
#> [1] "-------------------------------GGAATAATTGGTTCTGCTATAAGTATTATTATTCGAATAGAATTAAGAATTCCTGGATCATTCATTTCTAATGATCAAACTTATAATTCTTTAGTAACAGCTCATGCTTTTTTAATAATTTTTTTTCTTGTAATACCATTTTTAATTGGTGGATTTGGAAATTGATTAATTCCATTAATATTAGGAATCCCAGATATAGCATTTCCTCGAATAAATAATATTAGATTTTGACTTTTACCCCCATCCTTAATAATTTTACTTTTAAGAAATTTCTTAAATCCAAGTCCAGGAACAGGTTGAACTGTATATCCCCCCCTTTCTTCTTATTTATTTCATTCTTCCCCTTCTGTTGATTTAGCTATTTTTTCTCTTCATATTTCTGGTTTATCTTCCATCATAGGTTCTTTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCATTAAAACATATTCAATTACCTTTATTTCCTTGATCCGTTTTTATTACAACTATTTTACTATTATTTTCTTTACCTGTTCTAGCAGGAGCTATTACTATATTATTATTTGATCGAAACTTTAATACTTCATTTTTTGATCCAACTGGAGGAGGAGATCCAATTTTATATCAACATTTATTC"
#> 
#> $`BCHYM1493-13`
#> [1] "AATTTTATATATAATTTTTGCTTTATGATCTGGAATAATTGGTTCATCAATAAGAATTTTAATTCGAATAGAATTAAGAATTCCTGGATCATGAATTTCTAATGATCAAGTTTATAATTCTTTAGTAACTGCTCATGCTTTTTTAATAATTTTTTTTCTTGTAATACCATTTTTAATTGGGGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCTGATATAGCTTTTCCTCGAATAAATAATATTAGATTTTGACTTTTACCTCCATCTTTAATATTATTATTGTTAAGAAATTTTTTAAATCCAAGTCCAGGAACAGGATGAACTGTTTATCCTCCTCTTTCTTCAAATTTATTTCACTCTTCTCCTTCAGTAGATTTAGCAATTTTTTCATTACATATTTCAGGATTATCATCTATTATAGGATCATTAAATTTTATTGTTACAATTATTTTAATAAAAAATATTTCTTTAAAACATATTCAATTACCTTTATTTCCATGATCTGTTTTTATTACTACAATTCTTTTATTATTATCATTACCAGTTTTAGCAGGAGCTATTACTATACTTTTATTTGATCGAAATTTTAATACTTCTTTTTTTGACCCTATAGGAGGAGGAGATCCAATTCTTTATCAACATTTATTT"

Or you can index to a specific sequence like

res$fasta['GBAH0293-06']
#> $`GBAH0293-06`
#> [1] "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TTAATGTTAGGGATTCCAGATATAGCTTTTCCACGAATAAATAATATTAGATTTTGACTGTTACCTCCATCTTTAATATTATTACTTTTAAGAAATTTTTTAAATCCAAGTCCTGGAACAGGATGAACAGTTTATCCTCCTTTATCATCAAATTTATTTCATTCTTCTCCTTCAGTTGATTTAGCAATTTTTTCTTTACATATTTCAGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCTTTAAAATATATTCAATTACCTTTATTTTCTTGATCTGTATTTATTACTACTATTCTTTTATTATTTTCTTTACCTGTATTAGCTGGAGCTATTACTATATTATTATTTGATCGAAATTTTAATACATCTTTTTTTGATCCAACAGGAGGGGGAGATCCAATTCTTTATCAACATTTATTTTGATTTTTTGGTCATCCTGAAGTTTATATTTTAATTTTACCTGGATTTGGATTAATTTCTCAAATTATTTCTAATGAAAGAGGAAAAAAAGAAACTTTTGGAAATATTGGTATAATTTATGCTATATTAAGAATTGGACTTTTAGGTTTTATTGTT---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"

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)
#> Number of datapoints: 8877
#> Number of basecalls: 685
#> 
#> Primary Basecalls: NNNNNNNNNNNNNNNNNNGNNNTTGAGCAGGNATAGTAGGANCTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACAGTATAAATTATGATCAAATACCACTATTTGTGTGATCAGTAGGAATTACTGCTTTACTCTTATTACTTTCTCTTCCAGTATTAGCAGGTGCTATCACTATATTATTAACGGATCGAAATTTAAATACATCATTTTTTGATCCTGCAGGAGGAGGAGATCCAATTTTATATCAACATTTATTTTGATTTTTTGGACNTCNNNNAAGTTTAAN
#> 
#> Secondary Basecalls:
  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for bold in R doing citation(package = 'bold')
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

News

bold 0.3.5

  • Added more tests to the test suite (#28)
  • Fixed a bug in an internal data parser (#27)

bold 0.3.4

  • Added a code of conduct
  • Switched to xml2 from XML as the XML parser for this package (#26)
  • Fixes to bold_trace() to create dir and tar file when it doesn't already exist
  • Fixed odd problem where sometimes resulting data from HTTP request was garbled on content(x, "text"), so now using rawToChar(content(x)), which works (#24)

bold 0.3.0

  • Explicitly import non-base R functions (#22)
  • Better package level manual file

bold 0.2.6

  • sangerseqR package now in Suggests for reading trace files, and is only used in bold_trace() function.
  • General code tidying, reduction of code duplication.
  • bold_trace() gains two new parameters: overwrite to choose whether to overwrite an existing file of the same name or not, progress to show a progress bar for downloading or not.
  • bold_trace() gains a print method to show a tidy summary of the trace file downloaded.
  • Fixed similar bugs in bold_tax_name() (#17) and bold_tax_id() (#18) in which species that were missing from the BOLD database returned empty arrays but 200 status codes. Parsing those as failed attempts now. Also fixes problem in taxize in bold_search() that use these two functions.

bold 0.2.0

  • Package gains two new functions for working with the BOLD taxonomy APIs: bold_tax_name() and bold_tax_id(), which search for taxonomic data from BOLD using either names or BOLD identifiers, respectively. (#11)
  • Two new packages in Imports: jsonlite and reshape.
  • Added new taxonomy API functions to the vignette (#14)
  • Added reference URLS to all function doc files to allow easy reference for the appropriate API docs.
  • callopts parameter changed to ... throughout the package, so that passing on options to httr::GET is done via named parameters, e.g., config=verbose(). (#13)
  • Added examples of doing curl debugging throughout man pages.

bold 0.1.2

  • Improved the vignette (#8)
  • Added small function to print helpful message when user inputs no parameters or zero length parameter values.
  • Fixed some broken tests with the new httr (v0.4) (#9), and added a few more tests (#7)

bold 0.1.0

  • released to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("bold")

0.5.0 by Scott Chamberlain, 3 months ago


https://github.com/ropensci/bold


Report a bug at https://github.com/ropensci/bold/issues


Browse source code at https://github.com/cran/bold


Authors: Scott Chamberlain [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports xml2, crul, stringr, jsonlite, reshape, plyr, data.table, tibble

Suggests roxygen2, sangerseqR, knitr, testthat


Imported by taxize.


See at CRAN