[med-svn] [r-cran-bold] 11/12: New upstream version 0.5.0
Andreas Tille
tille at debian.org
Sun Oct 1 20:38:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-bold.
commit d0dace4c3a2fdea56b45c9071e15b687f9cedfad
Author: Andreas Tille <tille at debian.org>
Date: Sun Oct 1 22:37:46 2017 +0200
New upstream version 0.5.0
---
DESCRIPTION | 24 +++---
MD5 | 70 +++++++++---------
NAMESPACE | 15 +---
NEWS.md | 28 +++++++
R/bold-package.R | 28 +++----
R/bold_filter.R | 28 +++----
R/bold_identify.R | 25 ++++---
R/bold_identify_parents.R | 62 +++++++++-------
R/bold_seq.R | 14 ++--
R/bold_seqspec.R | 70 +++++++++---------
R/bold_specimens.R | 27 +++----
R/bold_stats.R | 58 +++++++++++++++
R/bold_tax_id.R | 20 +++--
R/bold_tax_name.R | 31 ++++----
R/bold_trace.R | 41 +++++-----
R/zzz.R | 35 +++++----
README.md | 131 ++++++++++++++++++--------------
build/vignette.rds | Bin 202 -> 202 bytes
inst/doc/bold_vignette.Rmd | 140 +++++++++++++++--------------------
inst/doc/bold_vignette.html | 140 +++++++++++++++--------------------
man/bold-package.Rd | 17 +++--
man/bold_filter.Rd | 17 ++---
man/bold_identify.Rd | 11 +--
man/bold_identify_parents.Rd | 27 ++++---
man/bold_seq.Rd | 49 ++++++------
man/bold_seqspec.Rd | 74 +++++++++---------
man/bold_specimens.Rd | 57 +++++++-------
man/bold_stats.Rd | 83 +++++++++++++++++++++
man/bold_tax_id.Rd | 18 ++---
man/bold_tax_name.Rd | 20 ++---
man/bold_trace.Rd | 42 +++++------
man/sequences.Rd | 1 -
tests/testthat/test-bold_identify.R | 2 +-
tests/testthat/test-bold_seq.R | 8 +-
tests/testthat/test-bold_seqspec.R | 6 +-
tests/testthat/test-bold_specimens.R | 12 ++-
vignettes/bold_vignette.Rmd | 140 +++++++++++++++--------------------
37 files changed, 859 insertions(+), 712 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 2d4c2d7..478163f 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,11 +1,11 @@
Package: bold
-Title: Interface to Bold Systems 'API'
+Title: Interface to Bold Systems API
Description: A programmatic interface to the Web Service methods provided by
- Bold Systems 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.
-Version: 0.4.0
+ 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.
+Version: 0.5.0
License: MIT + file LICENSE
Authors at R: c(person("Scott", "Chamberlain", role = c("aut", "cre"),
email = "myrmecocystus at gmail.com"))
@@ -13,13 +13,13 @@ URL: https://github.com/ropensci/bold
BugReports: https://github.com/ropensci/bold/issues
VignetteBuilder: knitr
LazyData: yes
-Imports: methods, utils, stats, xml2, httr, stringr, assertthat,
- jsonlite, reshape, plyr, data.table, tibble
-Suggests: sangerseqR, knitr, testthat, covr
-RoxygenNote: 5.0.1
+Imports: xml2, crul (>= 0.3.8), stringr, jsonlite, reshape, plyr,
+ data.table, tibble
+Suggests: roxygen2 (>= 6.0.1), sangerseqR, knitr, testthat
+RoxygenNote: 6.0.1
NeedsCompilation: no
-Packaged: 2017-01-06 21:09:43 UTC; sacmac
+Packaged: 2017-07-21 15:41:54 UTC; sacmac
Author: Scott Chamberlain [aut, cre]
Maintainer: Scott Chamberlain <myrmecocystus at gmail.com>
Repository: CRAN
-Date/Publication: 2017-01-06 23:15:12
+Date/Publication: 2017-07-21 23:02:56 UTC
diff --git a/MD5 b/MD5
index 9eaf8b4..63a93ef 100644
--- a/MD5
+++ b/MD5
@@ -1,39 +1,41 @@
-4048fee7c0975af6a9c0d7a337260afc *DESCRIPTION
+d9f0d0f86c57ec088ae6e2ccc75ba3ee *DESCRIPTION
c5af52351472a750055a760a8924ce71 *LICENSE
-5165860a3b255395be13d642b179a371 *NAMESPACE
-2fa5c8bdf95858dd1837fae28ea17d55 *NEWS.md
-28f38a59fa3ed4f2876866e27009eea5 *R/bold-package.R
-d8c604b3cb5646d3eed200f6d682ac03 *R/bold_filter.R
-02ac86657dc05dbd92006534c96a4d49 *R/bold_identify.R
-760c8ca1347f2518652c26b4cb57a36a *R/bold_identify_parents.R
-6015c06eb7b9ab66487923d0a4710254 *R/bold_seq.R
-b06dba4827970b90e0040b96c709bd83 *R/bold_seqspec.R
-cf752c9a8deacc48dda939aa98ab2ac5 *R/bold_specimens.R
-9f5c8fab046120ccaf628b8637226e85 *R/bold_tax_id.R
-0d27cbf2100323c91fb0ce8c90475ac2 *R/bold_tax_name.R
-327a997d91052526d920f535af9925a7 *R/bold_trace.R
-1ba52b69b466fd914392a4a4944e49fe *R/zzz.R
-0361d41c9dd17420ea54bed2d78cd389 *README.md
-b550cac6a4409fc34211d69d6034e5f5 *build/vignette.rds
+19dc97bc26681640044166206b3e8b26 *NAMESPACE
+a143b032c7bab4a5641065d39bcde2f2 *NEWS.md
+bca22309792f9e1bef76921cb712c956 *R/bold-package.R
+86af3511a9fb16be45bd4a9aa65ec5bf *R/bold_filter.R
+64f2b2e4baf7806e6c1882330e97e948 *R/bold_identify.R
+f7575812735ace5257d663c64eff23c3 *R/bold_identify_parents.R
+7d476be15469458fb3490e5f6751b2a5 *R/bold_seq.R
+34757525c62643946a13bbdc88a2c499 *R/bold_seqspec.R
+c04bfe652c63063579726cb9ac9b72d3 *R/bold_specimens.R
+fb4a5c2495a64b58d9dbb930953926aa *R/bold_stats.R
+5b1e9f8a6f26df5e328a32033c276ed2 *R/bold_tax_id.R
+cbf8ecafcc3b5d2943be20908afa6b16 *R/bold_tax_name.R
+3725c7e5034c9054eba152b29dab6a67 *R/bold_trace.R
+c71c8a8fa5c0f0d39b74fb77e29783e9 *R/zzz.R
+d3211d9455722a179f4b474123d260f2 *README.md
+d24146de7dd680956b18b29d27d96e36 *build/vignette.rds
bb64a460c31e2e6821ac53870b09c38e *data/sequences.RData
-419068dc2a58bb51f979137163fd9c80 *inst/doc/bold_vignette.Rmd
-da3109bbcd8a2ab41006e4858c774b38 *inst/doc/bold_vignette.html
-1b8a47f0bd42f789894f4262599a7c7e *man/bold-package.Rd
-2790dc0795eddbc5d639e2b8ec68fc9f *man/bold_filter.Rd
-4b9c6b3164d102f5cff0ffc15aa59a0d *man/bold_identify.Rd
-bfe5d520c74325e0d8e18fbfc9e87f26 *man/bold_identify_parents.Rd
-c7d7ef5d73a4f044b92076e4763ec2f3 *man/bold_seq.Rd
-0e416141c79e26d1bd1842fab32b57fb *man/bold_seqspec.Rd
-0c6f9dfaead4086a18453263dcb9cfea *man/bold_specimens.Rd
-aab27d7c0140b13495e2c220aa35c2f2 *man/bold_tax_id.Rd
-9af831a8dc74cb4849943a42b2d1410a *man/bold_tax_name.Rd
-ee7927818e12a5788a6f82cb4c97d414 *man/bold_trace.Rd
-b7a239e528f11e895a4cd2930c3b9d48 *man/sequences.Rd
+4e8e66850d376db54b734f6459de4546 *inst/doc/bold_vignette.Rmd
+83e40e7100860c0b34b9ad2259c9a05c *inst/doc/bold_vignette.html
+1fc13c735a05dc20167294991f30e259 *man/bold-package.Rd
+7025c073016140b45f74341a683a2c90 *man/bold_filter.Rd
+2fc7738893d734266d23d2f0067b629c *man/bold_identify.Rd
+bd4d479f09995ce3b37ed0e32a9c5a5a *man/bold_identify_parents.Rd
+309ebec7ac23da6ba0bded7c985a71be *man/bold_seq.Rd
+6ec8abe164beeb79ca6f2b2de7b31d3c *man/bold_seqspec.Rd
+bd3feb5a07142dcd69faec4333cb9b41 *man/bold_specimens.Rd
+ecdb0aa85bd247e984a4ca58b8530c42 *man/bold_stats.Rd
+53b9c4a880cfa10f17aeb5e04f644d07 *man/bold_tax_id.Rd
+ae740ce75ebf5f8118c443e6c1715a76 *man/bold_tax_name.Rd
+302ca05fd77797d50f25d36149283649 *man/bold_trace.Rd
+8b6eac4da649615fee64522edaf3bf0b *man/sequences.Rd
d9066883a8fecb16e80ceeef8323edac *tests/test-all.R
-74c1f2703d973538f8468f485e7e65e1 *tests/testthat/test-bold_identify.R
-f164f45ab5a15f3c43d114a3e675d652 *tests/testthat/test-bold_seq.R
-2fd3dff88e57a86026c346f8a59fbc2c *tests/testthat/test-bold_seqspec.R
-9515b48980e0f7653954527b7630b7a1 *tests/testthat/test-bold_specimens.R
+acc0cd3d6511852edf1c5b919b824f97 *tests/testthat/test-bold_identify.R
+07443ab368120fb6f9e18e8a00323b9a *tests/testthat/test-bold_seq.R
+c061b818529a0d00d7dab35fa77fea77 *tests/testthat/test-bold_seqspec.R
+bf5e0d5ce0c5fd2201c8ccc261f88ca6 *tests/testthat/test-bold_specimens.R
670498c2dfc92d737a1fd81be132f464 *tests/testthat/test-bold_tax_id.R
2a174b1e7e11a116070defb4ac5fb4f4 *tests/testthat/test-bold_tax_name.R
-419068dc2a58bb51f979137163fd9c80 *vignettes/bold_vignette.Rmd
+4e8e66850d376db54b734f6459de4546 *vignettes/bold_vignette.Rmd
diff --git a/NAMESPACE b/NAMESPACE
index 1d84cf5..15ec890 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -10,28 +10,19 @@ export(bold_identify_parents)
export(bold_seq)
export(bold_seqspec)
export(bold_specimens)
+export(bold_stats)
export(bold_tax_id)
export(bold_tax_name)
export(bold_trace)
export(read_trace)
-importFrom(assertthat,assert_that)
-importFrom(httr,GET)
-importFrom(httr,build_url)
-importFrom(httr,content)
-importFrom(httr,parse_url)
-importFrom(httr,progress)
-importFrom(httr,stop_for_status)
-importFrom(httr,write_disk)
+importFrom(crul,HttpClient)
+importFrom(crul,url_build)
importFrom(jsonlite,fromJSON)
-importFrom(methods,is)
importFrom(plyr,rbind.fill)
importFrom(reshape,sort_df)
-importFrom(stats,setNames)
importFrom(stringr,str_replace)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_split)
-importFrom(utils,read.delim)
-importFrom(utils,untar)
importFrom(xml2,as_list)
importFrom(xml2,read_xml)
importFrom(xml2,xml_find_all)
diff --git a/NEWS.md b/NEWS.md
index 0d332f2..d896323 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,31 @@
+bold 0.5.0
+==========
+
+### NEW FEATURES
+
+* Now using BOLD's v4 API throughout the package. This was essentially
+just a change of the BASE URL for each request (#30)
+* Now using `crul` for HTTP requests. Only really affects users in that
+specifying curl options works slightly differenlty (#42)
+
+### BUG FIXES
+
+* `marker` parameter in `bold_seqspec` was and maybe still is not working,
+in the sense that using the parameter doesn't always limit results to the
+marker you specify. Not really fixed - watch out for it, and filter after you
+get results back to get markers you want. (#25)
+* Fixed bug in `bold_identify_parents` - was failing when no match for a
+parent name. (#41) thx @VascoElbrecht
+* `tsv` results were erroring in `bold_specimens` and other fxns (#46) - fixed
+by switching to new BOLD v4 API (#30)
+
+### MINOR IMPROVEMENTS
+
+* Namespace calls to base pkgs for `stats` and `utils` - replaced
+`is` with `inherits` (#39)
+
+
+
bold 0.4.0
==========
diff --git a/R/bold-package.R b/R/bold-package.R
index c59b1c6..89e0156 100644
--- a/R/bold-package.R
+++ b/R/bold-package.R
@@ -2,8 +2,9 @@
#'
#' @section About:
#'
-#' This package gives you access to data from BOLD System \url{http://www.boldsystems.org/}
-#' via their API.
+#' This package gives you access to data from BOLD System
+#' \url{http://www.boldsystems.org/} via their API
+#' (\url{http://v4.boldsystems.org/index.php/api_home})
#'
#' @section Functions:
#'
@@ -18,24 +19,25 @@
#' \item \code{\link{bold_identify}} - Search for match given a COI sequence.
#' }
#'
-#' Interestingly, they provide xml and tsv format data for the specimen data, while
-#' they provide fasta data format for the sequence data. So for the specimen data
-#' you can get back raw XML, or a data frame parsed from the tsv data, while for
-#' sequence data you get back a list (b/c sequences are quite long and would make
-#' a data frame unwieldy).
+#' Interestingly, they provide xml and tsv format data for the specimen data,
+#' while they provide fasta data format for the sequence data. So for the
+#' specimen data you can get back raw XML, or a data frame parsed from the
+#' tsv data, while for sequence data you get back a list (b/c sequences are
+#' quite long and would make a data frame unwieldy).
#'
-#' @importFrom methods is
-#' @importFrom stats setNames
-#' @importFrom utils read.delim untar
-#' @importFrom xml2 read_xml xml_find_all xml_find_first xml_text xml_name as_list
+#' @importFrom crul HttpClient url_build
+#' @importFrom xml2 read_xml xml_find_all xml_find_first xml_text
+#' xml_name as_list
+#' @importFrom jsonlite fromJSON
+#' @importFrom reshape sort_df
+#' @importFrom plyr rbind.fill
#' @docType package
#' @name bold-package
#' @aliases bold
NULL
#' List of 3 nucleotide sequences to use in examples for the
-#' \code{\link{bold_identify}} function
-#'
+#' \code{\link{bold_identify}} function
#'
#' @details Each sequence is a character string, of lengths 410, 600, and 696.
#' @name sequences
diff --git a/R/bold_filter.R b/R/bold_filter.R
index 79bf744..4c0b03c 100644
--- a/R/bold_filter.R
+++ b/R/bold_filter.R
@@ -1,37 +1,37 @@
#' Get BOLD specimen + sequence data.
#'
#' @export
-#' @param x (data.frame) a data.frame, as returned from
+#' @param x (data.frame) a data.frame, as returned from
#' \code{\link{bold_seqspec}}. Note that some combinations of parameters
-#' in \code{\link{bold_seqspec}} don't return a data.frame. Stops with
+#' in \code{\link{bold_seqspec}} don't return a data.frame. Stops with
#' error message if this is not a data.frame. Required.
-#' @param by (character) the column by which to group. For example,
-#' if you want the longest sequence for each unique species name, then
-#' pass \strong{species_name}. If the column doesn't exist, error
+#' @param by (character) the column by which to group. For example,
+#' if you want the longest sequence for each unique species name, then
+#' pass \strong{species_name}. If the column doesn't exist, error
#' with message saying so. Required.
-#' @param how (character) one of "max" or "min", which get used as
-#' \code{which.max} or \code{which.min} to get the longest or shorest
-#' sequence, respectively. Note that we remove gap/alignment characters
-#' (\code{-})
+#' @param how (character) one of "max" or "min", which get used as
+#' \code{which.max} or \code{which.min} to get the longest or shortest
+#' sequence, respectively. Note that we remove gap/alignment characters
+#' (\code{-})
#' @return a tibble/data.frame
#' @examples \dontrun{
#' res <- bold_seqspec(taxon='Osmia')
#' maxx <- bold_filter(res, by = "species_name")
#' minn <- bold_filter(res, by = "species_name", how = "min")
-#'
+#'
#' vapply(maxx$nucleotides, nchar, 1, USE.NAMES = FALSE)
#' vapply(minn$nucleotides, nchar, 1, USE.NAMES = FALSE)
#' }
bold_filter <- function(x, by, how = "max") {
- if (!inherits(x, "data.frame")) stop("'x' must be a data.frame",
+ if (!inherits(x, "data.frame")) stop("'x' must be a data.frame",
call. = FALSE)
- if (!how %in% c("min", "max")) stop("'how' must be one of 'min' or 'max'",
+ if (!how %in% c("min", "max")) stop("'how' must be one of 'min' or 'max'",
call. = FALSE)
- if (!by %in% names(x)) stop(sprintf("'%s' is not a valid column in 'x'", by),
+ if (!by %in% names(x)) stop(sprintf("'%s' is not a valid column in 'x'", by),
call. = FALSE)
xsp <- split(x, x[[by]])
tibble::as_data_frame(setrbind(lapply(xsp, function(z) {
- lgts <- vapply(z$nucleotides, function(w) nchar(gsub("-", "", w)), 1,
+ lgts <- vapply(z$nucleotides, function(w) nchar(gsub("-", "", w)), 1,
USE.NAMES = FALSE)
z[eval(parse(text = paste0("which.", how)))(lgts), ]
})))
diff --git a/R/bold_identify.R b/R/bold_identify.R
index ead2c98..35f7e1d 100644
--- a/R/bold_identify.R
+++ b/R/bold_identify.R
@@ -10,8 +10,8 @@
#' @param response (logical) Note that response is the object that returns
#' from the Curl call, useful for debugging, and getting detailed info on
#' the API call.
-#' @param ... Further args passed on to \code{\link[httr]{GET}}, main purpose
-#' being curl debugging
+#' @param ... Further args passed on to \code{\link[crul]{HttpClient}}, main
+#' purpose being curl debugging
#'
#' @section db parmeter options:
#' \itemize{
@@ -39,9 +39,10 @@
#' named list to the \code{sequences} parameter. You can for example,
#' take a list of sequences, and use \code{\link{setNames}} to set names.
#'
-#' @return A data.frame with details for each specimen matched.
+#' @return A data.frame with details for each specimen matched. if a
+#' failed request, returns \code{NULL}
#' @references
-#' \url{http://www.boldsystems.org/index.php/resources/api?type=idengine}
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=idengine}
#' @seealso \code{\link{bold_identify_parents}}
#' @examples \dontrun{
#' seq <- sequences$seq1
@@ -51,17 +52,17 @@
#' }
bold_identify <- function(sequences, db = 'COX1', response=FALSE, ...) {
- url <- 'http://boldsystems.org/index.php/Ids_xml'
-
foo <- function(a, b){
args <- bc(list(sequence = a, db = b))
- out <- GET(url, query = args, ...)
- stop_for_status(out)
- assert_that(out$headers$`content-type` == 'text/xml')
+ cli <- crul::HttpClient$new(url = paste0(bbase(), 'Ids_xml'))
+ out <- cli$get(query = args, ...)
+ out$raise_for_status()
+ stopifnot(out$headers$`content-type` == 'text/xml')
+
if (response) {
out
} else {
- tt <- content(out, "text", encoding = "UTF-8")
+ tt <- out$parse('UTF-8')
xml <- xml2::read_xml(tt)
nodes <- xml2::xml_find_all(xml, "//match")
toget <- c("ID","sequencedescription","database",
@@ -69,7 +70,7 @@ bold_identify <- function(sequences, db = 'COX1', response=FALSE, ...) {
outlist <- lapply(nodes, function(x){
tmp2 <- vapply(toget, function(y) {
tmp <- xml2::xml_find_first(x, y)
- setNames(xml2::xml_text(tmp), xml2::xml_name(tmp))
+ stats::setNames(xml2::xml_text(tmp), xml2::xml_name(tmp))
}, "")
spectmp <- xml2::as_list(xml2::xml_find_first(x, "specimen"))
spectmp <- unnest(spectmp)
@@ -88,6 +89,6 @@ unnest <- function(x){
if (is.null(names(x))) {
list(unname(unlist(x)))
} else {
- do.call(c, lapply(x, unnest))
+ do.call("c", lapply(x, unnest))
}
}
diff --git a/R/bold_identify_parents.R b/R/bold_identify_parents.R
index 7e1e817..e0d2f4e 100644
--- a/R/bold_identify_parents.R
+++ b/R/bold_identify_parents.R
@@ -1,43 +1,46 @@
#' Add taxonomic parent names to a data.frame
#'
#' @export
-#' @param x (data.frame/list) list of data.frames - the output from a call to
+#' @param x (data.frame/list) list of data.frames - the output from a call to
#' \code{\link{bold_identify}}. or a single data.frame from the output from
#' same. required.
-#' @param wide (logical) output in long or wide format. See Details.
+#' @param wide (logical) output in long or wide format. See Details.
#' Default: \code{FALSE}
-#'
+#'
#' @details This function gets unique set of taxonomic names from the input
-#' data.frame, then queries \code{\link{bold_tax_name}} to get the
+#' data.frame, then queries \code{\link{bold_tax_name}} to get the
#' taxonomic ID, passing it to \code{\link{bold_tax_id}} to get the parent
#' names, then attaches those to the input data.
-#'
+#'
+#' Records in the input data that do not have matches for parent names
+#' simply get NA values in the added columns.
+#'
#' @section wide vs long format:
-#' When \code{wide = FALSE} you get many rows for each record. Essentially,
-#' we \code{cbind} the taxonomic classification onto the one row from the
+#' When \code{wide = FALSE} you get many rows for each record. Essentially,
+#' we \code{cbind} the taxonomic classification onto the one row from the
#' result of \code{\link{bold_identify}}, giving as many rows as there are
#' taxa in the taxonomic classification.
-#'
-#' When \code{wide = TRUE} you get one row for each record - thus the
-#' dimenions of the input data stay the same. For this option, we take just
-#' the rows for taxonomic ID and name for each taxon in the taxonomic
-#' classification, and name the columns by the taxon rank, so you get
+#'
+#' When \code{wide = TRUE} you get one row for each record - thus the
+#' dimensions of the input data stay the same. For this option, we take just
+#' the rows for taxonomic ID and name for each taxon in the taxonomic
+#' classification, and name the columns by the taxon rank, so you get
#' \code{phylum} and \code{phylum_id}, and so on.
-#'
+#'
#' @return a list of the same length as the input
-#'
+#'
#' @examples \dontrun{
#' df <- bold_identify(sequences = sequences$seq2)
-#'
+#'
#' # long format
#' out <- bold_identify_parents(df)
#' str(out)
-#' head(out$seq1)
-#'
+#' head(out[[1]])
+#'
#' # wide format
#' out <- bold_identify_parents(df, wide = TRUE)
#' str(out)
-#' head(out$seq1)
+#' head(out[[1]])
#' }
bold_identify_parents <- function(x, wide = FALSE) {
UseMethod("bold_identify_parents")
@@ -56,12 +59,12 @@ bold_identify_parents.data.frame <- function(x, wide = FALSE) {
#' @export
bold_identify_parents.list <- function(x, wide = FALSE) {
# get unique set of names
- uniqnms <-
+ uniqnms <-
unique(unname(unlist(lapply(x, function(z) z$taxonomicidentification))))
if (is.null(uniqnms)) {
stop("no fields 'taxonomicidentification' found in input", call. = FALSE)
}
-
+
# get parent names via bold_tax_name and bold_tax_id
out <- stats::setNames(lapply(uniqnms, function(w) {
tmp <- bold_tax_name(w)
@@ -73,23 +76,28 @@ bold_identify_parents.list <- function(x, wide = FALSE) {
NULL
}
}), uniqnms)
-
+ # remove length zero elements
+ out <- bc(out)
+
# appply parent names to input data
lapply(x, function(z) {
if (wide) {
- # replace each data.frame with a wide version with just
+ # replace each data.frame with a wide version with just
# taxid and taxon name (with col names with rank name)
out <- lapply(out, function(h) do.call("cbind", (apply(h, 1, function(x) {
tmp <- as.list(x[c('taxid', 'taxon')])
tmp$taxid <- as.numeric(tmp$taxid)
- data.frame(stats::setNames(tmp, paste0(x['tax_rank'], c('_id', ''))),
+ data.frame(stats::setNames(tmp, paste0(x['tax_rank'], c('_id', ''))),
stringsAsFactors = FALSE)
}))))
}
zsplit <- split(z, z$ID)
- setrbind(lapply(zsplit, function(w) {
- suppressWarnings(cbind(w, out[names(out) %in%
- w$taxonomicidentification][[1]]))
- }))
+ setrbind(
+ bc(lapply(zsplit, function(w) {
+ tmp <- out[names(out) %in% w$taxonomicidentification]
+ if (!length(tmp)) return(w)
+ suppressWarnings(cbind(w, tmp[[1]]))
+ }))
+ )
})
}
diff --git a/R/bold_seq.R b/R/bold_seq.R
index 147e5bb..938097c 100644
--- a/R/bold_seq.R
+++ b/R/bold_seq.R
@@ -8,7 +8,7 @@
#' @template args
#' @template otherargs
#' @references
-#' \url{http://www.boldsystems.org/index.php/resources/api#sequenceParameters}
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
#'
#' @param marker (character) Returns all records containing matching
#' marker codes.
@@ -28,18 +28,17 @@
#' bold_seq(geo='Ireland')
#' bold_seq(geo=c('Ireland','Denmark'))
#'
-#' # Return the httr response object for detailed Curl call response details
+#' # Return the http response object for detailed Curl call response details
#' res <- bold_seq(taxon='Coelioxys', response=TRUE)
#' res$url
#' res$status_code
-#' res$headers
+#' res$response_headers
#'
#' ## curl debugging
#' ### You can do many things, including get verbose output on the curl
#' ### call, and set a timeout
-#' library("httr")
-#' bold_seq(taxon='Coelioxys', config=verbose())[1:2]
-#' # bold_seqspec(taxon='Coelioxys', config=timeout(0.1))
+#' bold_seq(taxon='Coelioxys', verbose = TRUE)[1:2]
+#' # bold_seqspec(taxon='Coelioxys', timeout_ms = 10)
#' }
bold_seq <- function(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
@@ -64,7 +63,8 @@ bold_seq <- function(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
if (response) {
out
} else {
- tt <- rawToChar(content(out, encoding = "UTF-8"))
+ tt <- out$parse("UTF-8")
+ #tt <- rawToChar(content(out, encoding = "UTF-8"))
res <- strsplit(tt, ">")[[1]][-1]
lapply(res, split_fasta)
}
diff --git a/R/bold_seqspec.R b/R/bold_seqspec.R
index 0b1bf32..ac235e3 100644
--- a/R/bold_seqspec.R
+++ b/R/bold_seqspec.R
@@ -3,19 +3,29 @@
#' @export
#' @template args
#' @template otherargs
-#' @references \url{http://www.boldsystems.org/index.php/resources/api#combined}
+#' @references
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
#'
-#' @param marker (character) Returns all records containing matching marker
-#' codes.
-#' @param format (character) One of xml or tsv (default). tsv format gives
+#' @param marker (character) Returns all records containing matching marker
+#' codes. See Details.
+#' @param format (character) One of xml or tsv (default). tsv format gives
#' back a data.frame object. xml gives back parsed xml as a
-#' @param sepfasta (logical) If \code{TRUE}, the fasta data is separated into
+#' @param sepfasta (logical) If \code{TRUE}, the fasta data is separated into
#' a list with names matching the processid's from the data frame.
#' Default: \code{FALSE}
#'
-#' @return Either a data.frame, parsed xml, a httr response object, or a list
-#' with length two (a data.frame w/o nucleotide data, and a list with
+#' @return Either a data.frame, parsed xml, a http response object, or a list
+#' with length two (a data.frame w/o nucleotide data, and a list with
#' nucleotide data)
+#'
+#' @section Marker:
+#' Notes from BOLD on the \code{marker} param:
+#' "All markers for a specimen matching the search string will be returned.
+#' ie. A record with COI-5P and ITS will return sequence data for both
+#' markers even if only COI-5P was specified."
+#'
+#' You will likely end up with data with markers that you did not request -
+#' just be sure to filter those out as needed.
#'
#' @examples \dontrun{
#' bold_seqspec(taxon='Osmia')
@@ -24,63 +34,57 @@
#' res <- bold_seqspec(taxon='Osmia', sepfasta=TRUE)
#' res$fasta[1:2]
#' res$fasta['GBAH0293-06']
-#'
+#'
#' # records that match a marker name
#' res <- bold_seqspec(taxon="Melanogrammus aeglefinus", marker="COI-5P")
-#'
+#'
#' # records that match a geographic locality
#' res <- bold_seqspec(taxon="Melanogrammus aeglefinus", geo="Canada")
-#'
-#' # return only the longest sequence for each
#'
#' ## curl debugging
-#' ### You can do many things, including get verbose output on the curl call,
+#' ### You can do many things, including get verbose output on the curl call,
#' ### and set a timeout
-#' library("httr")
-#' head(bold_seqspec(taxon='Osmia', config=verbose()))
+#' head(bold_seqspec(taxon='Osmia', verbose = TRUE))
#' ## timeout
-#' # head(bold_seqspec(taxon='Osmia', config=timeout(1)))
-#' ## progress
-#' # x <- bold_seqspec(taxon='Osmia', config=progress())
+#' # head(bold_seqspec(taxon='Osmia', timeout_ms = 1))
#' }
bold_seqspec <- function(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
- institutions = NULL, researchers = NULL, geo = NULL, marker = NULL,
+ institutions = NULL, researchers = NULL, geo = NULL, marker = NULL,
response=FALSE, format = 'tsv', sepfasta=FALSE, ...) {
-
- format <- match.arg(format, choices = c('xml','tsv'))
- args <- bc(list(taxon = pipeornull(taxon), geo = pipeornull(geo),
- ids = pipeornull(ids), bin = pipeornull(bin),
- container = pipeornull(container),
- institutions = pipeornull(institutions),
- researchers = pipeornull(researchers),
+
+ format <- match.arg(format, choices = c('xml', 'tsv'))
+ args <- bc(list(taxon = pipeornull(taxon), geo = pipeornull(geo),
+ ids = pipeornull(ids), bin = pipeornull(bin),
+ container = pipeornull(container),
+ institutions = pipeornull(institutions),
+ researchers = pipeornull(researchers),
marker = pipeornull(marker), combined_download = format))
check_args_given_nonempty(args, c('taxon', 'ids', 'bin', 'container',
'institutions', 'researchers',
'geo', 'marker'))
out <- b_GET(paste0(bbase(), 'API_Public/combined'), args, ...)
- if (response) {
+ if (response) {
out
} else {
- tt <- paste0(rawToChar(content(out, encoding = "UTF-8"), multiple = TRUE),
- collapse = "")
+ tt <- paste0(rawToChar(out$content, multiple = TRUE), collapse = "")
if (tt == "") return(NA)
temp <- switch(
format,
xml = xml2::read_xml(tt),
- tsv = read.delim(text = tt, header = TRUE, sep = "\t",
+ tsv = utils::read.delim(text = tt, header = TRUE, sep = "\t",
stringsAsFactors = FALSE)
)
- if (!sepfasta) {
- temp
+ if (!sepfasta) {
+ temp
} else {
if (format == "tsv") {
fasta <- as.list(temp$nucleotides)
names(fasta) <- temp$processid
df <- temp[ , !names(temp) %in% "nucleotides" ]
list(data = df, fasta = fasta)
- } else {
- temp
+ } else {
+ temp
}
}
}
diff --git a/R/bold_specimens.R b/R/bold_specimens.R
index 221da9f..7c978fe 100644
--- a/R/bold_specimens.R
+++ b/R/bold_specimens.R
@@ -4,19 +4,22 @@
#' @template args
#' @template otherargs
#' @references
-#' \url{http://www.boldsystems.org/index.php/resources/api#specimenParameters}
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
#'
-#' @param format (character) One of xml or tsv (default). tsv format gives
-#' back a data.frame object. xml gives back parsed xml as a
+#' @param format (character) One of xml, json, tsv (default). tsv format gives
+#' back a data.frame object. xml gives back parsed XML as \code{xml_document}
+#' object. 'json' (JavaScript Object Notation) and 'dwc' (Darwin Core Archive)
+#' are supported in theory, but the JSON can be malformed, so we don't support
+#' that here, and the DWC option actually returns TSV.
#'
#' @examples \dontrun{
#' bold_specimens(taxon='Osmia')
#' bold_specimens(taxon='Osmia', format='xml')
-#' # bold_specimens(taxon='Osmia', response=TRUE)
+#' bold_specimens(taxon='Osmia', response=TRUE)
#' res <- bold_specimens(taxon='Osmia', format='xml', response=TRUE)
#' res$url
#' res$status_code
-#' res$headers
+#' res$response_headers
#'
#' # More than 1 can be given for all search parameters
#' bold_specimens(taxon=c('Coelioxys','Osmia'))
@@ -24,33 +27,31 @@
#' ## curl debugging
#' ### These examples below take a long time, so you can set a timeout so that
#' ### it stops by X sec
-#' library("httr")
-#' head(bold_specimens(taxon='Osmia', config=verbose()))
-#' # head(bold_specimens(geo='Costa Rica', config=timeout(6)))
-#' # head(bold_specimens(taxon="Formicidae", geo="Canada", config=timeout(6)))
+#' head(bold_specimens(taxon='Osmia', verbose = TRUE))
+#' # head(bold_specimens(geo='Costa Rica', timeout_ms = 6))
#' }
bold_specimens <- function(taxon = NULL, ids = NULL, bin = NULL,
container = NULL, institutions = NULL, researchers = NULL, geo = NULL,
response=FALSE, format = 'tsv', ...) {
- format <- match.arg(format, choices = c('xml','tsv'))
+ format <- match.arg(format, choices = c('xml', 'tsv'))
args <- bc(list(taxon=pipeornull(taxon), geo=pipeornull(geo),
ids=pipeornull(ids), bin=pipeornull(bin),
container=pipeornull(container),
institutions=pipeornull(institutions),
researchers=pipeornull(researchers),
- specimen_download=format))
+ format = format))
check_args_given_nonempty(args, c('taxon','ids','bin','container',
'institutions','researchers','geo'))
out <- b_GET(paste0(bbase(), 'API_Public/specimen'), args, ...)
if (response) {
out
} else {
- tt <- rawToChar(content(out, encoding = "UTF-8"))
+ tt <- out$parse("UTF-8")
switch(format,
xml = xml2::read_xml(tt),
- tsv = read.delim(text = tt, header = TRUE, sep = "\t",
+ tsv = utils::read.delim(text = tt, header = TRUE, sep = "\t",
stringsAsFactors = FALSE)
)
}
diff --git a/R/bold_stats.R b/R/bold_stats.R
new file mode 100644
index 0000000..119be12
--- /dev/null
+++ b/R/bold_stats.R
@@ -0,0 +1,58 @@
+#' Get BOLD stats
+#'
+#' @export
+#' @inheritParams bold_specimens
+#' @param dataType (character) one of "overview" or "drill_down" (default).
+#' "drill_down": a detailed summary of information which provides record
+#' counts by [BINs, Country, Storing Institution, Species]. "overview":
+#' the total counts of [BINs, Countries, Storing Institutions, Orders,
+#' Families, Genus, Species]
+#' @references
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
+#'
+#' @examples \dontrun{
+#' x <- bold_stats(taxon='Osmia')
+#' x$total_records
+#' x$records_with_species_name
+#' x$bins
+#' x$countries
+#' x$depositories
+#' x$order
+#' x$family
+#' x$genus
+#' x$species
+#'
+#' # just get all counts
+#' lapply(Filter(is.list, x), "[[", "count")
+#'
+#' res <- bold_stats(taxon='Osmia', response=TRUE)
+#' res$url
+#' res$status_code
+#' res$response_headers
+#'
+#' # More than 1 can be given for all search parameters
+#' bold_stats(taxon=c('Coelioxys','Osmia'))
+#'
+#' ## curl debugging
+#' ### These examples below take a long time, so you can set a timeout so that
+#' ### it stops by X sec
+#' bold_stats(taxon='Osmia', verbose = TRUE)
+#' # bold_stats(geo='Costa Rica', timeout_ms = 6)
+#' }
+
+bold_stats <- function(taxon = NULL, ids = NULL, bin = NULL,
+ container = NULL, institutions = NULL, researchers = NULL, geo = NULL,
+ dataType = "drill_down", response=FALSE, ...) {
+
+ args <- bc(list(taxon = pipeornull(taxon), geo = pipeornull(geo),
+ ids = pipeornull(ids), bin = pipeornull(bin),
+ container = pipeornull(container),
+ institutions = pipeornull(institutions),
+ researchers = pipeornull(researchers),
+ dataType = dataType, format = "json"))
+ check_args_given_nonempty(args, c('taxon','ids','bin','container',
+ 'institutions','researchers','geo'))
+ out <- b_GET(paste0(bbase(), 'API_Public/stats'), args, ...)
+ if (response) return(out)
+ jsonlite::fromJSON(out$parse("UTF-8"))
+}
diff --git a/R/bold_tax_id.R b/R/bold_tax_id.R
index 85599d2..88d7975 100644
--- a/R/bold_tax_id.R
+++ b/R/bold_tax_id.R
@@ -9,7 +9,7 @@
#' containing information for parent taxa as well as the specified taxon.
#' @template otherargs
#' @references
-#' \url{http://boldsystems.org/index.php/resources/api?type=taxonomy}
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=taxonomy}
#' @seealso \code{bold_tax_name}
#' @examples \dontrun{
#' bold_tax_id(id=88899)
@@ -24,8 +24,6 @@
#' bold_tax_id(id=88899, dataTypes = "geo")
#' bold_tax_id(id=88899, dataTypes = "sequencinglabs")
#' bold_tax_id(id=88899, dataTypes = "depository")
-#' bold_tax_id(id=88899, dataTypes = "thirdparty")
-#' bold_tax_id(id=88899, dataTypes = "all")
#' bold_tax_id(id=c(88899,125295), dataTypes = "geo")
#' bold_tax_id(id=c(88899,125295), dataTypes = "images")
#'
@@ -33,22 +31,22 @@
#' bold_tax_id(id = NA)
#' bold_tax_id(id = c(88899,125295,NA))
#'
-#' ## get httr response object only
+#' ## get http response object only
#' bold_tax_id(id=88899, response=TRUE)
#' bold_tax_id(id=c(88899,125295), response=TRUE)
#'
#' ## curl debugging
-#' library('httr')
-#' bold_tax_id(id=88899, config=verbose())
+#' bold_tax_id(id=88899, verbose = TRUE)
#' }
-bold_tax_id <- function(id, dataTypes='basic', includeTree=FALSE,
- response=FALSE, ...) {
+bold_tax_id <- function(id, dataTypes = 'basic', includeTree = FALSE,
+ response = FALSE, ...) {
tmp <- lapply(id, function(x)
- get_response(args = bc(list(taxId = x, dataTypes = dataTypes,
- includeTree = if (includeTree) TRUE else NULL)),
- url = paste0(bbase(), "API_Tax/TaxonData"), ...)
+ get_response(args = bc(list(
+ taxId = x, dataTypes = dataTypes,
+ includeTree = if (includeTree) 'true' else NULL)),
+ url = paste0(bbase(), "API_Tax/TaxonData"), ...)
)
if (response) {
tmp
diff --git a/R/bold_tax_name.R b/R/bold_tax_name.R
index 5bf6b11..ccacb82 100644
--- a/R/bold_tax_name.R
+++ b/R/bold_tax_name.R
@@ -1,17 +1,11 @@
-#' Search BOLD for taxonomy data by taxonomic name.
+#' Search BOLD for taxonomy data by taxonomic name
#'
-#' @importFrom httr GET stop_for_status content parse_url build_url
-#' progress write_disk
-#' @importFrom assertthat assert_that
-#' @importFrom jsonlite fromJSON
-#' @importFrom reshape sort_df
-#' @importFrom plyr rbind.fill
#' @export
#' @param name (character) One or more scientific names. required.
#' @param fuzzy (logical) Whether to use fuzzy search or not (default: FALSE).
#' @template otherargs
#' @references
-#' \url{http://boldsystems.org/index.php/resources/api?type=taxonomy}
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=taxonomy}
#' @details The \code{dataTypes} parameter is not supported in this function.
#' If you want to use that parameter, get an ID from this function and pass
#' it into \code{bold_tax_id}, and then use the \code{dataTypes} parameter.
@@ -24,7 +18,7 @@
#' bold_tax_name(name='Diplur', fuzzy=TRUE)
#' bold_tax_name(name='Osm', fuzzy=TRUE)
#'
-#' ## get httr response object only
+#' ## get http response object only
#' bold_tax_name(name='Diplura', response=TRUE)
#' bold_tax_name(name=c('Diplura','Osmia'), response=TRUE)
#'
@@ -34,8 +28,7 @@
#' bold_tax_name(name = "Cordulegaster erronea", response=TRUE)
#'
#' ## curl debugging
-#' library('httr')
-#' bold_tax_name(name='Diplura', config=verbose())
+#' bold_tax_name(name='Diplura', verbose = TRUE)
#' }
bold_tax_name <- function(name, fuzzy = FALSE, response = FALSE, ...) {
@@ -47,7 +40,19 @@ bold_tax_name <- function(name, fuzzy = FALSE, response = FALSE, ...) {
if (response) {
tmp
} else {
- do.call(rbind.fill,
- Map(process_response, x = tmp, y = name, z = FALSE, w = ""))
+ (vvv <- data.table::setDF(data.table::rbindlist(
+ Map(process_tax_name, tmp, name),
+ use.names = TRUE, fill = TRUE)
+ ))
+ }
+}
+
+process_tax_name <- function(x, y) {
+ tt <- rawToChar(x$content)
+ out <- if (x$status_code > 202) "stop" else jsonlite::fromJSON(tt, flatten = TRUE)
+ if ( length(out) == 0 || identical(out[[1]], list()) || out == "stop" ) {
+ data.frame(input = y, stringsAsFactors = FALSE)
+ } else {
+ data.frame(out$top_matched_names, input = y, stringsAsFactors = FALSE)
}
}
diff --git a/R/bold_trace.R b/R/bold_trace.R
index 3e288e6..1e74ddd 100644
--- a/R/bold_trace.R
+++ b/R/bold_trace.R
@@ -2,15 +2,16 @@
#'
#' @export
#' @template args
-#' @references \url{http://www.boldsystems.org/index.php/resources/api#trace}
+#' @references
+#' \url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
#'
-#' @param marker (character) Returns all records containing matching
+#' @param marker (character) Returns all records containing matching
#' marker codes.
#' @param dest (character) A directory to write the files to
#' @param overwrite (logical) Overwrite existing directory and file?
-#' @param progress (logical) Print progress or not. Uses
-#' \code{\link[httr]{progress}}.
-#' @param ... Futher args passed on to \code{\link[httr]{GET}}.
+#' @param progress (logical) Print progress or not. NOT AVAILABLE FOR NOW.
+#' HOPEFULLY WILL RETURN SOON.
+#' @param ... Further args passed on to \code{\link[crul]{HttpClient}}
#' @param x Object to print or read.
#'
#' @examples \dontrun{
@@ -24,12 +25,12 @@
#' # read file in
#' x <- bold_trace(ids=c('ACRJP618-11','ACRJP619-11'), dest="~/mytarfiles")
#' (res <- read_trace(x$ab1[2]))
-#'
-#' # The progress dialog is pretty verbose, so quiet=TRUE is a nice touch,
+#'
+#' # The progress dialog is pretty verbose, so quiet=TRUE is a nice touch,
#' # but not by default
#' # Beware, this one take a while
#' # x <- bold_trace(taxon='Osmia', quiet=TRUE)
-#'
+#'
#' if (requireNamespace("sangerseqR", quietly = TRUE)) {
#' library("sangerseqR")
#' primarySeq(res)
@@ -41,16 +42,16 @@
bold_trace <- function(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
institutions = NULL, researchers = NULL, geo = NULL, marker = NULL, dest=NULL,
overwrite = TRUE, progress = TRUE, ...) {
-
+
if (!requireNamespace("sangerseqR", quietly = TRUE)) {
stop("Please install sangerseqR", call. = FALSE)
}
-
- args <- bc(list(taxon=pipeornull(taxon), geo=pipeornull(geo),
- ids=pipeornull(ids), bin=pipeornull(bin), container=pipeornull(container),
- institutions=pipeornull(institutions), researchers=pipeornull(researchers),
+
+ args <- bc(list(taxon=pipeornull(taxon), geo=pipeornull(geo),
+ ids=pipeornull(ids), bin=pipeornull(bin), container=pipeornull(container),
+ institutions=pipeornull(institutions), researchers=pipeornull(researchers),
marker=pipeornull(marker)))
- url <- make_url(paste0(bbase(), 'API_Public/trace'), args)
+ url <- crul::url_build(paste0(bbase(), 'API_Public/trace'), query = args)
if (is.null(dest)) {
destfile <- paste0(getwd(), "/bold_trace_files.tar")
destdir <- paste0(getwd(), "/bold_trace_files")
@@ -60,12 +61,12 @@ bold_trace <- function(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
}
dir.create(destdir, showWarnings = FALSE, recursive = TRUE)
if (!file.exists(destfile)) file.create(destfile, showWarnings = FALSE)
- res <- GET(url, write_disk(path = destfile, overwrite = overwrite),
- if(progress) progress(), ...)
- untar(destfile, exdir = destdir)
+ cli <- crul::HttpClient$new(url = url)
+ res <- cli$get(disk = destfile, ...)
+ utils::untar(destfile, exdir = destdir)
files <- list.files(destdir, full.names = TRUE)
ab1 <- list.files(destdir, pattern = ".ab1", full.names = TRUE)
- structure(list(destfile = destfile, destdir = destdir, ab1 = ab1,
+ structure(list(destfile = destfile, destdir = destdir, ab1 = ab1,
args = args), class = "boldtrace")
}
@@ -80,8 +81,8 @@ print.boldtrace <- function(x, ...){
#' @export
#' @rdname bold_trace
read_trace <- function(x){
- if (is(x, "boldtrace")) {
- if (length(x$ab1) > 1) stop("Number of paths > 1, just pass one in",
+ if (inherits(x, "boldtrace")) {
+ if (length(x$ab1) > 1) stop("Number of paths > 1, just pass one in",
call. = FALSE)
sangerseqR::readsangerseq(x$ab1)
} else {
diff --git a/R/zzz.R b/R/zzz.R
index 4d539be..66a45f0 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -1,4 +1,4 @@
-bbase <- function() 'http://www.boldsystems.org/index.php/'
+bbase <- function() 'http://v4.boldsystems.org/index.php/'
bc <- function(x) Filter(Negate(is.null), x)
@@ -14,16 +14,10 @@ pipeornull <- function(x){
if (!is.null(x)) {
paste0(x, collapse = "|")
} else {
- NULL
+ NULL
}
}
-make_url <- function(url, args){
- tmp <- parse_url(url)
- tmp$query <- args
- build_url(tmp)
-}
-
check_args_given_nonempty <- function(arguments, x){
paramnames <- x
matchez <- any(paramnames %in% names(arguments))
@@ -42,14 +36,14 @@ check_args_given_nonempty <- function(arguments, x){
}
process_response <- function(x, y, z, w){
- tt <- rawToChar(content(x, "raw", encoding = "UTF-8"))
+ tt <- rawToChar(x$content)
out <- if (x$status_code > 202) "stop" else jsonlite::fromJSON(tt)
if ( length(out) == 0 || identical(out[[1]], list()) || out == "stop" ) {
data.frame(input = y, stringsAsFactors = FALSE)
} else {
if (w %in% c("stats",'images','geo','sequencinglabs','depository')) out <- out[[1]]
trynames <- tryCatch(as.numeric(names(out)), warning = function(w) w)
- if (!is(trynames, "simpleWarning")) names(out) <- NULL
+ if (!inherits(trynames, "simpleWarning")) names(out) <- NULL
if (any(vapply(out, function(x) is.list(x) && length(x) > 0, logical(1)))) {
out <- lapply(out, function(x) Filter(length, x))
} else {
@@ -68,14 +62,19 @@ process_response <- function(x, y, z, w){
}
get_response <- function(args, url, ...){
- res <- GET(url, query = args, ...)
- assert_that(res$headers$`content-type` == 'text/html; charset=utf-8')
- res
+ cli <- crul::HttpClient$new(url = url)
+ out <- cli$get(query = args, ...)
+ out$raise_for_status()
+ stopifnot(out$headers$`content-type` == 'text/html; charset=utf-8')
+ return(out)
}
-b_GET <- function(url, args, ...){
- out <- GET(url, query = args, ...)
- stop_for_status(out)
- assert_that(out$headers$`content-type` == 'application/x-download')
- out
+b_GET <- function(url, args, ...){
+ cli <- crul::HttpClient$new(url = url)
+ out <- cli$get(query = args, ...)
+ out$raise_for_status()
+ if (grepl("html", out$response_headers$`content-type`)) {
+ stop(out$parse("UTF-8"))
+ }
+ return(out)
}
diff --git a/README.md b/README.md
index e0b2e7e..125a996 100644
--- a/README.md
+++ b/README.md
@@ -3,27 +3,36 @@ bold
-[![Build Status](https://api.travis-ci.org/ropensci/bold.png)](https://travis-ci.org/ropensci/bold)
-[![Build status](https://ci.appveyor.com/api/projects/status/hifii9wvk2h7wc7f/branch/master)](https://ci.appveyor.com/project/sckott/bold/branch/master)
-[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/bold)](https://github.com/metacran/cranlogs.app)
-[![codecov.io](https://codecov.io/github/ropensci/bold/coverage.svg?branch=master)](https://codecov.io/github/ropensci/bold?branch=master)
-[![cran version](http://www.r-pkg.org/badges/version/bold)](https://cran.r-project.org/package=bold)
+[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
+![](https://img.shields.io/badge/CRAN/GitHub-0.4.0_/0.4.4.9120-blue.svg)
+
`bold` accesses BOLD barcode data.
-[Documentation for the BOLD API](http://www.boldsystems.org/index.php/resources/api).
+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).
-## Installation
-Stable CRAN version
+## Package status and installation
+
+[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/ropensci/bold?branch=master&svg=true)](https://ci.appveyor.com/project/ropensci/bold)
+[![Travis-CI Build Status](https://travis-ci.org/ropensci/bold.svg?branch=master)](https://travis-ci.org/)
+[![codecov.io](https://codecov.io/github/ropensci/bold/coverage.svg?branch=master)](https://codecov.io/github/ropensci/bold?branch=master)
+[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/bold)](https://github.com/metacran/cranlogs.app)
+
+__Installation instructions__
+
+__Stable Version__
```r
install.packages("bold")
```
-Development version from Github
+__Development Version__
Install `sangerseqR` first
@@ -41,12 +50,14 @@ devtools::install_github("ropensci/bold")
```
+## Usage
+
```r
library("bold")
```
-## Search for sequence data only
+### Search for sequence data only
Default is to get a list back
@@ -54,16 +65,16 @@ Default is to get a list back
```r
bold_seq(taxon='Coelioxys')[[1]]
#> $id
-#> [1] "BBHYL407-10"
-#>
+#> [1] "BBHYL404-10"
+#>
#> $name
-#> [1] "Coelioxys porterae"
-#>
+#> [1] "Coelioxys rufitarsis"
+#>
#> $gene
-#> [1] "BBHYL407-10"
-#>
+#> [1] "BBHYL404-10"
+#>
#> $sequence
-#> [1] "TATAATATATATAATTTTTGCAATATGATCAGGTATAATTGGATCTTCTTTAAGAATAATTATCCGAATAGAATTAAGAATTCCAGGATCATGAATTAGTAATGATCAAATTTATAATTCTTTCATTACAGCACATGCATTCCTAATAATTTTTTTTTTAGTTATACCTTTTTTAATTGGAGGATTTGGTAATTGATTAACCCCACTAATATTAGGAGCTCCTGATATAGCTTTCCCTCGTATAAATAATATTAGATTTTGATTATTACCCCCTGCTCTATTAATATTATTATCAAGAAATTTAATTAATCCAAGACCTGGAACAGGATGAACTGTATACCCCCCTTTATCTTCTTATACTTACCACCCTTCTCCATCTGTAGATTTAGCAATTTTTTCTTTACATTTATCAGGAATTTCTTCAATTATTGGATCAATAAATTTTATTGTAACAATTTTAATAATAAAAAATTATTCAATAAAT [...]
+#> [1] "TATAATATATATAATTTTTGCAATATGATCAGGTATAATTGGATCATCTTTAAGAATAATTATTCGAATAGAATTAAGAATCCCAGGTTCATGAATTAGAAATGATCAAATTTATAATTCTTTTATTACAGCACATGCATTTTTAATAATTTTTTTTTTAGTTATGCCTTTTCTAATTGGGGGATTTGGTAATTGATTAACACCATTAATACTTGGAGCTCCTGATATAGCTTTCCCCCGAATAAACAATATTAGATTTTGACTACTCCCACCTTCTTTATTACTTTTATTATCAAGAAATTTAATTAATCCAAGACCAGGAACAGGATGAACTGTTTATCCACCATTATCCTCTTATACATATCATCCATCTCCTTCTGTAGATTTAGCAATTTTTTCTTTACATTTATCAGGAATTTCCTCAATTATTGGATCAATAAATTTTATTGTTACAATTTTAATAATAAAAAATTATTCAATAAAT [...]
```
You can optionally get back the `httr` response object
@@ -71,33 +82,33 @@ You can optionally get back the `httr` response object
```r
res <- bold_seq(taxon='Coelioxys', response=TRUE)
-res$headers
+res$response_headers
+#> $status
+#> [1] "HTTP/1.1 200 OK"
+#>
#> $date
-#> [1] "Fri, 06 Jan 2017 18:27:39 GMT"
-#>
+#> [1] "Thu, 20 Jul 2017 21:51:40 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"
```
-## Search for specimen data only
+### Search for specimen data only
By default you download `tsv` format data, which is given back to you as a `data.frame`
@@ -105,23 +116,30 @@ By default you download `tsv` format data, which is given back to you as a `data
```r
res <- bold_specimens(taxon='Osmia')
head(res[,1:8])
-#> processid sampleid recordID catalognum fieldnum
-#> 1 ASGCB255-13 BIOUG07489-F04 3955532 BIOUG07489-F04
-#> 2 FBAPB679-09 BC ZSM HYM 02154 1289040 BC ZSM HYM 02154 BC ZSM HYM 02154
-#> 3 FBAPB751-09 BC ZSM HYM 02226 1289112 BC ZSM HYM 02226 BC ZSM HYM 02226
-#> 4 FBAPC359-10 BC ZSM HYM 05964 1709625 BC ZSM HYM 05964 BC ZSM HYM 05964
-#> 5 FBAPC368-10 BC ZSM HYM 05973 1709634 BC ZSM HYM 05973 BC ZSM HYM 05973
-#> 6 FBAPC540-11 BC ZSM HYM 07000 2021833 BC ZSM HYM 07000 BC ZSM HYM 07000
-#> institution_storing bin_uri phylum_taxID
-#> 1 Biodiversity Institute of Ontario BOLD:ABZ2181 20
-#> 2 SNSB, Zoologische Staatssammlung Muenchen BOLD:AAI1788 20
-#> 3 SNSB, Zoologische Staatssammlung Muenchen 20
-#> 4 SNSB, Zoologische Staatssammlung Muenchen BOLD:AAI1999 20
-#> 5 SNSB, Zoologische Staatssammlung Muenchen BOLD:AAK5820 20
-#> 6 SNSB, Zoologische Staatssammlung Muenchen BOLD:AAY5201 20
+#> processid sampleid recordID catalognum fieldnum
+#> 1 ASGCB255-13 BIOUG07489-F04 3955532 BIOUG07489-F04
+#> 2 ASGCB258-13 BIOUG07489-F07 3955535 BIOUG07489-F07
+#> 3 BBHYA3298-12 BIOUG02688-A06 2711807 BIOUG02688-A06 L#11BIOBUS-2558
+#> 4 BBHYL310-10 10BBCHY-3264 1769753 10BBCHY-3264 L#PC2010KT-025
+#> 5 BCHYM1496-13 BC ZSM HYM 19356 4005345 BC ZSM HYM 19356 BC ZSM HYM 19356
+#> 6 BCHYM412-13 BC ZSM HYM 18272 3896353 BC ZSM HYM 18272 BC ZSM HYM 18272
+#> institution_storing collection_code
+#> 1 Biodiversity Institute of Ontario NA
+#> 2 Biodiversity Institute of Ontario NA
+#> 3 University of Guelph, Centre for Biodiversity Genomics NA
+#> 4 University of Guelph, Centre for Biodiversity Genomics NA
+#> 5 SNSB, Zoologische Staatssammlung Muenchen NA
+#> 6 SNSB, Zoologische Staatssammlung Muenchen NA
+#> bin_uri
+#> 1 BOLD:ABZ2181
+#> 2 BOLD:AAC0884
+#> 3 BOLD:ACF5858
+#> 4 BOLD:AAC3295
+#> 5 BOLD:AAI2010
+#> 6 BOLD:AAP2416
```
-## Search for specimen plus sequence data
+### Search for specimen plus sequence data
By default you download `tsv` format data, which is given back to you as a `data.frame`
@@ -131,9 +149,9 @@ res <- bold_seqspec(taxon='Osmia', sepfasta=TRUE)
res$fasta[1:2]
#> $`ASGCB255-13`
#> [1] "-------------------------------GGAATAATTGGTTCTGCTATAAGTATTATTATTCGAATAGAATTAAGAATTCCTGGATCATTCATTTCTAATGATCAAACTTATAATTCTTTAGTAACAGCTCATGCTTTTTTAATAATTTTTTTTCTTGTAATACCATTTTTAATTGGTGGATTTGGAAATTGATTAATTCCATTAATATTAGGAATCCCAGATATAGCATTTCCTCGAATAAATAATATTAGATTTTGACTTTTACCCCCATCCTTAATAATTTTACTTTTAAGAAATTTCTTAAATCCAAGTCCAGGAACAGGTTGAACTGTATATCCCCCCCTTTCTTCTTATTTATTTCATTCTTCCCCTTCTGTTGATTTAGCTATTTTTTCTCTTCATATTTCTGGTTTATCTTCCATCATAGGTTCTTTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCATTAAAA [...]
-#>
-#> $`FBAPB679-09`
-#> [1] "----------------------------TCTGGAATAATTGGGTCAGCAATAAGAATTATTATTCGAATAGAATTAAGTATTCCAGGATCATGAATTTCTAATGATCAAACATATAATTCTTTAGTAACTGCACATGCTTTTTTAATAATTTTTTTTCTTGTTATACCATTTTTAATTGGAGGATTTGGTAATTGATTAGTTCCATTAATATTAGGAATTCCAGATATAGCTTTTCCTCGAATAAATAATATTAGATTTTGACTTTTACCTCCATCTTTAACATTATTACTTCTAAGAAATTTTCTAAATCCAAGTCCCGGAACAGGATGAACTATTTATCCTCCATTATCTTCAAATTTATTTCATACATCTCCTTCAGTTGATTTAGCAATTTTTTCTTTACATATTTCAGGTCTATCTTCTATTATAGGTTCATTAAACTTTATTGTTACTATTATTATAATAAAAAATATTTCTTTAAAA [...]
+#>
+#> $`ASGCB258-13`
+#> [1] "GATTTTATATATAATTTTTGCTATGTGATCAGGAATAATTGGTTCAGCAATAAGAATTATTATTCGAATAGAATTAAGAATTCCAGGTTCATGAATCTCTAATGATCAAATTTATAATTCTTTAGTTACTGCTCACGCTTTTTTAATAATTTTTTTTTTAGTAATACCATTTTTAATTGGAGGATTTGGTAATTGATTAGTTCCATTAATATTAGGAATTCCAGATATAGCATTTCCACGAATAAATAATATTAGATTTTGACTTTTACCTCCTTCTTTAATGTTATTACTTTTAAGAAATTTTTTAAATCCAAGTCCAGGAACTGGATGAACTGTATATCCTCCTCTTTCTTCTCATTTATTTCATTCTTCTCCTTCAGTTGATATAGCTATTTTTTCTTTACATATTTCTGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCATTAAAA [...]
```
Or you can index to a specific sequence like
@@ -145,7 +163,7 @@ res$fasta['GBAH0293-06']
#> [1] "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------TTAATGTTAGGGATTCCAGATATAGCTTTTCCACGAATAAATAATATTAGATTTTGACTGTTACCTCCATCTTTAATATTATTACTTTTAAGAAATTTTTTAAATCCAAGTCCTGGAACAGGATGAACAGTTTATCCTCCTTTATCATCAAATTTATTTCATTCTTCTCCTTCAGTTGATTTAGCAATTTTTTCTTTACATATTTCAGGTTTATCTTCTATTATAGGTTCATTAAATT [...]
```
-## Get trace files
+### Get trace files
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.
@@ -155,17 +173,20 @@ x <- bold_trace(ids = 'ACRJP618-11', progress = FALSE)
read_trace(x$ab1)
#> Number of datapoints: 8877
#> Number of basecalls: 685
-#>
+#>
#> Primary Basecalls: NNNNNNNNNNNNNNNNNNGNNNTTGAGCAGGNATAGTAGGANCTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATT [...]
-#>
+#>
#> Secondary Basecalls:
```
-## Meta
+## Citation
+
+Get citation information for `bold` in R by running: `citation(package = 'bold')`
+
+## Code of Conduct
+
+Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
+By participating in this project you agree to abide by its terms.
-* Please [report any issues or bugs](https://github.com/ropensci/bold/issues).
-* 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](CONDUCT.md). By participating in this project you agree to abide by its terms.
[![ropensci_footer](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)
diff --git a/build/vignette.rds b/build/vignette.rds
index 96fc424..38e81e8 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/bold_vignette.Rmd b/inst/doc/bold_vignette.Rmd
index 5d5d2f9..1c8f594 100644
--- a/inst/doc/bold_vignette.Rmd
+++ b/inst/doc/bold_vignette.Rmd
@@ -11,7 +11,7 @@
### bold info
+ [BOLD home page](http://boldsystems.org/)
-+ [BOLD API docs](http://boldsystems.org/index.php/resources/api)
++ [BOLD API docs](http://v4.boldsystems.org/index.php/api_home)
### Using bold
@@ -101,27 +101,27 @@ bold_seq(taxon = 'Coelioxys')[1:2]
#> [[1]]
#> [[1]]$id
#> [1] "FBAPB491-09"
-#>
+#>
#> [[1]]$name
#> [1] "Coelioxys conica"
-#>
+#>
#> [[1]]$gene
#> [1] "FBAPB491-09"
-#>
+#>
#> [[1]]$sequence
#> [1] "---------------------ACCTCTTTAAGAATAATTATTCGTATAGAAATAAGAATTCCAGGATCTTGAATTAATAATGATCAAATTTATAACTCCTTTATTACAGCACATGCATTTTTAATAATTTTTTTTTTAGTTATACCTTTTCTTATTGGAGGATTTGGAAATTGATTAGTACCTTTAATATTAGGATCACCAGATATAGCTTTCCCACGAATAAATAATATTAGATTTTGATTATTACCTCCTTCTTTATTAATATTATTATTAAGTAATTTAATAAATCCCAGACCAGGAACAGGCTGAACAGTTTATCCTCCTTTATCTTTATACACATACCACCCTTCTCCCTCAGTTGATTTAGCAATTTTTTCACTACATCTATCAGGAATCTCTTCTATTATTGGATCTATAAATTTTATTGTTACAATTTTAATAATAAAAAACTTTTCAATAAATTATAATCAAATACCATTATTCC [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "FBAPC351-10"
-#>
+#>
#> [[2]]$name
#> [1] "Coelioxys afra"
-#>
+#>
#> [[2]]$gene
#> [1] "FBAPC351-10"
-#>
+#>
#> [[2]]$sequence
#> [1] "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ACGAATAAATAATGTAAGATTTTGACTATTACCTCCCTCAATTTTCTTATTATTATCAAGAACCCTAATTAACCCAAGAGCTGGTACTGGATGAACTGTATATCCTCCTTTATCCTTATATACATTTCATGCCTCACCTTCCGTTGATTTAGCAATTTTTTCACTTCATTTATCAGGAATTTCATCAATTATTGGATCAATAAATTTTATTGTTACAATCTTAATAATAAAAAATTTTTCTTTAAAT [...]
```
@@ -134,25 +134,25 @@ res <- bold_seq(taxon = 'Coelioxys', response = TRUE)
res$headers
#> $date
#> [1] "Tue, 15 Sep 2015 20:02:31 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"
```
@@ -165,69 +165,69 @@ bold_seq(geo = "USA")
#> [[1]]
#> [[1]]$id
#> [1] "GBAN1777-08"
-#>
+#>
#> [[1]]$name
#> [1] "Macrobdella decora"
-#>
+#>
#> [[1]]$gene
#> [1] "GBAN1777-08"
-#>
+#>
#> [[1]]$sequence
#> [1] "---------------------------------ATTGGAATCTTGTATTTCTTATTAGGTACATGATCTGCTATAGTAGGGACCTCTATA---AGAATAATTATTCGAATTGAATTAGCTCAACCTGGGTCGTTTTTAGGAAAT---GATCAAATTTACAATACTATTGTTACTGCTCATGGATTAATTATAATTTTTTTTATAGTAATACCTATTTTAATTGGAGGGTTTGGTAATTGATTAATTCCGCTAATA---ATTGGTTCTCCTGATATAGCTTTTCCACGTCTTAATAATTTAAGATTTTGATTACTTCCGCCATCTTTAACTATACTTTTTTGTTCATCTATAGTCGAAAATGGAGTAGGTACTGGATGGACTATTTACCCTCCTTTAGCAGATAACATTGCTCATTCTGGACCTTCTGTAGATATA---GCAATTTTTTCACTTCATTTAGCTGGTGCTTCTTCTATTTTAGGTT [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "GBAN1780-08"
-#>
+#>
#> [[2]]$name
#> [1] "Haemopis terrestris"
-#>
+#>
#> [[2]]$gene
#> [1] "GBAN1780-08"
-#>
+#>
#> [[2]]$sequence
#> [1] "---------------------------------ATTGGAACWTTWTATTTTATTTTNGGNGCTTGATCTGCTATATTNGGGATCTCAATA---AGGAATATTATTCGAATTGAGCCATCTCAACCTGGGAGATTATTAGGAAAT---GATCAATTATATAATTCATTAGTAACAGCTCATGGATTAATTATAATTTTCTTTATGGTTATGCCTATTTTGATTGGTGGGTTTGGTAATTGATTACTACCTTTAATA---ATTGGAGCCCCTGATATAGCTTTTCCTCGATTAAATAATTTAAGTTTTTGATTATTACCACCTTCATTAATTATATTGTTAAGATCCTCTATTATTGAAAGAGGGGTAGGTACAGGTTGAACCTTATATCCTCCTTTAGCAGATAGATTATTTCATTCAGGTCCATCGGTAGATATA---GCTATTTTTTCATTACATATAGCTGGAGCATCATCTATTTTAGGCT [...]
-#>
-#>
+#>
+#>
#> [[3]]
#> [[3]]$id
#> [1] "GBNM0293-06"
-#>
+#>
#> [[3]]$name
#> [1] "Steinernema carpocapsae"
-#>
+#>
#> [[3]]$gene
#> [1] "GBNM0293-06"
-#>
+#>
#> [[3]]$sequence
#> [1] "---------------------------------------------------------------------------------ACAAGATTATCTCTTATTATTCGTTTAGAGTTGGCTCAACCTGGTCTTCTTTTGGGTAAT---GGTCAATTATATAATTCTATTATTACTGCTCATGCTATTCTTATAATTTTTTTCATAGTTATACCTAGAATAATTGGTGGTTTTGGTAATTGAATATTACCTTTAATATTGGGGGCTCCTGATATAAGTTTTCCACGTTTGAATAATTTAAGTTTTTGATTGCTACCAACTGCTATATTTTTGATTTTAGATTCTTGTTTTGTTGACACTGGTTGTGGTACTAGTTGAACTGTTTATCCTCCTTTGAGG---ACTTTAGGTCACCCTGGYAGAAGTGTAGATTTAGCTATTTTTAGTCTTCATTGTGCAGGAATTAGCTCAATTTTAGGGGCTATTAATT [...]
-#>
-#>
+#>
+#>
#> [[4]]
#> [[4]]$id
#> [1] "NEONV108-11"
-#>
+#>
#> [[4]]$name
#> [1] "Aedes thelcter"
-#>
+#>
#> [[4]]$gene
#> [1] "NEONV108-11"
-#>
+#>
#> [[4]]$sequence
#> [1] "AACTTTATACTTCATCTTCGGAGTTTGATCAGGAATAGTTGGTACATCATTAAGAATTTTAATTCGTGCTGAATTAAGTCAACCAGGTATATTTATTGGAAATGACCAAATTTATAATGTAATTGTTACAGCTCATGCTTTTATTATAATTTTCTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGACTAGTTCCTCTAATATTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGTTTTTGAATACTACCTCCCTCATTAACTCTTCTACTTTCAAGTAGTATAGTAGAAAATGGATCAGGAACAGGATGAACAGTTTATCCACCTCTTTCATCTGGAACTGCTCATGCAGGAGCCTCTGTTGATTTAACTATTTTTTCTCTTCATTTAGCCGGAGTTTCATCAATTTTAGGGGCTGTAAATTTTATTACTACTGTAATTAATATACGATCTGCAGGAATTACT [...]
-#>
-#>
+#>
+#>
#> [[5]]
#> [[5]]$id
#> [1] "NEONV109-11"
-#>
+#>
#> [[5]]$name
#> [1] "Aedes thelcter"
-#>
+#>
#> [[5]]$gene
#> [1] "NEONV109-11"
-#>
+#>
#> [[5]]$sequence
#> [1] "AACTTTATACTTCATCTTCGGAGTTTGATCAGGAATAGTTGGTACATCATTAAGAATTTTAATTCGTGCTGAATTAAGTCAACCAGGTATATTTATTGGAAATGACCAAATTTATAATGTAATTGTTACAGCTCATGCTTTTATTATAATTTTCTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGACTAGTTCCTCTAATATTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGTTTTTGAATACTACCTCCCTCATTAACTCTTCTACTTTCAAGTAGTATAGTAGAAAATGGGTCAGGAACAGGATGAACAGTTTATCCACCTCTTTCATCTGGAACTGCTCATGCAGGAGCCTCTGTTGATTTAACTATTTTTTCTCTTCATTTAGCCGGAGTTTCATCAATTTTAGGGGCTGTAAATTTTATTACTACTGTAATTAATATACGATCTGCAGGAATTACT [...]
```
@@ -239,13 +239,13 @@ And you can search by researcher name
bold_seq(researchers = 'Thibaud Decaens')[[1]]
#> $id
#> [1] "BGABA657-14"
-#>
+#>
#> $name
#> [1] "Coleoptera"
-#>
+#>
#> $gene
#> [1] "BGABA657-14"
-#>
+#>
#> $sequence
#> [1] "ACACTCTATTTCATTTTCGGAGCTTGATCAGGAATAGTAGGAACTTCTTTAAGAATACTAATTCGATCTGAATTGGGAAACCCCGGCTCATTGATTGGGGATGATCAAATTTATAATGTTATTGTAACAGCCCATGCATTCATTATAATTTTTTTTATAGTAATACCGATCATAATAGGAGGTTTTGGAAATTGATTAGTCCCGCTAATATTAGGTGCCCCAGATATAGCATTTCCTCGAATAAATAATATAAGATTTTGACTTCTTCCGCCTTCATTAACTTTACTTATTATAAGAAGAATTGTAGAAAACGGGGCGGGAACAGGATGAACAGTTTACCCACCCCTCTCTTCTAACATTGCTCATAGAGGAGCCTCTGTAGATCTTGCAATTTTTAGATTACATTTAGCCGGTGTATCATCAATTTTAGGTGCAGTTAATTTTATTACAACTATTATTAATATACGACCTAAAGGAATAACAT [...]
```
@@ -258,27 +258,27 @@ bold_seq(ids = c('ACRJP618-11', 'ACRJP619-11'))
#> [[1]]
#> [[1]]$id
#> [1] "ACRJP618-11"
-#>
+#>
#> [[1]]$name
#> [1] "Lepidoptera"
-#>
+#>
#> [[1]]$gene
#> [1] "ACRJP618-11"
-#>
+#>
#> [[1]]$sequence
#> [1] "------------------------TTGAGCAGGCATAGTAGGAACTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACAGTATAAAT [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "ACRJP619-11"
-#>
+#>
#> [[2]]$name
#> [1] "Lepidoptera"
-#>
+#>
#> [[2]]$gene
#> [1] "ACRJP619-11"
-#>
+#>
#> [[2]]$sequence
#> [1] "AACTTTATATTTTATTTTTGGTATTTGAGCAGGCATAGTAGGAACTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACAGTATAAAT [...]
```
@@ -290,13 +290,13 @@ by container (containers include project codes and dataset codes)
bold_seq(container = 'ACRJP')[[1]]
#> $id
#> [1] "ACRJP003-09"
-#>
+#>
#> $name
#> [1] "Lepidoptera"
-#>
+#>
#> $gene
#> [1] "ACRJP003-09"
-#>
+#>
#> $sequence
#> [1] "AACATTATATTTTATTTTTGGGATCTGATCTGGAATAGTAGGGACATCTTTAAGTATACTAATTCGAATAGAACTAGGAAATCCTGGATGTTTAATTGGGGATGATCAAATTTATAATACTATTGTTACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCCATTATAATTGGAGGTTTTGGCAATTGACTTGTACCATTAATATTAGGAGCCCCTGATATAGCATTTCCCCGAATAAATAATATAAGATTTTGACTTCTTCCCCCCTCATTAATTTTATTAATTTCAAGAAGAATTGTTGAAAATGGAGCAGGAACAGGATGAACAGTCTATCCTCCATTATCTTCTAATATTGCGCATAGAGGATCCTCTGTTGATTTAGCTATTTTCTCACTTCATTTAGCAGGAATTTCTTCTATTTTAGGAGCAATTAATTTTATTACAACTATTATTAATATACGAATAAATAATTTACTT [...]
```
@@ -308,13 +308,13 @@ by bin (a bin is a _Barcode Index Number_)
bold_seq(bin = 'BOLD:AAA5125')[[1]]
#> $id
#> [1] "BLPAB406-06"
-#>
+#>
#> $name
#> [1] "Eacles ormondei"
-#>
+#>
#> $gene
#> [1] "BLPAB406-06"
-#>
+#>
#> $sequence
#> [1] "AACTTTATATTTTATTTTTGGAATTTGAGCAGGTATAGTAGGAACTTCTTTAAGATTACTAATTCGAGCAGAATTAGGTACCCCCGGATCTTTAATTGGAGATGACCAAATTTATAATACCATTGTAACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGATTAGTACCCCTAATACTAGGAGCTCCTGATATAGCTTTCCCCCGAATAAATAATATAAGATTTTGACTATTACCCCCATCTTTAACTCTTTTAATTTCTAGAAGAATTGTCGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCCCTTTCATCTAATATTGCTCATGGAGGCTCTTCTGTTGATTTAGCTATTTTTTCCCTTCATCTAGCTGGAATCTCATCAATTTTAGGAGCTATTAATTTTATCACAACAATCATTAATATACGACTAAATAATATAATA [...]
```
@@ -376,33 +376,11 @@ You can choose to get the `httr` response object back if you'd rather work with
```r
res <- bold_specimens(taxon = 'Osmia', format = 'xml', response = TRUE)
res$url
-#> [1] "http://www.boldsystems.org/index.php/API_Public/specimen?taxon=Osmia&specimen_download=xml"
+#> [1] "http://v4.boldsystems.org/index.php/API_Public/specimen?taxon=Osmia&format=xml"
res$status_code
#> [1] 200
res$headers
-#> $date
-#> [1] "Mon, 28 Mar 2016 20:39:18 GMT"
-#>
-#> $server
-#> [1] "Apache/2.2.15 (Red Hat)"
-#>
-#> $`x-powered-by`
-#> [1] "PHP/5.3.15"
-#>
-#> $`content-disposition`
-#> [1] "attachment; filename=bold_data.xml"
-#>
-#> $connection
-#> [1] "close"
-#>
-#> $`transfer-encoding`
-#> [1] "chunked"
-#>
-#> $`content-type`
-#> [1] "application/x-download"
-#>
-#> attr(,"class")
-#> [1] "insensitive" "list"
+#> NULL
```
### Search for specimen plus sequence data
@@ -415,7 +393,7 @@ res <- bold_seqspec(taxon = 'Osmia', sepfasta = TRUE)
res$fasta[1:2]
#> $`ASGCB261-13`
#> [1] "AATTTTATATATAATTTTTGCTATATGATCAGGAATAATTGGTTCAGCAATAAGAATTATTATTCGAATAGAATTAAGAATTCCTGGTTCATGAATTTCAAATGATCAAACTTATAATTCTTTAGTTACTGCTCATGCTTTTTTAATAATTTTTTTCTTAGTTATACCATTCTTAATTGGGGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCAGATATAGCATTTCCACGAATAAATAATATTAGATTTTGACTTTTACCTCCTTCTTTAATACTTTTATTATTAAGAAATTTTATAAATCCTAGTCCAGGAACTGGATGAACTGTTTATCCACCTTTATCTTCTCATTTATTTCATTCTTCTCCTTCAGTTGATATAGCTATTTTTTCTTTACATATTTCTGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCTTTAAAA [...]
-#>
+#>
#> $`BCHYM1499-13`
#> [1] "AATTCTTTACATAATTTTTGCTTTATGATCTGGAATAATTGGGTCAGCAATAAGAATTATTATTCGAATAGAATTAAGTATCCCAGGTTCATGAATTACTAATGATCAAATTTATAATTCTTTAGTAACTGCACATGCTTTTTTAATAATTTTTTTTCTTGTGATACCATTTTTAATTGGAGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCAGATATAGCTTTCCCACGAATAAACAATATTAGATTTTGATTATTACCGCCATCTTTAATATTATTACTTTTAAGAAATTTTTTAAATCCAAGTCCTGGAACAGGATGAACAGTTTATCCCCCTTTATCATCAAATTTATTTCATTCTTCTCCTTCAGTTGATTTAGCAATTTTTTCTTTACATATTTCAGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCTTTAAAA [...]
```
diff --git a/inst/doc/bold_vignette.html b/inst/doc/bold_vignette.html
index 97a2373..3301986 100644
--- a/inst/doc/bold_vignette.html
+++ b/inst/doc/bold_vignette.html
@@ -213,7 +213,7 @@ hr {
<ul>
<li><a href="http://boldsystems.org/">BOLD home page</a></li>
-<li><a href="http://boldsystems.org/index.php/resources/api">BOLD API docs</a></li>
+<li><a href="http://v4.boldsystems.org/index.php/api_home">BOLD API docs</a></li>
</ul>
<h3>Using bold</h3>
@@ -284,27 +284,27 @@ hr {
#> [[1]]
#> [[1]]$id
#> [1] "FBAPB491-09"
-#>
+#>
#> [[1]]$name
#> [1] "Coelioxys conica"
-#>
+#>
#> [[1]]$gene
#> [1] "FBAPB491-09"
-#>
+#>
#> [[1]]$sequence
#> [1] "---------------------ACCTCTTTAAGAATAATTATTCGTATAGAAATAAGAATTCCAGGATCTTGAATTAATAATGATCAAATTTATAACTCCTTTATTACAGCACATGCATTTTTAATAATTTTTTTTTTAGTTATACCTTTTCTTATTGGAGGATTTGGAAATTGATTAGTACCTTTAATATTAGGATCACCAGATATAGCTTTCCCACGAATAAATAATATTAGATTTTGATTATTACCTCCTTCTTTATTAATATTATTATTAAGTAATTTAATAAATCCCAGACCAGGAACAGGCTGAACAGTTTATCCTCCTTTATCTTTATACACATACCACCCTTCTCCCTCAGTTGATTTAGCAATTTTTTCACTACATCTATCAGGAATCTCTTCTATTATTGGATCTATAAATTTTATTGTTACAATTTTAATAATAAAAAACTTTTCAATAAATTATAATCAAATACC [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "FBAPC351-10"
-#>
+#>
#> [[2]]$name
#> [1] "Coelioxys afra"
-#>
+#>
#> [[2]]$gene
#> [1] "FBAPC351-10"
-#>
+#>
#> [[2]]$sequence
#> [1] "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ACGAATAAATAATGTAAGATTTTGACTATTACCTCCCTCAATTTTCTTATTATTATCAAGAACCCTAATTAACCCAAGAGCTGGTACTGGATGAACTGTATATCCTCCTTTATCCTTATATACATTTCATGCCTCACCTTCCGTTGATTTAGCAATTTTTTCACTTCATTTATCAGGAATTTCATCAATTATTGGATCAATAAATTTTATTGTTACAATCTTAATAATAAAAAATTTTT [...]
</code></pre>
@@ -315,25 +315,25 @@ hr {
res$headers
#> $date
#> [1] "Tue, 15 Sep 2015 20:02:31 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"
</code></pre>
@@ -344,69 +344,69 @@ res$headers
#> [[1]]
#> [[1]]$id
#> [1] "GBAN1777-08"
-#>
+#>
#> [[1]]$name
#> [1] "Macrobdella decora"
-#>
+#>
#> [[1]]$gene
#> [1] "GBAN1777-08"
-#>
+#>
#> [[1]]$sequence
#> [1] "---------------------------------ATTGGAATCTTGTATTTCTTATTAGGTACATGATCTGCTATAGTAGGGACCTCTATA---AGAATAATTATTCGAATTGAATTAGCTCAACCTGGGTCGTTTTTAGGAAAT---GATCAAATTTACAATACTATTGTTACTGCTCATGGATTAATTATAATTTTTTTTATAGTAATACCTATTTTAATTGGAGGGTTTGGTAATTGATTAATTCCGCTAATA---ATTGGTTCTCCTGATATAGCTTTTCCACGTCTTAATAATTTAAGATTTTGATTACTTCCGCCATCTTTAACTATACTTTTTTGTTCATCTATAGTCGAAAATGGAGTAGGTACTGGATGGACTATTTACCCTCCTTTAGCAGATAACATTGCTCATTCTGGACCTTCTGTAGATATA---GCAATTTTTTCACTTCATTTAGCTGGTGCTTCTTCTAT [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "GBAN1780-08"
-#>
+#>
#> [[2]]$name
#> [1] "Haemopis terrestris"
-#>
+#>
#> [[2]]$gene
#> [1] "GBAN1780-08"
-#>
+#>
#> [[2]]$sequence
#> [1] "---------------------------------ATTGGAACWTTWTATTTTATTTTNGGNGCTTGATCTGCTATATTNGGGATCTCAATA---AGGAATATTATTCGAATTGAGCCATCTCAACCTGGGAGATTATTAGGAAAT---GATCAATTATATAATTCATTAGTAACAGCTCATGGATTAATTATAATTTTCTTTATGGTTATGCCTATTTTGATTGGTGGGTTTGGTAATTGATTACTACCTTTAATA---ATTGGAGCCCCTGATATAGCTTTTCCTCGATTAAATAATTTAAGTTTTTGATTATTACCACCTTCATTAATTATATTGTTAAGATCCTCTATTATTGAAAGAGGGGTAGGTACAGGTTGAACCTTATATCCTCCTTTAGCAGATAGATTATTTCATTCAGGTCCATCGGTAGATATA---GCTATTTTTTCATTACATATAGCTGGAGCATCATCTAT [...]
-#>
-#>
+#>
+#>
#> [[3]]
#> [[3]]$id
#> [1] "GBNM0293-06"
-#>
+#>
#> [[3]]$name
#> [1] "Steinernema carpocapsae"
-#>
+#>
#> [[3]]$gene
#> [1] "GBNM0293-06"
-#>
+#>
#> [[3]]$sequence
#> [1] "---------------------------------------------------------------------------------ACAAGATTATCTCTTATTATTCGTTTAGAGTTGGCTCAACCTGGTCTTCTTTTGGGTAAT---GGTCAATTATATAATTCTATTATTACTGCTCATGCTATTCTTATAATTTTTTTCATAGTTATACCTAGAATAATTGGTGGTTTTGGTAATTGAATATTACCTTTAATATTGGGGGCTCCTGATATAAGTTTTCCACGTTTGAATAATTTAAGTTTTTGATTGCTACCAACTGCTATATTTTTGATTTTAGATTCTTGTTTTGTTGACACTGGTTGTGGTACTAGTTGAACTGTTTATCCTCCTTTGAGG---ACTTTAGGTCACCCTGGYAGAAGTGTAGATTTAGCTATTTTTAGTCTTCATTGTGCAGGAATTAGCTCAATTTTAGGGGC [...]
-#>
-#>
+#>
+#>
#> [[4]]
#> [[4]]$id
#> [1] "NEONV108-11"
-#>
+#>
#> [[4]]$name
#> [1] "Aedes thelcter"
-#>
+#>
#> [[4]]$gene
#> [1] "NEONV108-11"
-#>
+#>
#> [[4]]$sequence
#> [1] "AACTTTATACTTCATCTTCGGAGTTTGATCAGGAATAGTTGGTACATCATTAAGAATTTTAATTCGTGCTGAATTAAGTCAACCAGGTATATTTATTGGAAATGACCAAATTTATAATGTAATTGTTACAGCTCATGCTTTTATTATAATTTTCTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGACTAGTTCCTCTAATATTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGTTTTTGAATACTACCTCCCTCATTAACTCTTCTACTTTCAAGTAGTATAGTAGAAAATGGATCAGGAACAGGATGAACAGTTTATCCACCTCTTTCATCTGGAACTGCTCATGCAGGAGCCTCTGTTGATTTAACTATTTTTTCTCTTCATTTAGCCGGAGTTTCATCAATTTTAGGGGCTGTAAATTTTATTACTACTGTAATTAATATACGATCTGCAG [...]
-#>
-#>
+#>
+#>
#> [[5]]
#> [[5]]$id
#> [1] "NEONV109-11"
-#>
+#>
#> [[5]]$name
#> [1] "Aedes thelcter"
-#>
+#>
#> [[5]]$gene
#> [1] "NEONV109-11"
-#>
+#>
#> [[5]]$sequence
#> [1] "AACTTTATACTTCATCTTCGGAGTTTGATCAGGAATAGTTGGTACATCATTAAGAATTTTAATTCGTGCTGAATTAAGTCAACCAGGTATATTTATTGGAAATGACCAAATTTATAATGTAATTGTTACAGCTCATGCTTTTATTATAATTTTCTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGACTAGTTCCTCTAATATTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGTTTTTGAATACTACCTCCCTCATTAACTCTTCTACTTTCAAGTAGTATAGTAGAAAATGGGTCAGGAACAGGATGAACAGTTTATCCACCTCTTTCATCTGGAACTGCTCATGCAGGAGCCTCTGTTGATTTAACTATTTTTTCTCTTCATTTAGCCGGAGTTTCATCAATTTTAGGGGCTGTAAATTTTATTACTACTGTAATTAATATACGATCTGCAG [...]
</code></pre>
@@ -416,13 +416,13 @@ res$headers
<pre><code class="r">bold_seq(researchers = 'Thibaud Decaens')[[1]]
#> $id
#> [1] "BGABA657-14"
-#>
+#>
#> $name
#> [1] "Coleoptera"
-#>
+#>
#> $gene
#> [1] "BGABA657-14"
-#>
+#>
#> $sequence
#> [1] "ACACTCTATTTCATTTTCGGAGCTTGATCAGGAATAGTAGGAACTTCTTTAAGAATACTAATTCGATCTGAATTGGGAAACCCCGGCTCATTGATTGGGGATGATCAAATTTATAATGTTATTGTAACAGCCCATGCATTCATTATAATTTTTTTTATAGTAATACCGATCATAATAGGAGGTTTTGGAAATTGATTAGTCCCGCTAATATTAGGTGCCCCAGATATAGCATTTCCTCGAATAAATAATATAAGATTTTGACTTCTTCCGCCTTCATTAACTTTACTTATTATAAGAAGAATTGTAGAAAACGGGGCGGGAACAGGATGAACAGTTTACCCACCCCTCTCTTCTAACATTGCTCATAGAGGAGCCTCTGTAGATCTTGCAATTTTTAGATTACATTTAGCCGGTGTATCATCAATTTTAGGTGCAGTTAATTTTATTACAACTATTATTAATATACGACCTAAAGG [...]
</code></pre>
@@ -433,27 +433,27 @@ res$headers
#> [[1]]
#> [[1]]$id
#> [1] "ACRJP618-11"
-#>
+#>
#> [[1]]$name
#> [1] "Lepidoptera"
-#>
+#>
#> [[1]]$gene
#> [1] "ACRJP618-11"
-#>
+#>
#> [[1]]$sequence
#> [1] "------------------------TTGAGCAGGCATAGTAGGAACTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACA [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "ACRJP619-11"
-#>
+#>
#> [[2]]$name
#> [1] "Lepidoptera"
-#>
+#>
#> [[2]]$gene
#> [1] "ACRJP619-11"
-#>
+#>
#> [[2]]$sequence
#> [1] "AACTTTATATTTTATTTTTGGTATTTGAGCAGGCATAGTAGGAACTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACA [...]
</code></pre>
@@ -463,13 +463,13 @@ res$headers
<pre><code class="r">bold_seq(container = 'ACRJP')[[1]]
#> $id
#> [1] "ACRJP003-09"
-#>
+#>
#> $name
#> [1] "Lepidoptera"
-#>
+#>
#> $gene
#> [1] "ACRJP003-09"
-#>
+#>
#> $sequence
#> [1] "AACATTATATTTTATTTTTGGGATCTGATCTGGAATAGTAGGGACATCTTTAAGTATACTAATTCGAATAGAACTAGGAAATCCTGGATGTTTAATTGGGGATGATCAAATTTATAATACTATTGTTACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCCATTATAATTGGAGGTTTTGGCAATTGACTTGTACCATTAATATTAGGAGCCCCTGATATAGCATTTCCCCGAATAAATAATATAAGATTTTGACTTCTTCCCCCCTCATTAATTTTATTAATTTCAAGAAGAATTGTTGAAAATGGAGCAGGAACAGGATGAACAGTCTATCCTCCATTATCTTCTAATATTGCGCATAGAGGATCCTCTGTTGATTTAGCTATTTTCTCACTTCATTTAGCAGGAATTTCTTCTATTTTAGGAGCAATTAATTTTATTACAACTATTATTAATATACGAATAAATA [...]
</code></pre>
@@ -479,13 +479,13 @@ res$headers
<pre><code class="r">bold_seq(bin = 'BOLD:AAA5125')[[1]]
#> $id
#> [1] "BLPAB406-06"
-#>
+#>
#> $name
#> [1] "Eacles ormondei"
-#>
+#>
#> $gene
#> [1] "BLPAB406-06"
-#>
+#>
#> $sequence
#> [1] "AACTTTATATTTTATTTTTGGAATTTGAGCAGGTATAGTAGGAACTTCTTTAAGATTACTAATTCGAGCAGAATTAGGTACCCCCGGATCTTTAATTGGAGATGACCAAATTTATAATACCATTGTAACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGATTAGTACCCCTAATACTAGGAGCTCCTGATATAGCTTTCCCCCGAATAAATAATATAAGATTTTGACTATTACCCCCATCTTTAACTCTTTTAATTTCTAGAAGAATTGTCGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCCCTTTCATCTAATATTGCTCATGGAGGCTCTTCTGTTGATTTAGCTATTTTTTCCCTTCATCTAGCTGGAATCTCATCAATTTTAGGAGCTATTAATTTTATCACAACAATCATTAATATACGACTAAATA [...]
</code></pre>
@@ -538,33 +538,11 @@ head(res[,1:8])
<pre><code class="r">res <- bold_specimens(taxon = 'Osmia', format = 'xml', response = TRUE)
res$url
-#> [1] "http://www.boldsystems.org/index.php/API_Public/specimen?taxon=Osmia&specimen_download=xml"
+#> [1] "http://v4.boldsystems.org/index.php/API_Public/specimen?taxon=Osmia&format=xml"
res$status_code
#> [1] 200
res$headers
-#> $date
-#> [1] "Mon, 28 Mar 2016 20:39:18 GMT"
-#>
-#> $server
-#> [1] "Apache/2.2.15 (Red Hat)"
-#>
-#> $`x-powered-by`
-#> [1] "PHP/5.3.15"
-#>
-#> $`content-disposition`
-#> [1] "attachment; filename=bold_data.xml"
-#>
-#> $connection
-#> [1] "close"
-#>
-#> $`transfer-encoding`
-#> [1] "chunked"
-#>
-#> $`content-type`
-#> [1] "application/x-download"
-#>
-#> attr(,"class")
-#> [1] "insensitive" "list"
+#> NULL
</code></pre>
<h3>Search for specimen plus sequence data</h3>
@@ -575,7 +553,7 @@ res$headers
res$fasta[1:2]
#> $`ASGCB261-13`
#> [1] "AATTTTATATATAATTTTTGCTATATGATCAGGAATAATTGGTTCAGCAATAAGAATTATTATTCGAATAGAATTAAGAATTCCTGGTTCATGAATTTCAAATGATCAAACTTATAATTCTTTAGTTACTGCTCATGCTTTTTTAATAATTTTTTTCTTAGTTATACCATTCTTAATTGGGGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCAGATATAGCATTTCCACGAATAAATAATATTAGATTTTGACTTTTACCTCCTTCTTTAATACTTTTATTATTAAGAAATTTTATAAATCCTAGTCCAGGAACTGGATGAACTGTTTATCCACCTTTATCTTCTCATTTATTTCATTCTTCTCCTTCAGTTGATATAGCTATTTTTTCTTTACATATTTCTGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTT [...]
-#>
+#>
#> $`BCHYM1499-13`
#> [1] "AATTCTTTACATAATTTTTGCTTTATGATCTGGAATAATTGGGTCAGCAATAAGAATTATTATTCGAATAGAATTAAGTATCCCAGGTTCATGAATTACTAATGATCAAATTTATAATTCTTTAGTAACTGCACATGCTTTTTTAATAATTTTTTTTCTTGTGATACCATTTTTAATTGGAGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCAGATATAGCTTTCCCACGAATAAACAATATTAGATTTTGATTATTACCGCCATCTTTAATATTATTACTTTTAAGAAATTTTTTAAATCCAAGTCCTGGAACAGGATGAACAGTTTATCCCCCTTTATCATCAAATTTATTTCATTCTTCTCCTTCAGTTGATTTAGCAATTTTTTCTTTACATATTTCAGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTT [...]
</code></pre>
diff --git a/man/bold-package.Rd b/man/bold-package.Rd
index cddeb46..c0281b5 100644
--- a/man/bold-package.Rd
+++ b/man/bold-package.Rd
@@ -2,8 +2,8 @@
% Please edit documentation in R/bold-package.R
\docType{package}
\name{bold-package}
-\alias{bold}
\alias{bold-package}
+\alias{bold}
\title{bold: A programmatic interface to the Barcode of Life data.}
\description{
bold: A programmatic interface to the Barcode of Life data.
@@ -11,8 +11,9 @@ bold: A programmatic interface to the Barcode of Life data.
\section{About}{
-This package gives you access to data from BOLD System \url{http://www.boldsystems.org/}
-via their API.
+This package gives you access to data from BOLD System
+\url{http://www.boldsystems.org/} via their API
+(\url{http://v4.boldsystems.org/index.php/api_home})
}
\section{Functions}{
@@ -29,10 +30,10 @@ via their API.
\item \code{\link{bold_identify}} - Search for match given a COI sequence.
}
-Interestingly, they provide xml and tsv format data for the specimen data, while
-they provide fasta data format for the sequence data. So for the specimen data
-you can get back raw XML, or a data frame parsed from the tsv data, while for
-sequence data you get back a list (b/c sequences are quite long and would make
-a data frame unwieldy).
+Interestingly, they provide xml and tsv format data for the specimen data,
+while they provide fasta data format for the sequence data. So for the
+specimen data you can get back raw XML, or a data frame parsed from the
+tsv data, while for sequence data you get back a list (b/c sequences are
+quite long and would make a data frame unwieldy).
}
diff --git a/man/bold_filter.Rd b/man/bold_filter.Rd
index eb4b8c4..a3c972b 100644
--- a/man/bold_filter.Rd
+++ b/man/bold_filter.Rd
@@ -7,19 +7,19 @@
bold_filter(x, by, how = "max")
}
\arguments{
-\item{x}{(data.frame) a data.frame, as returned from
+\item{x}{(data.frame) a data.frame, as returned from
\code{\link{bold_seqspec}}. Note that some combinations of parameters
-in \code{\link{bold_seqspec}} don't return a data.frame. Stops with
+in \code{\link{bold_seqspec}} don't return a data.frame. Stops with
error message if this is not a data.frame. Required.}
-\item{by}{(character) the column by which to group. For example,
-if you want the longest sequence for each unique species name, then
-pass \strong{species_name}. If the column doesn't exist, error
+\item{by}{(character) the column by which to group. For example,
+if you want the longest sequence for each unique species name, then
+pass \strong{species_name}. If the column doesn't exist, error
with message saying so. Required.}
-\item{how}{(character) one of "max" or "min", which get used as
-\code{which.max} or \code{which.min} to get the longest or shorest
-sequence, respectively. Note that we remove gap/alignment characters
+\item{how}{(character) one of "max" or "min", which get used as
+\code{which.max} or \code{which.min} to get the longest or shortest
+sequence, respectively. Note that we remove gap/alignment characters
(\code{-})}
}
\value{
@@ -38,4 +38,3 @@ vapply(maxx$nucleotides, nchar, 1, USE.NAMES = FALSE)
vapply(minn$nucleotides, nchar, 1, USE.NAMES = FALSE)
}
}
-
diff --git a/man/bold_identify.Rd b/man/bold_identify.Rd
index f9c1922..57e068a 100644
--- a/man/bold_identify.Rd
+++ b/man/bold_identify.Rd
@@ -18,11 +18,12 @@ more information.}
from the Curl call, useful for debugging, and getting detailed info on
the API call.}
-\item{...}{Further args passed on to \code{\link[httr]{GET}}, main purpose
-being curl debugging}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
}
\value{
-A data.frame with details for each specimen matched.
+A data.frame with details for each specimen matched. if a
+failed request, returns \code{NULL}
}
\description{
Search for matches to sequences against the BOLD COI database.
@@ -56,6 +57,7 @@ To maintain names on the output list of data make sure to pass in a
named list to the \code{sequences} parameter. You can for example,
take a list of sequences, and use \code{\link{setNames}} to set names.
}
+
\examples{
\dontrun{
seq <- sequences$seq1
@@ -65,9 +67,8 @@ head(bold_identify(sequences=seq, db='COX1_SPECIES')[[1]])
}
}
\references{
-\url{http://www.boldsystems.org/index.php/resources/api?type=idengine}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=idengine}
}
\seealso{
\code{\link{bold_identify_parents}}
}
-
diff --git a/man/bold_identify_parents.Rd b/man/bold_identify_parents.Rd
index b1b3a38..27bd1b1 100644
--- a/man/bold_identify_parents.Rd
+++ b/man/bold_identify_parents.Rd
@@ -7,11 +7,11 @@
bold_identify_parents(x, wide = FALSE)
}
\arguments{
-\item{x}{(data.frame/list) list of data.frames - the output from a call to
+\item{x}{(data.frame/list) list of data.frames - the output from a call to
\code{\link{bold_identify}}. or a single data.frame from the output from
same. required.}
-\item{wide}{(logical) output in long or wide format. See Details.
+\item{wide}{(logical) output in long or wide format. See Details.
Default: \code{FALSE}}
}
\value{
@@ -22,23 +22,27 @@ Add taxonomic parent names to a data.frame
}
\details{
This function gets unique set of taxonomic names from the input
-data.frame, then queries \code{\link{bold_tax_name}} to get the
+data.frame, then queries \code{\link{bold_tax_name}} to get the
taxonomic ID, passing it to \code{\link{bold_tax_id}} to get the parent
names, then attaches those to the input data.
+
+Records in the input data that do not have matches for parent names
+simply get NA values in the added columns.
}
\section{wide vs long format}{
-When \code{wide = FALSE} you get many rows for each record. Essentially,
-we \code{cbind} the taxonomic classification onto the one row from the
+When \code{wide = FALSE} you get many rows for each record. Essentially,
+we \code{cbind} the taxonomic classification onto the one row from the
result of \code{\link{bold_identify}}, giving as many rows as there are
taxa in the taxonomic classification.
-When \code{wide = TRUE} you get one row for each record - thus the
-dimenions of the input data stay the same. For this option, we take just
-the rows for taxonomic ID and name for each taxon in the taxonomic
-classification, and name the columns by the taxon rank, so you get
+When \code{wide = TRUE} you get one row for each record - thus the
+dimensions of the input data stay the same. For this option, we take just
+the rows for taxonomic ID and name for each taxon in the taxonomic
+classification, and name the columns by the taxon rank, so you get
\code{phylum} and \code{phylum_id}, and so on.
}
+
\examples{
\dontrun{
df <- bold_identify(sequences = sequences$seq2)
@@ -46,12 +50,11 @@ df <- bold_identify(sequences = sequences$seq2)
# long format
out <- bold_identify_parents(df)
str(out)
-head(out$seq1)
+head(out[[1]])
# wide format
out <- bold_identify_parents(df, wide = TRUE)
str(out)
-head(out$seq1)
+head(out[[1]])
}
}
-
diff --git a/man/bold_seq.Rd b/man/bold_seq.Rd
index a7c3fa1..3383f5e 100644
--- a/man/bold_seq.Rd
+++ b/man/bold_seq.Rd
@@ -9,34 +9,37 @@ bold_seq(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
response = FALSE, ...)
}
\arguments{
-\item{taxon}{(character) Returns all records containing matching taxa. Taxa includes the ranks of
-phylum, class, order, family, subfamily, genus, and species.}
+\item{taxon}{(character) Returns all records containing matching taxa. Taxa
+includes the ranks of phylum, class, order, family, subfamily, genus,
+and species.}
-\item{ids}{(character) Returns all records containing matching IDs. IDs include Sample IDs,
-Process IDs, Museum IDs and Field IDs.}
+\item{ids}{(character) Returns all records containing matching IDs. IDs
+include Sample IDs, Process IDs, Museum IDs and Field IDs.}
-\item{bin}{(character) Returns all records contained in matching BINs. A BIN is defined by a
-Barcode Index Number URI.}
+\item{bin}{(character) Returns all records contained in matching BINs. A
+BIN is defined by a Barcode Index Number URI.}
-\item{container}{(character) Returns all records contained in matching projects or datasets.
-Containers include project codes and dataset codes}
+\item{container}{(character) Returns all records contained in matching
+projects or datasets. Containers include project codes and dataset codes}
-\item{institutions}{(character) Returns all records stored in matching institutions. Institutions
-are the Specimen Storing Site.}
+\item{institutions}{(character) Returns all records stored in matching
+institutions. Institutions are the Specimen Storing Site.}
-\item{researchers}{(character) Returns all records containing matching researcher names.
-Researchers include collectors and specimen identifiers.}
+\item{researchers}{(character) Returns all records containing matching
+researcher names. Researchers include collectors and specimen identifiers.}
-\item{geo}{(character) Returns all records collected in matching geographic sites. Geographic
-sites includes countries and province/states.}
+\item{geo}{(character) Returns all records collected in matching geographic
+sites. Geographic sites includes countries and province/states.}
\item{marker}{(character) Returns all records containing matching
marker codes.}
-\item{response}{(logical) Note that response is the object that returns from the Curl call,
-useful for debugging, and getting detailed info on the API call.}
+\item{response}{(logical) Note that response is the object that returns
+from the Curl call, useful for debugging, and getting detailed info on
+the API call.}
-\item{...}{Further args passed on to httr::GET, main purpose being curl debugging}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
}
\value{
A list with each element of length 4 with slots for id, name,
@@ -59,21 +62,19 @@ bold_seq(researchers='Thibaud Decaens')
bold_seq(geo='Ireland')
bold_seq(geo=c('Ireland','Denmark'))
-# Return the httr response object for detailed Curl call response details
+# Return the http response object for detailed Curl call response details
res <- bold_seq(taxon='Coelioxys', response=TRUE)
res$url
res$status_code
-res$headers
+res$response_headers
## curl debugging
### You can do many things, including get verbose output on the curl
### call, and set a timeout
-library("httr")
-bold_seq(taxon='Coelioxys', config=verbose())[1:2]
-# bold_seqspec(taxon='Coelioxys', config=timeout(0.1))
+bold_seq(taxon='Coelioxys', verbose = TRUE)[1:2]
+# bold_seqspec(taxon='Coelioxys', timeout_ms = 10)
}
}
\references{
-\url{http://www.boldsystems.org/index.php/resources/api#sequenceParameters}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
}
-
diff --git a/man/bold_seqspec.Rd b/man/bold_seqspec.Rd
index 0b6657d..a4e577b 100644
--- a/man/bold_seqspec.Rd
+++ b/man/bold_seqspec.Rd
@@ -9,50 +9,64 @@ bold_seqspec(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
response = FALSE, format = "tsv", sepfasta = FALSE, ...)
}
\arguments{
-\item{taxon}{(character) Returns all records containing matching taxa. Taxa includes the ranks of
-phylum, class, order, family, subfamily, genus, and species.}
+\item{taxon}{(character) Returns all records containing matching taxa. Taxa
+includes the ranks of phylum, class, order, family, subfamily, genus,
+and species.}
-\item{ids}{(character) Returns all records containing matching IDs. IDs include Sample IDs,
-Process IDs, Museum IDs and Field IDs.}
+\item{ids}{(character) Returns all records containing matching IDs. IDs
+include Sample IDs, Process IDs, Museum IDs and Field IDs.}
-\item{bin}{(character) Returns all records contained in matching BINs. A BIN is defined by a
-Barcode Index Number URI.}
+\item{bin}{(character) Returns all records contained in matching BINs. A
+BIN is defined by a Barcode Index Number URI.}
-\item{container}{(character) Returns all records contained in matching projects or datasets.
-Containers include project codes and dataset codes}
+\item{container}{(character) Returns all records contained in matching
+projects or datasets. Containers include project codes and dataset codes}
-\item{institutions}{(character) Returns all records stored in matching institutions. Institutions
-are the Specimen Storing Site.}
+\item{institutions}{(character) Returns all records stored in matching
+institutions. Institutions are the Specimen Storing Site.}
-\item{researchers}{(character) Returns all records containing matching researcher names.
-Researchers include collectors and specimen identifiers.}
+\item{researchers}{(character) Returns all records containing matching
+researcher names. Researchers include collectors and specimen identifiers.}
-\item{geo}{(character) Returns all records collected in matching geographic sites. Geographic
-sites includes countries and province/states.}
+\item{geo}{(character) Returns all records collected in matching geographic
+sites. Geographic sites includes countries and province/states.}
-\item{marker}{(character) Returns all records containing matching marker
-codes.}
+\item{marker}{(character) Returns all records containing matching marker
+codes. See Details.}
-\item{response}{(logical) Note that response is the object that returns from the Curl call,
-useful for debugging, and getting detailed info on the API call.}
+\item{response}{(logical) Note that response is the object that returns
+from the Curl call, useful for debugging, and getting detailed info on
+the API call.}
-\item{format}{(character) One of xml or tsv (default). tsv format gives
+\item{format}{(character) One of xml or tsv (default). tsv format gives
back a data.frame object. xml gives back parsed xml as a}
-\item{sepfasta}{(logical) If \code{TRUE}, the fasta data is separated into
+\item{sepfasta}{(logical) If \code{TRUE}, the fasta data is separated into
a list with names matching the processid's from the data frame.
Default: \code{FALSE}}
-\item{...}{Further args passed on to httr::GET, main purpose being curl debugging}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
}
\value{
-Either a data.frame, parsed xml, a httr response object, or a list
-with length two (a data.frame w/o nucleotide data, and a list with
+Either a data.frame, parsed xml, a http response object, or a list
+with length two (a data.frame w/o nucleotide data, and a list with
nucleotide data)
}
\description{
Get BOLD specimen + sequence data.
}
+\section{Marker}{
+
+Notes from BOLD on the \code{marker} param:
+"All markers for a specimen matching the search string will be returned.
+ie. A record with COI-5P and ITS will return sequence data for both
+markers even if only COI-5P was specified."
+
+You will likely end up with data with markers that you did not request -
+just be sure to filter those out as needed.
+}
+
\examples{
\dontrun{
bold_seqspec(taxon='Osmia')
@@ -68,20 +82,14 @@ res <- bold_seqspec(taxon="Melanogrammus aeglefinus", marker="COI-5P")
# records that match a geographic locality
res <- bold_seqspec(taxon="Melanogrammus aeglefinus", geo="Canada")
-# return only the longest sequence for each
-
## curl debugging
-### You can do many things, including get verbose output on the curl call,
+### You can do many things, including get verbose output on the curl call,
### and set a timeout
-library("httr")
-head(bold_seqspec(taxon='Osmia', config=verbose()))
+head(bold_seqspec(taxon='Osmia', verbose = TRUE))
## timeout
-# head(bold_seqspec(taxon='Osmia', config=timeout(1)))
-## progress
-# x <- bold_seqspec(taxon='Osmia', config=progress())
+# head(bold_seqspec(taxon='Osmia', timeout_ms = 1))
}
}
\references{
-\url{http://www.boldsystems.org/index.php/resources/api#combined}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
}
-
diff --git a/man/bold_specimens.Rd b/man/bold_specimens.Rd
index d7a73e1..51319b1 100644
--- a/man/bold_specimens.Rd
+++ b/man/bold_specimens.Rd
@@ -9,34 +9,40 @@ bold_specimens(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
format = "tsv", ...)
}
\arguments{
-\item{taxon}{(character) Returns all records containing matching taxa. Taxa includes the ranks of
-phylum, class, order, family, subfamily, genus, and species.}
+\item{taxon}{(character) Returns all records containing matching taxa. Taxa
+includes the ranks of phylum, class, order, family, subfamily, genus,
+and species.}
-\item{ids}{(character) Returns all records containing matching IDs. IDs include Sample IDs,
-Process IDs, Museum IDs and Field IDs.}
+\item{ids}{(character) Returns all records containing matching IDs. IDs
+include Sample IDs, Process IDs, Museum IDs and Field IDs.}
-\item{bin}{(character) Returns all records contained in matching BINs. A BIN is defined by a
-Barcode Index Number URI.}
+\item{bin}{(character) Returns all records contained in matching BINs. A
+BIN is defined by a Barcode Index Number URI.}
-\item{container}{(character) Returns all records contained in matching projects or datasets.
-Containers include project codes and dataset codes}
+\item{container}{(character) Returns all records contained in matching
+projects or datasets. Containers include project codes and dataset codes}
-\item{institutions}{(character) Returns all records stored in matching institutions. Institutions
-are the Specimen Storing Site.}
+\item{institutions}{(character) Returns all records stored in matching
+institutions. Institutions are the Specimen Storing Site.}
-\item{researchers}{(character) Returns all records containing matching researcher names.
-Researchers include collectors and specimen identifiers.}
+\item{researchers}{(character) Returns all records containing matching
+researcher names. Researchers include collectors and specimen identifiers.}
-\item{geo}{(character) Returns all records collected in matching geographic sites. Geographic
-sites includes countries and province/states.}
+\item{geo}{(character) Returns all records collected in matching geographic
+sites. Geographic sites includes countries and province/states.}
-\item{response}{(logical) Note that response is the object that returns from the Curl call,
-useful for debugging, and getting detailed info on the API call.}
+\item{response}{(logical) Note that response is the object that returns
+from the Curl call, useful for debugging, and getting detailed info on
+the API call.}
-\item{format}{(character) One of xml or tsv (default). tsv format gives
-back a data.frame object. xml gives back parsed xml as a}
+\item{format}{(character) One of xml, json, tsv (default). tsv format gives
+back a data.frame object. xml gives back parsed XML as \code{xml_document}
+object. 'json' (JavaScript Object Notation) and 'dwc' (Darwin Core Archive)
+are supported in theory, but the JSON can be malformed, so we don't support
+that here, and the DWC option actually returns TSV.}
-\item{...}{Further args passed on to httr::GET, main purpose being curl debugging}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
}
\description{
Search BOLD for specimens.
@@ -45,11 +51,11 @@ Search BOLD for specimens.
\dontrun{
bold_specimens(taxon='Osmia')
bold_specimens(taxon='Osmia', format='xml')
-# bold_specimens(taxon='Osmia', response=TRUE)
+bold_specimens(taxon='Osmia', response=TRUE)
res <- bold_specimens(taxon='Osmia', format='xml', response=TRUE)
res$url
res$status_code
-res$headers
+res$response_headers
# More than 1 can be given for all search parameters
bold_specimens(taxon=c('Coelioxys','Osmia'))
@@ -57,13 +63,10 @@ bold_specimens(taxon=c('Coelioxys','Osmia'))
## curl debugging
### These examples below take a long time, so you can set a timeout so that
### it stops by X sec
-library("httr")
-head(bold_specimens(taxon='Osmia', config=verbose()))
-# head(bold_specimens(geo='Costa Rica', config=timeout(6)))
-# head(bold_specimens(taxon="Formicidae", geo="Canada", config=timeout(6)))
+head(bold_specimens(taxon='Osmia', verbose = TRUE))
+# head(bold_specimens(geo='Costa Rica', timeout_ms = 6))
}
}
\references{
-\url{http://www.boldsystems.org/index.php/resources/api#specimenParameters}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
}
-
diff --git a/man/bold_stats.Rd b/man/bold_stats.Rd
new file mode 100644
index 0000000..649ca40
--- /dev/null
+++ b/man/bold_stats.Rd
@@ -0,0 +1,83 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/bold_stats.R
+\name{bold_stats}
+\alias{bold_stats}
+\title{Get BOLD stats}
+\usage{
+bold_stats(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
+ institutions = NULL, researchers = NULL, geo = NULL,
+ dataType = "drill_down", response = FALSE, ...)
+}
+\arguments{
+\item{taxon}{(character) Returns all records containing matching taxa. Taxa
+includes the ranks of phylum, class, order, family, subfamily, genus,
+and species.}
+
+\item{ids}{(character) Returns all records containing matching IDs. IDs
+include Sample IDs, Process IDs, Museum IDs and Field IDs.}
+
+\item{bin}{(character) Returns all records contained in matching BINs. A
+BIN is defined by a Barcode Index Number URI.}
+
+\item{container}{(character) Returns all records contained in matching
+projects or datasets. Containers include project codes and dataset codes}
+
+\item{institutions}{(character) Returns all records stored in matching
+institutions. Institutions are the Specimen Storing Site.}
+
+\item{researchers}{(character) Returns all records containing matching
+researcher names. Researchers include collectors and specimen identifiers.}
+
+\item{geo}{(character) Returns all records collected in matching geographic
+sites. Geographic sites includes countries and province/states.}
+
+\item{dataType}{(character) one of "overview" or "drill_down" (default).
+"drill_down": a detailed summary of information which provides record
+counts by [BINs, Country, Storing Institution, Species]. "overview":
+the total counts of [BINs, Countries, Storing Institutions, Orders,
+Families, Genus, Species]}
+
+\item{response}{(logical) Note that response is the object that returns
+from the Curl call, useful for debugging, and getting detailed info on
+the API call.}
+
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
+}
+\description{
+Get BOLD stats
+}
+\examples{
+\dontrun{
+x <- bold_stats(taxon='Osmia')
+x$total_records
+x$records_with_species_name
+x$bins
+x$countries
+x$depositories
+x$order
+x$family
+x$genus
+x$species
+
+# just get all counts
+lapply(Filter(is.list, x), "[[", "count")
+
+res <- bold_stats(taxon='Osmia', response=TRUE)
+res$url
+res$status_code
+res$response_headers
+
+# More than 1 can be given for all search parameters
+bold_stats(taxon=c('Coelioxys','Osmia'))
+
+## curl debugging
+### These examples below take a long time, so you can set a timeout so that
+### it stops by X sec
+bold_stats(taxon='Osmia', verbose = TRUE)
+# bold_stats(geo='Costa Rica', timeout_ms = 6)
+}
+}
+\references{
+\url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
+}
diff --git a/man/bold_tax_id.Rd b/man/bold_tax_id.Rd
index 98010f8..c8881d9 100644
--- a/man/bold_tax_id.Rd
+++ b/man/bold_tax_id.Rd
@@ -17,10 +17,12 @@ returned. 'all' returns all data. 'basic' returns basic taxon information.
\item{includeTree}{(logical) If TRUE (default: FALSE), returns a list
containing information for parent taxa as well as the specified taxon.}
-\item{response}{(logical) Note that response is the object that returns from the Curl call,
-useful for debugging, and getting detailed info on the API call.}
+\item{response}{(logical) Note that response is the object that returns
+from the Curl call, useful for debugging, and getting detailed info on
+the API call.}
-\item{...}{Further args passed on to httr::GET, main purpose being curl debugging}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
}
\description{
Search BOLD for taxonomy data by BOLD ID.
@@ -39,8 +41,6 @@ bold_tax_id(id=88899, dataTypes = "images")
bold_tax_id(id=88899, dataTypes = "geo")
bold_tax_id(id=88899, dataTypes = "sequencinglabs")
bold_tax_id(id=88899, dataTypes = "depository")
-bold_tax_id(id=88899, dataTypes = "thirdparty")
-bold_tax_id(id=88899, dataTypes = "all")
bold_tax_id(id=c(88899,125295), dataTypes = "geo")
bold_tax_id(id=c(88899,125295), dataTypes = "images")
@@ -48,19 +48,17 @@ bold_tax_id(id=c(88899,125295), dataTypes = "images")
bold_tax_id(id = NA)
bold_tax_id(id = c(88899,125295,NA))
-## get httr response object only
+## get http response object only
bold_tax_id(id=88899, response=TRUE)
bold_tax_id(id=c(88899,125295), response=TRUE)
## curl debugging
-library('httr')
-bold_tax_id(id=88899, config=verbose())
+bold_tax_id(id=88899, verbose = TRUE)
}
}
\references{
-\url{http://boldsystems.org/index.php/resources/api?type=taxonomy}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=taxonomy}
}
\seealso{
\code{bold_tax_name}
}
-
diff --git a/man/bold_tax_name.Rd b/man/bold_tax_name.Rd
index a5831bb..e136559 100644
--- a/man/bold_tax_name.Rd
+++ b/man/bold_tax_name.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/bold_tax_name.R
\name{bold_tax_name}
\alias{bold_tax_name}
-\title{Search BOLD for taxonomy data by taxonomic name.}
+\title{Search BOLD for taxonomy data by taxonomic name}
\usage{
bold_tax_name(name, fuzzy = FALSE, response = FALSE, ...)
}
@@ -11,13 +11,15 @@ bold_tax_name(name, fuzzy = FALSE, response = FALSE, ...)
\item{fuzzy}{(logical) Whether to use fuzzy search or not (default: FALSE).}
-\item{response}{(logical) Note that response is the object that returns from the Curl call,
-useful for debugging, and getting detailed info on the API call.}
+\item{response}{(logical) Note that response is the object that returns
+from the Curl call, useful for debugging, and getting detailed info on
+the API call.}
-\item{...}{Further args passed on to httr::GET, main purpose being curl debugging}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}, main
+purpose being curl debugging}
}
\description{
-Search BOLD for taxonomy data by taxonomic name.
+Search BOLD for taxonomy data by taxonomic name
}
\details{
The \code{dataTypes} parameter is not supported in this function.
@@ -33,7 +35,7 @@ bold_tax_name(name=c("Apis","Puma concolor","Pinus concolor"))
bold_tax_name(name='Diplur', fuzzy=TRUE)
bold_tax_name(name='Osm', fuzzy=TRUE)
-## get httr response object only
+## get http response object only
bold_tax_name(name='Diplura', response=TRUE)
bold_tax_name(name=c('Diplura','Osmia'), response=TRUE)
@@ -43,14 +45,12 @@ bold_tax_name(name = "Cordulegaster erronea")
bold_tax_name(name = "Cordulegaster erronea", response=TRUE)
## curl debugging
-library('httr')
-bold_tax_name(name='Diplura', config=verbose())
+bold_tax_name(name='Diplura', verbose = TRUE)
}
}
\references{
-\url{http://boldsystems.org/index.php/resources/api?type=taxonomy}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=taxonomy}
}
\seealso{
\code{\link{bold_tax_id}}
}
-
diff --git a/man/bold_trace.Rd b/man/bold_trace.Rd
index 7e948b8..73d4137 100644
--- a/man/bold_trace.Rd
+++ b/man/bold_trace.Rd
@@ -12,38 +12,39 @@ bold_trace(taxon = NULL, ids = NULL, bin = NULL, container = NULL,
read_trace(x)
}
\arguments{
-\item{taxon}{(character) Returns all records containing matching taxa. Taxa includes the ranks of
-phylum, class, order, family, subfamily, genus, and species.}
+\item{taxon}{(character) Returns all records containing matching taxa. Taxa
+includes the ranks of phylum, class, order, family, subfamily, genus,
+and species.}
-\item{ids}{(character) Returns all records containing matching IDs. IDs include Sample IDs,
-Process IDs, Museum IDs and Field IDs.}
+\item{ids}{(character) Returns all records containing matching IDs. IDs
+include Sample IDs, Process IDs, Museum IDs and Field IDs.}
-\item{bin}{(character) Returns all records contained in matching BINs. A BIN is defined by a
-Barcode Index Number URI.}
+\item{bin}{(character) Returns all records contained in matching BINs. A
+BIN is defined by a Barcode Index Number URI.}
-\item{container}{(character) Returns all records contained in matching projects or datasets.
-Containers include project codes and dataset codes}
+\item{container}{(character) Returns all records contained in matching
+projects or datasets. Containers include project codes and dataset codes}
-\item{institutions}{(character) Returns all records stored in matching institutions. Institutions
-are the Specimen Storing Site.}
+\item{institutions}{(character) Returns all records stored in matching
+institutions. Institutions are the Specimen Storing Site.}
-\item{researchers}{(character) Returns all records containing matching researcher names.
-Researchers include collectors and specimen identifiers.}
+\item{researchers}{(character) Returns all records containing matching
+researcher names. Researchers include collectors and specimen identifiers.}
-\item{geo}{(character) Returns all records collected in matching geographic sites. Geographic
-sites includes countries and province/states.}
+\item{geo}{(character) Returns all records collected in matching geographic
+sites. Geographic sites includes countries and province/states.}
-\item{marker}{(character) Returns all records containing matching
+\item{marker}{(character) Returns all records containing matching
marker codes.}
\item{dest}{(character) A directory to write the files to}
\item{overwrite}{(logical) Overwrite existing directory and file?}
-\item{progress}{(logical) Print progress or not. Uses
-\code{\link[httr]{progress}}.}
+\item{progress}{(logical) Print progress or not. NOT AVAILABLE FOR NOW.
+HOPEFULLY WILL RETURN SOON.}
-\item{...}{Futher args passed on to \code{\link[httr]{GET}}.}
+\item{...}{Further args passed on to \code{\link[crul]{HttpClient}}}
\item{x}{Object to print or read.}
}
@@ -63,7 +64,7 @@ bold_trace(taxon='Bombus', geo='Alaska', dest="~/mytarfiles")
x <- bold_trace(ids=c('ACRJP618-11','ACRJP619-11'), dest="~/mytarfiles")
(res <- read_trace(x$ab1[2]))
-# The progress dialog is pretty verbose, so quiet=TRUE is a nice touch,
+# The progress dialog is pretty verbose, so quiet=TRUE is a nice touch,
# but not by default
# Beware, this one take a while
# x <- bold_trace(taxon='Osmia', quiet=TRUE)
@@ -77,6 +78,5 @@ if (requireNamespace("sangerseqR", quietly = TRUE)) {
}
}
\references{
-\url{http://www.boldsystems.org/index.php/resources/api#trace}
+\url{http://v4.boldsystems.org/index.php/resources/api?type=webservices}
}
-
diff --git a/man/sequences.Rd b/man/sequences.Rd
index 18399b8..ab05542 100644
--- a/man/sequences.Rd
+++ b/man/sequences.Rd
@@ -13,4 +13,3 @@ List of 3 nucleotide sequences to use in examples for the
Each sequence is a character string, of lengths 410, 600, and 696.
}
\keyword{data}
-
diff --git a/tests/testthat/test-bold_identify.R b/tests/testthat/test-bold_identify.R
index 2385d1e..a5591d2 100644
--- a/tests/testthat/test-bold_identify.R
+++ b/tests/testthat/test-bold_identify.R
@@ -25,7 +25,7 @@ test_that("bold_identify response param works as expected", {
aa <- bold_identify(seq, response = TRUE)
expect_is(aa, "list")
- expect_is(aa[[1]], "response")
+ expect_is(aa[[1]], "HttpResponse")
expect_equal(aa[[1]]$status_code, 200)
})
diff --git a/tests/testthat/test-bold_seq.R b/tests/testthat/test-bold_seq.R
index 5752b2f..349a323 100644
--- a/tests/testthat/test-bold_seq.R
+++ b/tests/testthat/test-bold_seq.R
@@ -9,7 +9,7 @@ test_that("bold_seq returns the correct dimensions/classes", {
c <- bold_seq(taxon='Coelioxys', response=TRUE)
expect_equal(c$status_code, 200)
- expect_equal(c$headers$`content-type`, "application/x-download")
+ expect_equal(c$response_headers$`content-type`, "application/x-download")
expect_is(a, "list")
expect_is(b, "list")
@@ -18,13 +18,13 @@ test_that("bold_seq returns the correct dimensions/classes", {
expect_is(a[[1]]$id, "character")
expect_is(a[[1]]$sequence, "character")
- expect_is(c, "response")
- expect_is(c$headers, "insensitive")
+ expect_is(c, "HttpResponse")
+ expect_is(c$response_headers, "list")
})
test_that("bold_seq returns correct error when parameters empty or not given", {
skip_on_cran()
- expect_error(bold_seq(taxon=''), "must provide a non-empty value")
+ expect_error(bold_seq(taxon = ''), "must provide a non-empty value")
expect_error(bold_seq(), "must provide a non-empty value")
})
diff --git a/tests/testthat/test-bold_seqspec.R b/tests/testthat/test-bold_seqspec.R
index 4c49fea..4af9486 100644
--- a/tests/testthat/test-bold_seqspec.R
+++ b/tests/testthat/test-bold_seqspec.R
@@ -9,10 +9,10 @@ test_that("bold_seqspec returns the correct dimensions or values", {
c <- bold_seqspec(taxon='Osmia', sepfasta=TRUE)
expect_equal(b$status_code, 200)
- expect_equal(b$headers$`content-type`, "application/x-download")
+ expect_equal(b$response_headers$`content-type`, "application/x-download")
expect_is(a, "data.frame")
- expect_is(b, "response")
+ expect_is(b, "HttpResponse")
expect_is(c, "list")
expect_is(c$data, "data.frame")
expect_is(c$fasta, "list")
@@ -21,7 +21,7 @@ test_that("bold_seqspec returns the correct dimensions or values", {
expect_is(a$recordID, "integer")
expect_is(a$directions, "character")
- expect_is(b$headers, "insensitive")
+ expect_is(b$response_headers, "list")
})
test_that("bold_seq returns correct error when parameters empty or not given", {
diff --git a/tests/testthat/test-bold_specimens.R b/tests/testthat/test-bold_specimens.R
index 374f4c2..da1a766 100644
--- a/tests/testthat/test-bold_specimens.R
+++ b/tests/testthat/test-bold_specimens.R
@@ -1,8 +1,6 @@
# tests for bold_specimens fxn in bold
context("bold_specimens")
-library("httr")
-
test_that("bold_specimens returns the correct dimensions or values", {
skip_on_cran()
@@ -10,21 +8,21 @@ test_that("bold_specimens returns the correct dimensions or values", {
b <- bold_specimens(taxon='Osmia', format='xml', response=TRUE)
expect_equal(b$status_code, 200)
- expect_equal(b$headers$`content-type`, "application/x-download")
+ expect_equal(b$response_headers$`content-type`, "application/x-download")
expect_is(a, "data.frame")
- expect_is(b, "response")
+ expect_is(b, "HttpResponse")
expect_is(a$recordID, "integer")
- expect_is(a$directions, "character")
+ expect_is(a$processid, "character")
- expect_is(b$headers, "insensitive")
+ expect_is(b$response_headers, "list")
})
test_that("Throws warning on call that takes forever including timeout in callopts", {
skip_on_cran()
- expect_error(bold_specimens(geo='Costa Rica', config=timeout(2)), "Timeout was reached")
+ expect_error(bold_specimens(geo='Costa Rica', timeout_ms = 2), "Timeout was reached")
})
test_that("bold_seq returns correct thing when parameters empty or not given", {
diff --git a/vignettes/bold_vignette.Rmd b/vignettes/bold_vignette.Rmd
index 5d5d2f9..1c8f594 100644
--- a/vignettes/bold_vignette.Rmd
+++ b/vignettes/bold_vignette.Rmd
@@ -11,7 +11,7 @@
### bold info
+ [BOLD home page](http://boldsystems.org/)
-+ [BOLD API docs](http://boldsystems.org/index.php/resources/api)
++ [BOLD API docs](http://v4.boldsystems.org/index.php/api_home)
### Using bold
@@ -101,27 +101,27 @@ bold_seq(taxon = 'Coelioxys')[1:2]
#> [[1]]
#> [[1]]$id
#> [1] "FBAPB491-09"
-#>
+#>
#> [[1]]$name
#> [1] "Coelioxys conica"
-#>
+#>
#> [[1]]$gene
#> [1] "FBAPB491-09"
-#>
+#>
#> [[1]]$sequence
#> [1] "---------------------ACCTCTTTAAGAATAATTATTCGTATAGAAATAAGAATTCCAGGATCTTGAATTAATAATGATCAAATTTATAACTCCTTTATTACAGCACATGCATTTTTAATAATTTTTTTTTTAGTTATACCTTTTCTTATTGGAGGATTTGGAAATTGATTAGTACCTTTAATATTAGGATCACCAGATATAGCTTTCCCACGAATAAATAATATTAGATTTTGATTATTACCTCCTTCTTTATTAATATTATTATTAAGTAATTTAATAAATCCCAGACCAGGAACAGGCTGAACAGTTTATCCTCCTTTATCTTTATACACATACCACCCTTCTCCCTCAGTTGATTTAGCAATTTTTTCACTACATCTATCAGGAATCTCTTCTATTATTGGATCTATAAATTTTATTGTTACAATTTTAATAATAAAAAACTTTTCAATAAATTATAATCAAATACCATTATTCC [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "FBAPC351-10"
-#>
+#>
#> [[2]]$name
#> [1] "Coelioxys afra"
-#>
+#>
#> [[2]]$gene
#> [1] "FBAPC351-10"
-#>
+#>
#> [[2]]$sequence
#> [1] "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ACGAATAAATAATGTAAGATTTTGACTATTACCTCCCTCAATTTTCTTATTATTATCAAGAACCCTAATTAACCCAAGAGCTGGTACTGGATGAACTGTATATCCTCCTTTATCCTTATATACATTTCATGCCTCACCTTCCGTTGATTTAGCAATTTTTTCACTTCATTTATCAGGAATTTCATCAATTATTGGATCAATAAATTTTATTGTTACAATCTTAATAATAAAAAATTTTTCTTTAAAT [...]
```
@@ -134,25 +134,25 @@ res <- bold_seq(taxon = 'Coelioxys', response = TRUE)
res$headers
#> $date
#> [1] "Tue, 15 Sep 2015 20:02:31 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"
```
@@ -165,69 +165,69 @@ bold_seq(geo = "USA")
#> [[1]]
#> [[1]]$id
#> [1] "GBAN1777-08"
-#>
+#>
#> [[1]]$name
#> [1] "Macrobdella decora"
-#>
+#>
#> [[1]]$gene
#> [1] "GBAN1777-08"
-#>
+#>
#> [[1]]$sequence
#> [1] "---------------------------------ATTGGAATCTTGTATTTCTTATTAGGTACATGATCTGCTATAGTAGGGACCTCTATA---AGAATAATTATTCGAATTGAATTAGCTCAACCTGGGTCGTTTTTAGGAAAT---GATCAAATTTACAATACTATTGTTACTGCTCATGGATTAATTATAATTTTTTTTATAGTAATACCTATTTTAATTGGAGGGTTTGGTAATTGATTAATTCCGCTAATA---ATTGGTTCTCCTGATATAGCTTTTCCACGTCTTAATAATTTAAGATTTTGATTACTTCCGCCATCTTTAACTATACTTTTTTGTTCATCTATAGTCGAAAATGGAGTAGGTACTGGATGGACTATTTACCCTCCTTTAGCAGATAACATTGCTCATTCTGGACCTTCTGTAGATATA---GCAATTTTTTCACTTCATTTAGCTGGTGCTTCTTCTATTTTAGGTT [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "GBAN1780-08"
-#>
+#>
#> [[2]]$name
#> [1] "Haemopis terrestris"
-#>
+#>
#> [[2]]$gene
#> [1] "GBAN1780-08"
-#>
+#>
#> [[2]]$sequence
#> [1] "---------------------------------ATTGGAACWTTWTATTTTATTTTNGGNGCTTGATCTGCTATATTNGGGATCTCAATA---AGGAATATTATTCGAATTGAGCCATCTCAACCTGGGAGATTATTAGGAAAT---GATCAATTATATAATTCATTAGTAACAGCTCATGGATTAATTATAATTTTCTTTATGGTTATGCCTATTTTGATTGGTGGGTTTGGTAATTGATTACTACCTTTAATA---ATTGGAGCCCCTGATATAGCTTTTCCTCGATTAAATAATTTAAGTTTTTGATTATTACCACCTTCATTAATTATATTGTTAAGATCCTCTATTATTGAAAGAGGGGTAGGTACAGGTTGAACCTTATATCCTCCTTTAGCAGATAGATTATTTCATTCAGGTCCATCGGTAGATATA---GCTATTTTTTCATTACATATAGCTGGAGCATCATCTATTTTAGGCT [...]
-#>
-#>
+#>
+#>
#> [[3]]
#> [[3]]$id
#> [1] "GBNM0293-06"
-#>
+#>
#> [[3]]$name
#> [1] "Steinernema carpocapsae"
-#>
+#>
#> [[3]]$gene
#> [1] "GBNM0293-06"
-#>
+#>
#> [[3]]$sequence
#> [1] "---------------------------------------------------------------------------------ACAAGATTATCTCTTATTATTCGTTTAGAGTTGGCTCAACCTGGTCTTCTTTTGGGTAAT---GGTCAATTATATAATTCTATTATTACTGCTCATGCTATTCTTATAATTTTTTTCATAGTTATACCTAGAATAATTGGTGGTTTTGGTAATTGAATATTACCTTTAATATTGGGGGCTCCTGATATAAGTTTTCCACGTTTGAATAATTTAAGTTTTTGATTGCTACCAACTGCTATATTTTTGATTTTAGATTCTTGTTTTGTTGACACTGGTTGTGGTACTAGTTGAACTGTTTATCCTCCTTTGAGG---ACTTTAGGTCACCCTGGYAGAAGTGTAGATTTAGCTATTTTTAGTCTTCATTGTGCAGGAATTAGCTCAATTTTAGGGGCTATTAATT [...]
-#>
-#>
+#>
+#>
#> [[4]]
#> [[4]]$id
#> [1] "NEONV108-11"
-#>
+#>
#> [[4]]$name
#> [1] "Aedes thelcter"
-#>
+#>
#> [[4]]$gene
#> [1] "NEONV108-11"
-#>
+#>
#> [[4]]$sequence
#> [1] "AACTTTATACTTCATCTTCGGAGTTTGATCAGGAATAGTTGGTACATCATTAAGAATTTTAATTCGTGCTGAATTAAGTCAACCAGGTATATTTATTGGAAATGACCAAATTTATAATGTAATTGTTACAGCTCATGCTTTTATTATAATTTTCTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGACTAGTTCCTCTAATATTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGTTTTTGAATACTACCTCCCTCATTAACTCTTCTACTTTCAAGTAGTATAGTAGAAAATGGATCAGGAACAGGATGAACAGTTTATCCACCTCTTTCATCTGGAACTGCTCATGCAGGAGCCTCTGTTGATTTAACTATTTTTTCTCTTCATTTAGCCGGAGTTTCATCAATTTTAGGGGCTGTAAATTTTATTACTACTGTAATTAATATACGATCTGCAGGAATTACT [...]
-#>
-#>
+#>
+#>
#> [[5]]
#> [[5]]$id
#> [1] "NEONV109-11"
-#>
+#>
#> [[5]]$name
#> [1] "Aedes thelcter"
-#>
+#>
#> [[5]]$gene
#> [1] "NEONV109-11"
-#>
+#>
#> [[5]]$sequence
#> [1] "AACTTTATACTTCATCTTCGGAGTTTGATCAGGAATAGTTGGTACATCATTAAGAATTTTAATTCGTGCTGAATTAAGTCAACCAGGTATATTTATTGGAAATGACCAAATTTATAATGTAATTGTTACAGCTCATGCTTTTATTATAATTTTCTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGACTAGTTCCTCTAATATTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAATAATATAAGTTTTTGAATACTACCTCCCTCATTAACTCTTCTACTTTCAAGTAGTATAGTAGAAAATGGGTCAGGAACAGGATGAACAGTTTATCCACCTCTTTCATCTGGAACTGCTCATGCAGGAGCCTCTGTTGATTTAACTATTTTTTCTCTTCATTTAGCCGGAGTTTCATCAATTTTAGGGGCTGTAAATTTTATTACTACTGTAATTAATATACGATCTGCAGGAATTACT [...]
```
@@ -239,13 +239,13 @@ And you can search by researcher name
bold_seq(researchers = 'Thibaud Decaens')[[1]]
#> $id
#> [1] "BGABA657-14"
-#>
+#>
#> $name
#> [1] "Coleoptera"
-#>
+#>
#> $gene
#> [1] "BGABA657-14"
-#>
+#>
#> $sequence
#> [1] "ACACTCTATTTCATTTTCGGAGCTTGATCAGGAATAGTAGGAACTTCTTTAAGAATACTAATTCGATCTGAATTGGGAAACCCCGGCTCATTGATTGGGGATGATCAAATTTATAATGTTATTGTAACAGCCCATGCATTCATTATAATTTTTTTTATAGTAATACCGATCATAATAGGAGGTTTTGGAAATTGATTAGTCCCGCTAATATTAGGTGCCCCAGATATAGCATTTCCTCGAATAAATAATATAAGATTTTGACTTCTTCCGCCTTCATTAACTTTACTTATTATAAGAAGAATTGTAGAAAACGGGGCGGGAACAGGATGAACAGTTTACCCACCCCTCTCTTCTAACATTGCTCATAGAGGAGCCTCTGTAGATCTTGCAATTTTTAGATTACATTTAGCCGGTGTATCATCAATTTTAGGTGCAGTTAATTTTATTACAACTATTATTAATATACGACCTAAAGGAATAACAT [...]
```
@@ -258,27 +258,27 @@ bold_seq(ids = c('ACRJP618-11', 'ACRJP619-11'))
#> [[1]]
#> [[1]]$id
#> [1] "ACRJP618-11"
-#>
+#>
#> [[1]]$name
#> [1] "Lepidoptera"
-#>
+#>
#> [[1]]$gene
#> [1] "ACRJP618-11"
-#>
+#>
#> [[1]]$sequence
#> [1] "------------------------TTGAGCAGGCATAGTAGGAACTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACAGTATAAAT [...]
-#>
-#>
+#>
+#>
#> [[2]]
#> [[2]]$id
#> [1] "ACRJP619-11"
-#>
+#>
#> [[2]]$name
#> [1] "Lepidoptera"
-#>
+#>
#> [[2]]$gene
#> [1] "ACRJP619-11"
-#>
+#>
#> [[2]]$sequence
#> [1] "AACTTTATATTTTATTTTTGGTATTTGAGCAGGCATAGTAGGAACTTCTCTTAGTCTTATTATTCGAACAGAATTAGGAAATCCAGGATTTTTAATTGGAGATGATCAAATCTACAATACTATTGTTACGGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGTAATTGATTAGTTCCCCTTATACTAGGAGCCCCAGATATAGCTTTCCCTCGAATAAACAATATAAGTTTTTGGCTTCTTCCCCCTTCACTATTACTTTTAATTTCCAGAAGAATTGTTGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCACTGTCATCTAATATTGCCCATAGAGGTACATCAGTAGATTTAGCTATTTTTTCTTTACATTTAGCAGGTATTTCCTCTATTTTAGGAGCGATTAATTTTATTACTACAATTATTAATATACGAATTAACAGTATAAAT [...]
```
@@ -290,13 +290,13 @@ by container (containers include project codes and dataset codes)
bold_seq(container = 'ACRJP')[[1]]
#> $id
#> [1] "ACRJP003-09"
-#>
+#>
#> $name
#> [1] "Lepidoptera"
-#>
+#>
#> $gene
#> [1] "ACRJP003-09"
-#>
+#>
#> $sequence
#> [1] "AACATTATATTTTATTTTTGGGATCTGATCTGGAATAGTAGGGACATCTTTAAGTATACTAATTCGAATAGAACTAGGAAATCCTGGATGTTTAATTGGGGATGATCAAATTTATAATACTATTGTTACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCCATTATAATTGGAGGTTTTGGCAATTGACTTGTACCATTAATATTAGGAGCCCCTGATATAGCATTTCCCCGAATAAATAATATAAGATTTTGACTTCTTCCCCCCTCATTAATTTTATTAATTTCAAGAAGAATTGTTGAAAATGGAGCAGGAACAGGATGAACAGTCTATCCTCCATTATCTTCTAATATTGCGCATAGAGGATCCTCTGTTGATTTAGCTATTTTCTCACTTCATTTAGCAGGAATTTCTTCTATTTTAGGAGCAATTAATTTTATTACAACTATTATTAATATACGAATAAATAATTTACTT [...]
```
@@ -308,13 +308,13 @@ by bin (a bin is a _Barcode Index Number_)
bold_seq(bin = 'BOLD:AAA5125')[[1]]
#> $id
#> [1] "BLPAB406-06"
-#>
+#>
#> $name
#> [1] "Eacles ormondei"
-#>
+#>
#> $gene
#> [1] "BLPAB406-06"
-#>
+#>
#> $sequence
#> [1] "AACTTTATATTTTATTTTTGGAATTTGAGCAGGTATAGTAGGAACTTCTTTAAGATTACTAATTCGAGCAGAATTAGGTACCCCCGGATCTTTAATTGGAGATGACCAAATTTATAATACCATTGTAACAGCTCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTATAATTGGAGGATTTGGAAATTGATTAGTACCCCTAATACTAGGAGCTCCTGATATAGCTTTCCCCCGAATAAATAATATAAGATTTTGACTATTACCCCCATCTTTAACTCTTTTAATTTCTAGAAGAATTGTCGAAAATGGAGCTGGAACTGGATGAACAGTTTATCCCCCCCTTTCATCTAATATTGCTCATGGAGGCTCTTCTGTTGATTTAGCTATTTTTTCCCTTCATCTAGCTGGAATCTCATCAATTTTAGGAGCTATTAATTTTATCACAACAATCATTAATATACGACTAAATAATATAATA [...]
```
@@ -376,33 +376,11 @@ You can choose to get the `httr` response object back if you'd rather work with
```r
res <- bold_specimens(taxon = 'Osmia', format = 'xml', response = TRUE)
res$url
-#> [1] "http://www.boldsystems.org/index.php/API_Public/specimen?taxon=Osmia&specimen_download=xml"
+#> [1] "http://v4.boldsystems.org/index.php/API_Public/specimen?taxon=Osmia&format=xml"
res$status_code
#> [1] 200
res$headers
-#> $date
-#> [1] "Mon, 28 Mar 2016 20:39:18 GMT"
-#>
-#> $server
-#> [1] "Apache/2.2.15 (Red Hat)"
-#>
-#> $`x-powered-by`
-#> [1] "PHP/5.3.15"
-#>
-#> $`content-disposition`
-#> [1] "attachment; filename=bold_data.xml"
-#>
-#> $connection
-#> [1] "close"
-#>
-#> $`transfer-encoding`
-#> [1] "chunked"
-#>
-#> $`content-type`
-#> [1] "application/x-download"
-#>
-#> attr(,"class")
-#> [1] "insensitive" "list"
+#> NULL
```
### Search for specimen plus sequence data
@@ -415,7 +393,7 @@ res <- bold_seqspec(taxon = 'Osmia', sepfasta = TRUE)
res$fasta[1:2]
#> $`ASGCB261-13`
#> [1] "AATTTTATATATAATTTTTGCTATATGATCAGGAATAATTGGTTCAGCAATAAGAATTATTATTCGAATAGAATTAAGAATTCCTGGTTCATGAATTTCAAATGATCAAACTTATAATTCTTTAGTTACTGCTCATGCTTTTTTAATAATTTTTTTCTTAGTTATACCATTCTTAATTGGGGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCAGATATAGCATTTCCACGAATAAATAATATTAGATTTTGACTTTTACCTCCTTCTTTAATACTTTTATTATTAAGAAATTTTATAAATCCTAGTCCAGGAACTGGATGAACTGTTTATCCACCTTTATCTTCTCATTTATTTCATTCTTCTCCTTCAGTTGATATAGCTATTTTTTCTTTACATATTTCTGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCTTTAAAA [...]
-#>
+#>
#> $`BCHYM1499-13`
#> [1] "AATTCTTTACATAATTTTTGCTTTATGATCTGGAATAATTGGGTCAGCAATAAGAATTATTATTCGAATAGAATTAAGTATCCCAGGTTCATGAATTACTAATGATCAAATTTATAATTCTTTAGTAACTGCACATGCTTTTTTAATAATTTTTTTTCTTGTGATACCATTTTTAATTGGAGGATTTGGAAATTGATTAATTCCTTTAATATTAGGAATTCCAGATATAGCTTTCCCACGAATAAACAATATTAGATTTTGATTATTACCGCCATCTTTAATATTATTACTTTTAAGAAATTTTTTAAATCCAAGTCCTGGAACAGGATGAACAGTTTATCCCCCTTTATCATCAAATTTATTTCATTCTTCTCCTTCAGTTGATTTAGCAATTTTTTCTTTACATATTTCAGGTTTATCTTCTATTATAGGTTCATTAAATTTTATTGTTACAATTATTATAATAAAAAATATTTCTTTAAAA [...]
```
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-bold.git
More information about the debian-med-commit
mailing list