Skip to content

Commit 5f76537

Browse files
committed
bug fix; allow more than one index when reading
1 parent 9a8c413 commit 5f76537

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

‎NAMESPACE‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@ importFrom(S7,new_S3_class)
4444
importFrom(S7,new_class)
4545
importFrom(S7,new_generic)
4646
importFrom(S7,new_union)
47-
importFrom(SingleCellExperiment,"int_colData<-")
4847
importFrom(SingleCellExperiment,"int_metadata<-")
49-
importFrom(SingleCellExperiment,int_colData)
5048
importFrom(SingleCellExperiment,int_metadata)
51-
importFrom(SummarizedExperiment,"colData<-")
5249
importFrom(SummarizedExperiment,colData)
5350
importFrom(anndataR,read_zarr)
5451
importFrom(arrow,open_dataset)

‎R/read.R‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,11 @@ readShape <- function(x, ...) {
107107

108108
#' @rdname readSpatialData
109109
#' @importFrom anndataR read_zarr
110+
#' @importFrom Rarr read_zarr_attributes
110111
#' @importFrom S4Vectors metadata metadata<-
111-
#' @importFrom SummarizedExperiment colData colData<-
112-
#' @importFrom SingleCellExperiment
113-
#' int_metadata int_metadata<-
114-
#' int_colData int_colData<-
112+
#' @importFrom SingleCellExperiment int_metadata int_metadata<-
115113
#' @export
116-
readTable <- function(x) {
114+
readTable <- \(x) {
117115
# suppress warnings related to hidden files
118116
za <- read_zarr_attributes(x)
119117
suppressWarnings(x <- read_zarr(x, as="SingleCellExperiment"))
@@ -147,8 +145,8 @@ readSpatialData <- \(x,
147145
j <- list.dirs(y, recursive=FALSE)
148146
names(j) <- basename(j)
149147
if (!isTRUE(opt <- args[[i]])) {
150-
if (is.numeric(opt) && opt > (. <- length(j)))
151-
stop("'", i, "=", opt, "', but only ", ., " elements found")
148+
if (is.numeric(opt) && any(opt > (. <- length(j))))
149+
stop("'", i, "=", opt, "', but found only ", .)
152150
if (is.character(opt) && length(. <- setdiff(opt, basename(j))))
153151
stop("couln't find ", i, " of name", .)
154152
j <- j[opt]

0 commit comments

Comments
 (0)