diff --git a/NEWS.md b/NEWS.md index a75e928..2d8c8f5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ * Replace `magrittr` import by `dplyr::%>%`. * Reduce the number of exported functions. * Move utility functions to 'utilities.R'. +* Allow vignettes to run without MEME suite installed. # MotifPeeker 0.99.4 diff --git a/R/utilities.R b/R/utilities.R index 604c43d..cb3f22a 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -191,6 +191,7 @@ check_dep <- function(pkg, fatal = TRUE, custom_msg = NULL){ #' Stop if MEME suite is not installed #' +#' @param continue Continue code execution if MEME suite is not installed. #' @inheritParams memes::runFimo #' #' @importFrom memes meme_is_installed @@ -200,8 +201,8 @@ check_dep <- function(pkg, fatal = TRUE, custom_msg = NULL){ #' @seealso \code{\link[memes]{check_meme_install}} #' #' @keywords internal -confirm_meme_install <- function(meme_path = NULL) { - stp_msg <- paste( +confirm_meme_install <- function(meme_path = NULL, continue = FALSE) { + msg <- paste( "Cannot find MEME suite installation. If installed, try setting the", "path", shQuote("MEME_BIN"), "environment varaible, or use the", shQuote("meme_path"), "parameter in the MotifPeeker function call.", @@ -210,8 +211,14 @@ confirm_meme_install <- function(meme_path = NULL) { ) if (!memes::meme_is_installed(meme_path)) { - stopper(stp_msg) + if (continue) { + messager(msg) + return(FALSE) + } else { + stopper(msg) + } } + return(TRUE) } #' Generate a random string diff --git a/man/confirm_meme_install.Rd b/man/confirm_meme_install.Rd index 68b7140..f7bc783 100644 --- a/man/confirm_meme_install.Rd +++ b/man/confirm_meme_install.Rd @@ -4,11 +4,13 @@ \alias{confirm_meme_install} \title{Stop if MEME suite is not installed} \usage{ -confirm_meme_install(meme_path = NULL) +confirm_meme_install(meme_path = NULL, continue = FALSE) } \arguments{ \item{meme_path}{path to \verb{meme/bin/} (optional). Defaut: \code{NULL}, searches "MEME_PATH" environment variable or "meme_path" option for path to "meme/bin/".} + +\item{continue}{Continue code execution if MEME suite is not installed.} } \value{ Null