Skip to content

Commit

Permalink
Rename ncbi_supported_dbs() to ncbi_dbs()
Browse files Browse the repository at this point in the history
  • Loading branch information
stitam committed Dec 11, 2023
1 parent c88b19d commit 62a697f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions R/link_uid.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#' This function links uids from one database with uids from another.
#' @param query character; a vector of uids.
#' @param from character; the database the queried uids come from.
#' \code{ncbi_supported_dbs()} lists all available options.
#' \code{ncbi_dbs()} lists all available options.
#' @param to character; the database in which the function should look for links.
#' @param cache_file character; the name of the cache file without the file
#' extension. If \code{NULL}, results are not cached.
#' @param verbose logical; should verbos messages be printed to the console?
#' \code{ncbi_supported_dbs()} lists all available options.
#' \code{ncbi_dbs()} lists all available options.
#' @return A tibble
#' @examples
#' \dontrun{
Expand All @@ -27,8 +27,8 @@ link_uid <- function(query,
if (any(is.na(as.numeric(query)))) {
stop("Query must be a valid UID. Valid UIDs can be converted to 'numeric'.")
}
from <- match.arg(from, ncbi_supported_dbs())
to <- match.arg(to, ncbi_supported_dbs())
from <- match.arg(from, ncbi_dbs())
to <- match.arg(to, ncbi_dbs())
foo <- function(x) {
if (verbose) webseq_message("query", x, appendLF = FALSE)
res <- NULL
Expand Down
2 changes: 1 addition & 1 deletion R/ncbi_supported_dbs.R → R/ncbi_dbs.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ncbi_supported_dbs <- function() {
ncbi_dbs <- function() {
if (!dir.exists(tempdir())) dir.create(tempdir())
if (!file.exists(paste0(tempdir(), "/webseq.rds"))) {
dbs <- rentrez::entrez_dbs()
Expand Down
4 changes: 2 additions & 2 deletions R/ncbi_get_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' This function retrieves metadata from a given NCBI sequence database.
#' @param term character; one or more search terms.
#' @param db character; the database to search in. For options see
#' \code{ncbi_supported_dbs()}. Not all databases are supported.
#' \code{ncbi_dbs()}. Not all databases are supported.
#' @param batch_size integer; the number of search terms to query at once. If
#' the number of search terms is larger than \code{batch_size}, the search terms
#' are split into batches and queried separately.
Expand Down Expand Up @@ -34,7 +34,7 @@ ncbi_get_meta <- function(
parse = TRUE,
verbose = getOption("verbose")
) {
db <- match.arg(db, choices = ncbi_supported_dbs())
db <- match.arg(db, choices = ncbi_dbs())
uids <- ncbi_get_uid(
term = term,
db = db,
Expand Down
4 changes: 2 additions & 2 deletions R/ncbi_get_uid.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' in other NCBI databases or to retrieve the data itself.
#' @param term character; one or more search terms.
#' @param db character; the database to search in. For options see
#' \code{ncbi_supported_dbs()}
#' \code{ncbi_dbs()}
#' @param batch_size integer; the number of search terms to query at once. If
#' the number of search terms is larger than \code{batch_size}, the search terms
#' are split into batches and queried separately.
Expand Down Expand Up @@ -36,7 +36,7 @@ ncbi_get_uid <- function(
use_history = TRUE,
verbose = getOption("verbose")
) {
db <- match.arg(db, choices = ncbi_supported_dbs())
db <- match.arg(db, choices = ncbi_dbs())
if (all(is.na(term))) {
stop("No valid search terms.")
} else if (any(is.na(term))){
Expand Down
4 changes: 2 additions & 2 deletions man/link_uid.Rd

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

2 changes: 1 addition & 1 deletion man/ncbi_get_meta.Rd

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

2 changes: 1 addition & 1 deletion man/ncbi_get_uid.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-ncbi_get_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_that("ncbi_get_meta() works with Microthrix parvicella", {
test_that("ncbi_get_meta() works with all supported dbs", {
data(examples)

expect_true(all(names(examples) %in% ncbi_supported_dbs()))
expect_true(all(names(examples) %in% ncbi_dbs()))

for (i in names(examples)) {
res <- suppressWarnings(ncbi_get_meta(examples[[i]], db = i, parse = FALSE))
Expand Down

0 comments on commit 62a697f

Please sign in to comment.