Skip to content

Commit

Permalink
Skip scanning of gzipped file if zgrep is not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
joelnitta committed Aug 27, 2022
1 parent b3186b5 commit 3de4f95
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 8 additions & 2 deletions R/gb-setup-tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ gb_sql_add <- function(df) {
#' @param dpth Download path (where seq_files are stored)
#' @param seq_files .seq.tar seq file names
#' @param scan Logical vector of length 1; should the sequence file be scanned
#' for accessions in `acc_filter` prior to processing? Only used if
#' `acc_filter` is not NULL and `invert` is FALSE. Default FALSE.
#' for accessions in `acc_filter` prior to processing?
#' Requires zgrep to be installed (so does not work on Windows).
#' Only used if `acc_filter` is not NULL and `invert` is FALSE. Default FALSE.
#' @return Logical
#' @family private
gb_build <- function(
Expand Down Expand Up @@ -221,6 +222,11 @@ gb_build <- function(
#' @return Logical
#' @family private
search_gz <- function(terms, path) {
# Skip scan if no zgrep
if (nchar(Sys.which("zgrep")) == 0) {
warning("Cannot scan gzipped file without zgrep; skipping scan")
return(TRUE)
}
# There are a potentially large number of terms,
# so grepping works best with external files
temp_file <- tempfile()
Expand Down
5 changes: 3 additions & 2 deletions man/db_create.Rd

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

5 changes: 3 additions & 2 deletions man/gb_build.Rd

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

0 comments on commit 3de4f95

Please sign in to comment.