Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ codemeta.json
revdep/
vignettes/
LICENSE.md
data-raw/
/R/new_feature/
^.*\.Rproj$
^\.Rproj\.user$
^tests/fixtures
^tests/bold_trace_files
14 changes: 9 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
Package: bold
Version: 1.3.0
Version: 1.4.1
Title: Interface to Bold Systems API
Authors@R: c(person("Salix", "Dubois", role = c("aut", "cre"),
email = "[email protected]"),
email = "[email protected]",
comment = c(ORCID="0009-0003-0183-8825")),
person("Scott", "Chamberlain", role = c("aut"),
email = "[email protected]",
comment = c(ORCID="0000-0003-1444-9135")))
Author: Salix Dubois [aut, cre],
Scott Chamberlain [aut]
Maintainer: Salix Dubois <[email protected]>
Depends:
R (>= 2.10)
Suggests:
Expand All @@ -21,17 +25,17 @@ Imports:
data.table,
methods
Description: A programmatic interface to the Web Service methods provided by
Bold Systems (<http://www.boldsystems.org/>) for genetic 'barcode' data.
Bold Systems (<https://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.
License: MIT + file LICENSE
URL: https://docs.ropensci.org/bold/ (documentation), https://github.com/ropensci/bold (source)
URL: https://docs.ropensci.org/bold/, https://github.com/ropensci/bold
BugReports: https://github.com/ropensci/bold/issues
LazyData: yes
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
X-schema.org-applicationCategory: Data Access
X-schema.org-keywords: biodiversity, barcode, DNA, sequences, fasta
X-schema.org-isPartOf: https://ropensci.org
394 changes: 242 additions & 152 deletions NEWS.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions R/bold-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#' @section About:
#'
#' This package gives you access to data from BOLD System
#' http://www.boldsystems.org/ via their API
#' (http://v4.boldsystems.org/index.php/api_home)
#' https://www.boldsystems.org/ via their API
#' (https://v4.boldsystems.org/index.php/api_home)
#'
#' @section Functions:
#'
Expand Down Expand Up @@ -32,10 +32,9 @@
#' @importFrom methods setGeneric setMethod
#' @import data.table
#' @import stringi
#' @docType package
#' @name bold-package
#' @aliases bold
NULL
"_PACKAGE"

#' List of 3 nucleotide sequences to use in examples for the
#' \code{\link{bold_identify}} function
Expand Down
22 changes: 20 additions & 2 deletions man/bold-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added tests/bold_trace_files/bold_trace_files.tar
Binary file not shown.
6 changes: 3 additions & 3 deletions tests/bold_trace_files/ids/TRACE_FILE_INFO.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROCESSID TAXON MARKER GENBANK_ACCESSION TRACEFILE
ACRJP618-11 Lepidoptera COI-5P ACRJP/ACRJP618-11[LepF1,LepR1]_F+1329172726.ab1
ACRJP619-11 Lepidoptera COI-5P ACRJP/ACRJP619-11[LepF1,LepR1]_R+1329177943.ab1
ACRJP619-11 Lepidoptera COI-5P ACRJP/ACRJP619-11[LepF1,LepR1]_F+1329172726.ab1
ACRJP618-11 Prepona amydon zenodorus COI-5P ACRJP/ACRJP618-11[LepF1,LepR1]_F+1329172726.ab1
ACRJP619-11 Prepona amydon amydonius COI-5P ACRJP/ACRJP619-11[LepF1,LepR1]_R+1329177943.ab1
ACRJP619-11 Prepona amydon amydonius COI-5P ACRJP/ACRJP619-11[LepF1,LepR1]_F+1329172726.ab1

Binary file modified tests/bold_trace_files/ids/bold_trace_files.tar
Binary file not shown.
Binary file added tests/bold_trace_files/taxon/BOFTH106-08_F.ab1
Binary file not shown.
Binary file added tests/bold_trace_files/taxon/BOFTH106-08_R.ab1
Binary file not shown.
4 changes: 3 additions & 1 deletion tests/bold_trace_files/taxon/TRACE_FILE_INFO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ BBBO256-10 Bombus ignitus COI-5P BBBO/BBBO256-10[LepF1,LepR1]_R+1288149881.ab1
BBBO256-10 Bombus ignitus COI-5P BBBO/BBBO256-10[LepF1,LepR1]_F+1288144746.ab1
BBBO257-10 Bombus ignitus COI-5P BBBO/BBBO257-10[LepF1,LepR1]_R+1288149881.ab1
BBBO257-10 Bombus ignitus COI-5P BBBO/BBBO257-10[LepF1,LepR1]_F+1288144746.ab1
BBBO400-11 Bombus ignitus COI-5P BBBO/BBBO400-11[RonMWASPdeg_t1,LepR1]_R+1313556977.ab1
BBBO400-11 Bombus ignitus COI-5P BBBO/BBBO400-11[RonMWASPdeg_t1,LepR1]_F+1313551803.ab1
BBBO400-11 Bombus ignitus COI-5P BBBO/BBBO400-11[RonMWASPdeg_t1,LepR1]_R+1313556977.ab1
BOFTH106-08 Bombus ignitus COI-5P BOFJ/BOFTH106-08_F+1221866614.ab1
BOFTH106-08 Bombus ignitus COI-5P BOFJ/BOFTH106-08_R+1221872058.ab1

Binary file modified tests/bold_trace_files/taxon/bold_trace_files.tar
Binary file not shown.
24 changes: 12 additions & 12 deletions tests/fixtures/bold_trace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ http_interactions:
encoding: ''
string: ''
headers:
User-Agent: libcurl/7.64.1 r-curl/4.3.3 crul/1.3
User-Agent: libcurl/8.3.0 r-curl/5.2.3 crul/1.5.0
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
Expand All @@ -17,27 +17,27 @@ http_interactions:
headers:
status: HTTP/1.1 200 OK
server: nginx
date: Tue, 28 Feb 2023 00:15:06 GMT
date: Fri, 13 Dec 2024 21:46:44 GMT
content-type: application/x-tar
transfer-encoding: chunked
connection: keep-alive
x-powered-by: PHP/5.3.15
content-disposition: attachment; filename="trace_files.tar
set-cookie: https=on;Path=/;Max-Age=3600;httponly;SameSite=Lax
body:
encoding: UTF-8
encoding: ''
file: yes
string: D:\02_rOpenSci\bold\tests\testthat\bold_trace_files/bold_trace_files.tar
recorded_at: 2023-02-28 00:15:09 GMT
recorded_with: vcr/1.0.2, webmockr/0.8.0
string: D:\02_rOpenSci\bold\tests\bold_trace_files/bold_trace_files.tar
recorded_at: 2024-12-13 21:46:47 GMT
recorded_with: vcr/1.6.0, webmockr/1.0.0
- request:
method: get
uri: https://v4.boldsystems.org/index.php/API_Public/trace?ids=ACRJP618-11%7CACRJP619-11
body:
encoding: ''
string: ''
headers:
User-Agent: libcurl/7.64.1 r-curl/4.3.3 crul/1.3
User-Agent: libcurl/8.3.0 r-curl/5.2.3 crul/1.5.0
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
Expand All @@ -48,16 +48,16 @@ http_interactions:
headers:
status: HTTP/1.1 200 OK
server: nginx
date: Tue, 28 Feb 2023 00:15:08 GMT
date: Fri, 13 Dec 2024 21:46:46 GMT
content-type: application/x-tar
transfer-encoding: chunked
connection: keep-alive
x-powered-by: PHP/5.3.15
content-disposition: attachment; filename="trace_files.tar
set-cookie: https=on;Path=/;Max-Age=3600;httponly;SameSite=Lax
body:
encoding: UTF-8
encoding: ''
file: yes
string: D:\02_rOpenSci\bold\tests\testthat\bold_trace_files/bold_trace_files.tar
recorded_at: 2023-02-28 00:15:09 GMT
recorded_with: vcr/1.0.2, webmockr/0.8.0
string: D:\02_rOpenSci\bold\tests\bold_trace_files/bold_trace_files.tar
recorded_at: 2024-12-13 21:46:47 GMT
recorded_with: vcr/1.6.0, webmockr/1.0.0
140 changes: 140 additions & 0 deletions tests/setup_cassettes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
tests_set_cassette_bold_specimens <- function() {
message("Recording the 'bold_specimens' cassette.")
vcr::use_cassette("bold_specimens", {
bold_specimens(taxon = 'Coelioxys')
bold_specimens(taxon = 'Coelioxys', format = 'xml')
})
}
tests_set_cassette_bold_seqspec <- function() {
message("Recording the 'bold_seqspec' cassette.")
vcr::use_cassette("bold_seqspec", {
bold_seqspec(taxon = 'Coelioxys')
})
}
tests_set_cassette_bold_seq <- function() {
message("Recording the 'bold_seq' cassette.")
vcr::use_cassette("bold_seq", {
bold_seq(taxon = 'Coelioxys')
bold_seq(bin = 'BOLD:AAA5125')
})
}
tests_set_cassette_bold_stats <- function() {
message("Recording the 'bold_stats' cassette.")
vcr::use_cassette("bold_stats", {
bold_stats(taxon = "Coelioxys")
bold_stats(taxon = "Coelioxys", simplify = TRUE)
bold_stats(taxon = "Coelioxys",
simplify = TRUE,
dataType = "overview")
bold_stats(taxon = c("Coelioxys", "Osmia"))
})
}
tests_set_cassette_bold_trace <- function() {
message("Recording the 'bold_trace' cassette.")
vcr::use_cassette("bold_trace", {
dest.dir <- vcr::vcr_configuration()$write_disk_path
bold_trace(
taxon = "Bombus ignitus",
geo = "Japan",
dest = file.path(dest.dir, "taxon")
)
bold_trace(
ids = c('ACRJP618-11', 'ACRJP619-11'),
dest = file.path(dest.dir, "ids")
)
})
}
tests_set_cassette_bold_tax_id2 <- function() {
message("Recording the 'bold_tax_id2' cassette.")
vcr::use_cassette("bold_tax_id2", {
bold_tax_id2(id = 88899)
bold_tax_id2(id = c(88899, 125295))
bold_tax_id2(id = 88899, includeTree = TRUE)
bold_tax_id2(id = 88899, dataTypes = "all")
bold_tax_id2(id = 88899, dataTypes = "stats")
bold_tax_id2(id = 88899, dataTypes = "geo")
bold_tax_id2(id = 88899, dataTypes = "sequencinglabs")
bold_tax_id2(
id = 88899,
dataTypes = c("basic", "geo"),
includeTree = TRUE
)
bold_tax_id2(id = 660837, dataTypes = "stats") # no public marker sequences
bold_tax_id2(id = 660837, dataTypes = c("basic", "stats")) # no public marker sequences
})
}
tests_set_cassette_bold_tax_name <- function() {
message("Recording the 'bold_tax_name' cassette.")
vcr::use_cassette("bold_tax_name", {
bold_tax_name(name = "Diplura")
bold_tax_name(name = c("Apis", "Puma concolor", "Pinus concolor"))
bold_tax_name(name = "Diplur", fuzzy = TRUE)
bold_tax_name(name = "Diplur", fuzzy = FALSE)
bold_tax_name(name = c(
"Diplurodes sp.",
"Chlamydomonas sp. 18 (FA)",
"Chlamydomonas sp. 'Chile J'"
))
})
}
tests_set_cassette_bold_identify_parents <- function() {
message("Recording the 'bold_identify_parents' cassette.")
vcr::use_cassette("bold_identify_parents", {
load("tests/testthat/bold_identify_list.rda")
bold_identify_parents(bold_identify_list)
})
}
tests_set_cassette_bold_identify_taxonomy <- function() {
message("Recording the 'bold_identify_taxonomy' cassette.")
vcr::use_cassette("bold_identify_taxonomy", {
load("tests/testthat/bold_identify_list.rda")
bold_identify_taxonomy(x = bold_identify_list)
})
}
tests_set_cassette_bold_identify <- function() {
message("Recording the '", bold_identify, "' cassette.")
vcr::use_cassette("bold_identify", {
bold_identify(sequences$seq1)
bold_identify(sequences$seq1, db = 'COX1_SPECIES')
bold_identify(
"AACCCTATACTTTTTATTTGGAATTTGAGCGGGTATAGTAGGTACTAGCTTAAGTATATTAATTCGTCTAGAGCTAGGACAACCCGGTGTATTTTTAGAAGATGACCAAACCTATAACGTTATTGTAACAGCCCACGCTTTTATTATAATTTTCTTCATAATTATACCAATCATAATTGGA"
)
})
}
tests_setup_cassettes <- function(cassette = "all") {
invisible(vcr::vcr_configure(
dir = normalizePath(file.path(getwd(), "tests/fixtures")),
write_disk_path = normalizePath(file.path(getwd(), "tests/bold_trace_files"))
))
if (length(cassette) == 1 && cassette == "all") {
cassette <- c(
"bold_specimens",
"bold_seqspec",
"bold_seq",
"bold_stats",
"bold_trace",
"bold_tax_id2",
"bold_tax_name",
"bold_identify_parents",
"bold_identify_taxonomy",
"bold_identify"
)
}
for (x in cassette) {
switch (
x,
bold_specimens = tests_set_cassette_bold_specimens(),
bold_seqspec = tests_set_cassette_bold_seqspec(),
bold_seq = tests_set_cassette_bold_seq(),
bold_stats = tests_set_cassette_bold_stats(),
bold_trace = tests_set_cassette_bold_trace(),
bold_tax_id2 = tests_set_cassette_bold_tax_id2(),
bold_tax_name = tests_set_cassette_bold_tax_name(),
bold_identify_parents = tests_set_cassette_bold_identify_parents(),
bold_identify_taxonomy = tests_set_cassette_bold_identify_taxonomy(),
bold_identify = tests_set_cassette_bold_identify(),
stop("No cassette named ", cassette)
)
}
}
# tests_setup_cassettes()
9 changes: 7 additions & 2 deletions tests/testthat/helper-bold.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# set up vcr
library("vcr")
invisible(vcr::vcr_configure(dir = "../fixtures", write_disk_path = "../bold_trace_files"))
library(vcr)
invisible(vcr::vcr_configure(
# dir = normalizePath(file.path(getwd(), "tests/fixtures")),
# write_disk_path = normalizePath(file.path(getwd(), "tests/bold_trace_files"))
dir = normalizePath("../fixtures"),
write_disk_path = normalizePath("../bold_trace_files")
))
Loading
Loading