Skip to content

Commit

Permalink
use BiocBaseUtils::checkInstalled
Browse files Browse the repository at this point in the history
  • Loading branch information
LiNk-NY committed Dec 20, 2024
1 parent 7d6b9c4 commit 794b963
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions R/MultiAssayExperiment-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ setMethod("mergeReplicates", "ANY",
if (is(object, "SummarizedExperiment") || is(object, "RaggedExperiment"))
object <- assay(object, i = i)

if (!requireNamespace("reshape2", quietly = TRUE))
stop("Package 'reshape2' is required for 'longFormat()' conversion")
BiocBaseUtils::checkInstalled("reshape2")

res <- reshape2::melt(
object, varnames = c("rowname", "colname"), value.name = "value"
Expand Down
3 changes: 1 addition & 2 deletions R/MultiAssayExperimentToMAF.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
MultiAssayExperimentToMAF <-
function(x, synAssay = "maf_syn", nonSynAssay = "maf_nonSyn")
{
if (!requireNamespace("maftools", quietly = TRUE))
stop("Install the 'maftools' package to convert to MAF")
BiocBaseUtils::checkInstalled("maftools")

ns <- nonSynAssay %in% names(x)
sy <- synAssay %in% names(x)
Expand Down
4 changes: 2 additions & 2 deletions R/saveHDF5MultiAssayExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

.load_HDF5Array_package <- function()
{
if (!requireNamespace("HDF5Array", quietly=TRUE))
stop("Please install the 'HDF5Array' package to use this function")
BiocBaseUtils::checkInstalled("HDF5Array")
requireNamespace("HDF5Array", quietly = TRUE)
}

.isSingleString <- S4Vectors::isSingleString
Expand Down
3 changes: 1 addition & 2 deletions R/upsetSamples.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ upsetSamples <- function(
MultiAssayExperiment, nsets = NULL, sets = names(MultiAssayExperiment),
nintersects = NA_integer_, order.by = "freq", check.names = FALSE, ...
) {
if (!requireNamespace("UpSetR", quietly = TRUE))
stop("Please install the 'UpSetR' package to use 'upsetSamples()'")
BiocBaseUtils::checkInstalled("UpSetR")
mae <- MultiAssayExperiment
datf <- do.call(
function(...) { data.frame(..., check.names = check.names) },
Expand Down

0 comments on commit 794b963

Please sign in to comment.