Skip to content

Commit

Permalink
Switched to JSON-formatted OBJECT file, based on alabaster.base updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Dec 13, 2023
1 parent e6e9fc5 commit 1db740a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions R/readArray.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#' Read a dense array from disk
#'
#' Read a dense high-dimensional array from its on-disk representation.
#' This is usually not directly called by users, but is instead called by dispatch in \code{\link{readObject}}.
#'
#' @param path String containing a path to a directory, itself created by the \code{\link{saveObject}} method for a dense array.
#' @param metadata Named list of metadata for this object, see \code{\link{readObject}} for more details.
#' @param array.output.type String specifying the output type for this function.
#' This can be \code{"array"} or \code{"ReloadedArray"} (the default).
#' @param ... Further arguments, ignored.
Expand All @@ -28,14 +30,14 @@
#'
#' dir <- tempfile()
#' saveObject(arr, dir)
#' readArray(dir)
#' readObject(dir)
#'
#' @export
#' @aliases
#' loadArray
#' @importFrom HDF5Array HDF5Array
#' @importFrom DelayedArray type<-
readArray <- function(path, array.output.type=NULL, ...) {
readArray <- function(path, metadata, array.output.type=NULL, ...) {
fpath <- file.path(path, "array.h5")

details <- local({
Expand Down
6 changes: 4 additions & 2 deletions R/readSparseMatrix.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#' Read a sparse matrix from disk
#'
#' Read a sparse matrix from its on-disk representation.
#' This is usually not directly called by users, but is instead called by dispatch in \code{\link{readObject}}.
#'
#' @param path String containing a path to a directory, itself created by the \code{\link{saveObject}} method for a spars matrix.
#' @param metadata Named list of metadata for this object, see \code{\link{readObject}} for more details.
#' @param sparsematrix.output.type String specifying the output type for this function.
#' This can be \code{"CsparseMatrix"}, \code{"SVT_SparseMatrix"} or \code{"ReloadedArray"} (the default).
#' @param ... Further arguments, ignored.
Expand All @@ -23,12 +25,12 @@
#' rownames(mat) <- paste0("GENE_", seq_len(nrow(mat)))
#' dir <- tempfile()
#' saveObject(mat, dir)
#' readSparseMatrix(dir)
#' readObject(dir)
#'
#' @export
#' @importFrom HDF5Array H5SparseMatrixSeed
#' @importFrom DelayedArray type<-
readSparseMatrix <- function(path, sparsematrix.output.type=NULL, ...) {
readSparseMatrix <- function(path, metadata, sparsematrix.output.type=NULL, ...) {
fpath <- file.path(path, "matrix.h5")
name <- "compressed_sparse_matrix"

Expand Down
2 changes: 1 addition & 1 deletion R/saveArray.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ NULL
}

save_names(ghandle, x, transpose=TRUE)
write(name, file=file.path(path, "OBJECT"))
saveObjectFile(path, name, list(dense_array=list(version="1.0")))
invisible(NULL)
}

Expand Down
2 changes: 1 addition & 1 deletion R/saveSparseMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ NULL
}

save_names(ghandle, x)
write(name, file=file.path(path, "OBJECT"))
saveObjectFile(path, name, list(compressed_sparse_matrix=list(version="1.0")))
invisible(NULL)
}

Expand Down
7 changes: 5 additions & 2 deletions man/readArray.Rd

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

7 changes: 5 additions & 2 deletions man/readSparseMatrix.Rd

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

0 comments on commit 1db740a

Please sign in to comment.