From cc95974ce33003e10b34c5af5f149c8e42c94d3a Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Fri, 28 Jun 2019 16:38:43 -0700 Subject: [PATCH] fix #115 - taxa_search only ncbi for now, stop() on db=traitbank for now use messages param instead of verbose passed to get_uid internally within ncbi_searcher --- R/ncbi_searcher.R | 6 +++--- R/taxa_search.R | 9 +++++---- man/taxa_search.Rd | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/R/ncbi_searcher.R b/R/ncbi_searcher.R index e40dc85..40830aa 100644 --- a/R/ncbi_searcher.R +++ b/R/ncbi_searcher.R @@ -74,7 +74,7 @@ ncbi_searcher <- function(taxa = NULL, id = NULL, seqrange="1:3000", # Convert 'taxa' to 'id' if 'taxa' is supplied --------------------------------------------------- if (is.null(id)) { - id <- get_uid(taxa, verbose = verbose) + id <- get_uid(taxa, messages = verbose) names(id) <- taxa } else { id <- as.character(id) @@ -185,12 +185,12 @@ get_parent <- function(id, verbose) { ancestry <- classification(id = id, db = "ncbi")[[1]] if (nrow(ancestry) > 1) { parent_name <- ancestry$name[nrow(ancestry) - 1] - return(get_uid(parent_name, verbose = verbose)) + return(get_uid(parent_name, messages = verbose)) } } if (!is.null(names(id)) && grepl(" ", names(id))) { #if a name is given and looks like a species parent_name <- strsplit(names(id), " ")[[1]][[1]] - return(get_uid(parent_name, verbose = verbose)) + return(get_uid(parent_name, messages = verbose)) } return(NA) } diff --git a/R/taxa_search.R b/R/taxa_search.R index 825f0cf..7101b6a 100644 --- a/R/taxa_search.R +++ b/R/taxa_search.R @@ -2,12 +2,12 @@ #' #' @export #' @param x (character) Taxonomic name(s) to search for -#' @param db (character) One of betydb, traitbank, ncbi, coral. +#' @param db (character) only 'ncbi' for now - other options +#' maybe in the future #' @param ... Curl options passed on to \code{\link[httr]{GET}} #' @return A \code{data.frame} #' @author Scott Chamberlain \email{myrmecocystus@@gmail.com} #' @examples \dontrun{ -#' taxa_search("Poa annua", db = "traitbank") #' taxa_search("Poa annua", db = "ncbi") #' } taxa_search <- function(x, db, ...) { @@ -26,8 +26,9 @@ taxa_search.character <- function(x, db, ...) { } switch(db, traitbank = { - id <- get_tb(x) - traitbank(pageid = id, ...) + stop("traitbank not working for now; see ?traits::traitbank") + # id <- get_tb(x) + # traitbank(pageid = id, ...) }, ncbi = { ncbi_searcher(taxa = x, ...) diff --git a/man/taxa_search.Rd b/man/taxa_search.Rd index a04931b..0fedc2c 100644 --- a/man/taxa_search.Rd +++ b/man/taxa_search.Rd @@ -9,7 +9,8 @@ taxa_search(x, db, ...) \arguments{ \item{x}{(character) Taxonomic name(s) to search for} -\item{db}{(character) One of betydb, traitbank, ncbi, coral.} +\item{db}{(character) only 'ncbi' for now - other options +maybe in the future} \item{...}{Curl options passed on to \code{\link[httr]{GET}}} } @@ -21,7 +22,6 @@ Search for traits by taxa names } \examples{ \dontrun{ -taxa_search("Poa annua", db = "traitbank") taxa_search("Poa annua", db = "ncbi") } }