Skip to content

Commit

Permalink
Renamed SE saving options to align with alabaster.base's docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Feb 22, 2024
1 parent d19842f commit 583dc95
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: alabaster.se
Title: Load and Save SummarizedExperiments from File
Version: 1.3.3
Date: 2023-12-12
Version: 1.3.4
Date: 2024-02-21
Authors@R: person("Aaron", "Lun", role=c("aut", "cre"), email="[email protected]")
License: MIT + file LICENSE
Description:
Expand All @@ -27,7 +27,7 @@ Suggests:
testthat,
BiocStyle
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
biocViews:
DataImport,
DataRepresentation
8 changes: 4 additions & 4 deletions R/saveSummarizedExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @param x A \linkS4class{SummarizedExperiment} object or one of its subclasses.
#' @inheritParams alabaster.base::saveObject
#' @param summarizedexperiment.allow.dataframe.assay Logical scalar indicating whether to allow data frames as assays of \code{x}.
#' @param SummarizedExperiment.allow.dataframe.assay Logical scalar indicating whether to allow data frames as assays of \code{x}.
#' @param ... Further arguments to pass to internal \code{\link{altSaveObject}} calls.
#'
#' @return \code{x} is saved into \code{path} and \code{NULL} is invisibly returned.
Expand Down Expand Up @@ -44,15 +44,15 @@ NULL
#' @importFrom jsonlite toJSON
#' @import alabaster.base
#' @import methods
setMethod("saveObject", "SummarizedExperiment", function(x, path, summarizedexperiment.allow.dataframe.assay=FALSE, ...) {
setMethod("saveObject", "SummarizedExperiment", function(x, path, SummarizedExperiment.allow.dataframe.assay=FALSE, ...) {
dir.create(path)
saveObjectFile(
path,
"summarized_experiment",
list(summarized_experiment=list(version="1.0", dimensions=dim(x)))
)

args <- list(summarizedexperiment.allow.dataframe.assay=summarizedexperiment.allow.dataframe.assay, ...)
args <- list(SummarizedExperiment.allow.dataframe.assay=SummarizedExperiment.allow.dataframe.assay, ...)

cd <- colData(x)
empty.cd <- make_zero_col_DFrame(nrow(cd))
Expand Down Expand Up @@ -94,7 +94,7 @@ setMethod("saveObject", "SummarizedExperiment", function(x, path, summarizedexpe
aname <- as.character(i - 1L)
curmat <- all.assays[[i]]

if (is.data.frame(curmat) || (is(curmat, "DataFrame") && !summarizedexperiment.allow.dataframe.assay)) {
if (is.data.frame(curmat) || (is(curmat, "DataFrame") && !SummarizedExperiment.allow.dataframe.assay)) {
stop("assays should not contain data frames, see ?'saveObject,SummarizedExperiment-method'")
}

Expand Down
4 changes: 2 additions & 2 deletions man/saveSummarizedExperiment.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-SummarizedExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ test_that("stageObject handles data frames in the assays", {
expect_error(saveObject(se, tmp), "should not contain data frames")

tmp <- tempfile()
saveObject(se2, tmp, summarizedexperiment.allow.dataframe.assay=TRUE)
saveObject(se2, tmp, SummarizedExperiment.allow.dataframe.assay=TRUE)
out2 <- readObject(tmp)
expect_identical(assay(se2), assay(out2))
})
Expand Down

0 comments on commit 583dc95

Please sign in to comment.