Skip to content

Commit

Permalink
Fix download_button() error when downloadthis package is not avai…
Browse files Browse the repository at this point in the history
…lable
  • Loading branch information
HDash committed Nov 6, 2024
1 parent 8758def commit bbd48e3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: MotifPeeker
Title: Benchmarking Epigenomic Profiling Methods Using Motif Enrichment
Version: 0.99.8
Version: 0.99.9
Authors@R: c(
person(given = "Hiranyamaya",
family = "Dash",
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# MotifPeeker 0.99.9

## Bug Fixes

* Fix `download_button()` error when `downloadthis` package is not available.


# MotifPeeker 0.99.8

## Miscellaneous
Expand Down
4 changes: 3 additions & 1 deletion R/download_button.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ download_button <- function(path,
wrn_msg <- paste("Package", shQuote("downloadthis"), "is required to",
"add download buttons to the HTML report. Skipping",
"download buttons...")
check_dep("downloadthis", fatal = FALSE, custom_msg = wrn_msg)
if (!check_dep("downloadthis", fatal = FALSE, custom_msg = wrn_msg)) {
return(NULL)
}

btn_args <- list(
path = path,
Expand Down
5 changes: 4 additions & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ check_duplicates <- function(x) {
#' package is not attached.
#' @param custom_msg a custom message to display if the package is not attached.
#'
#' @returns Null
#' @returns TRUE if the package is available or else FALSE if
#' \code{fatal = FALSE}.
#'
#' @keywords internal
check_dep <- function(pkg, fatal = TRUE, custom_msg = NULL){
Expand All @@ -173,8 +174,10 @@ check_dep <- function(pkg, fatal = TRUE, custom_msg = NULL){
stop(custom_msg)
} else {
warning(custom_msg)
return(FALSE)
}
}
return(TRUE)
}

#' Stop if MEME suite is not installed
Expand Down
3 changes: 2 additions & 1 deletion man/check_dep.Rd

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

0 comments on commit bbd48e3

Please sign in to comment.