From f29ee4c3ac1c4204cfc2658fca8a34c7da6d1f35 Mon Sep 17 00:00:00 2001 From: HelenaLC Date: Tue, 19 May 2026 21:43:14 +0200 Subject: [PATCH 1/2] use BiocGenerics::table --- R/SpatialData.R | 2 +- R/methods.R | 21 +++------------------ man/SpatialData.Rd | 4 +--- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/R/SpatialData.R b/R/SpatialData.R index 470cd1a..234e398 100644 --- a/R/SpatialData.R +++ b/R/SpatialData.R @@ -3,7 +3,7 @@ #' #' @aliases data meta #' @aliases layer element element<- -#' @aliases image label point shape table,ANY-method +#' @aliases image label point shape table #' @aliases images labels points shapes tables #' @aliases image<- label<- point<- shape<- table<- #' @aliases images<- labels<- points<- shapes<- tables<- diff --git a/R/methods.R b/R/methods.R index 78fb48b..6e26ef2 100644 --- a/R/methods.R +++ b/R/methods.R @@ -230,7 +230,8 @@ for (. in one) eval(f(.), parent.env(environment())) # get one ---- #' @name SpatialData -#' @exportMethod image label point shape +#' @importFrom BiocGenerics table +#' @exportMethod image label point shape table NULL .get <- \(y, i) { @@ -249,24 +250,8 @@ NULL y[[i]] } -#' @export -#' @name SpatialData -#' @importFrom BiocGenerics table -setMethod("table", "ANY", \(...) { - l <- list(...) - if (!is(l[[1]], "SpatialData")) - return(base::table(...)) - n <- length(l) - i <- if (n == 1) 1 else l[[2]] - m <- length(i) - if (n > 2 || m > 1) - stop("too many arguments") - y <- l[[1]]$tables - .get(y, i) -}) - .set <- \(.) setMethod(., "SpatialData", \(x, i=1) .get(x[[paste0(., "s")]], i)) -for (. in setdiff(one, "table")) eval(.set(.), parent.env(environment())) +for (. in one) eval(.set(.), parent.env(environment())) # set all ---- diff --git a/man/SpatialData.Rd b/man/SpatialData.Rd index 161b8fb..c107a3e 100644 --- a/man/SpatialData.Rd +++ b/man/SpatialData.Rd @@ -14,7 +14,7 @@ \alias{label} \alias{point} \alias{shape} -\alias{table,ANY-method} +\alias{table} \alias{images} \alias{labels} \alias{points} @@ -109,8 +109,6 @@ SpatialData(images, labels, points, shapes, tables) \S4method{tables}{SpatialData}(x) -\S4method{table}{ANY}(...) - \S4method{[[}{SpatialData,numeric,ANY}(x, i) <- value \S4method{[[}{SpatialData,character,ANY}(x, i) <- value From 9fd8785deb1b9820f16926adc9a0d52eda97d0c9 Mon Sep 17 00:00:00 2001 From: HelenaLC Date: Tue, 19 May 2026 21:51:50 +0200 Subject: [PATCH 2/2] v0.99.38 --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/sdFrame.R | 2 +- inst/NEWS | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b424d6d..2394c6d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: SpatialData Title: Representation of Python's SpatialData in R Depends: R (>= 4.6) -Version: 0.99.37 +Version: 0.99.38 Description: R interface to Python/scverse's 'spatialdata' framework for unified spatial omics data handling. Adheres to OME-NGFF standards, providing lazy, on-disk representations for multiscale images and diff --git a/NAMESPACE b/NAMESPACE index 76d7795..3c84afb 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -203,6 +203,7 @@ importFrom(sf,st_bbox) importFrom(sf,st_centroid) importFrom(sf,st_coordinates) importFrom(sf,st_geometry_type) +importFrom(sf,st_point) importFrom(sf,st_polygon) importFrom(sf,st_sf) importFrom(sf,st_sfc) diff --git a/R/sdFrame.R b/R/sdFrame.R index 36f00cd..4f56dd9 100644 --- a/R/sdFrame.R +++ b/R/sdFrame.R @@ -74,7 +74,7 @@ NULL # new ---- -#' @importFrom sf st_sf st_sfc st_as_sf st_polygon +#' @importFrom sf st_sf st_sfc st_as_sf st_point st_polygon .df_to_sf <- \(data, type=c("POINT", "POLYGON")) { type <- match.arg(type) if (is.null(data) || isTRUE(nrow(data) == 0)) { diff --git a/inst/NEWS b/inst/NEWS index f73b911..f8a030a 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,3 +1,7 @@ +changes in version 0.99.38 + +- use BiocGenerics::table + changes in version 0.99.37 - fix note regarding internal '.mask' generic