Skip to content

Commit

Permalink
Add option to continue execution if MEME install is not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
HDash committed Oct 21, 2024
1 parent c69ef7f commit 1210b86
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.",
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion man/confirm_meme_install.Rd

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

0 comments on commit 1210b86

Please sign in to comment.