Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/5.0.2 #205

Merged
merged 57 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
7955bda
Update maintainer and package URLs
mojaveazure Dec 20, 2023
5a2bc63
Minor fix
mojaveazure Dec 20, 2023
dbe367c
Add ORCID
mojaveazure Dec 21, 2023
bbc4cff
Merge pull request #174 from satijalab/feat/maintainer
mojaveazure Dec 22, 2023
1427775
Adjust imports and reexports from `Matrix`
mojaveazure Jan 5, 2024
174cda3
Update pin for `Matrix`
mojaveazure Jan 5, 2024
a2ee340
Merge pull request #176 from satijalab/feat/matrix-import-export
mojaveazure Jan 8, 2024
a0c75fd
Fix reexport of `%||%`
mojaveazure Jan 9, 2024
bad954e
Bump develop version
mojaveazure Jan 17, 2024
64a9f57
Merge pull request #178 from satijalab/fix/set-if-null
mojaveazure Jan 17, 2024
89bf440
Fixes error in UpdateSeuratObject due to missing global slot.
ddiez Jan 17, 2024
63ecbc4
Updates to keys
mojaveazure Jan 15, 2024
a6c8fc0
Updates to keys
mojaveazure Jan 15, 2024
be0bb06
Merge branch 'feat/key-updates' of github.com:satijalab/seurat-object…
mojaveazure Jan 19, 2024
01d9659
Update changelog
mojaveazure Jan 19, 2024
ee82ea7
Merge pull request #180 from satijalab/feat/key-updates
mojaveazure Jan 19, 2024
3b789c2
Merge branch 'develop' into fix_UpdateSeuratObject
mojaveazure Feb 15, 2024
e3dc827
Update changelog
mojaveazure Feb 16, 2024
87412bb
Merge pull request #182 from ddiez/fix_UpdateSeuratObject
mojaveazure Feb 16, 2024
b3d61a8
Add `...` to Radius generic
dcollins15 Mar 7, 2024
d6455e6
Update docs
dcollins15 Mar 20, 2024
eb4a02d
Bump version
dcollins15 Mar 20, 2024
6f4442f
Update NEWS
dcollins15 Mar 20, 2024
22af7b4
Add `...` to Radius.SpatialImage
dcollins15 Mar 22, 2024
47e110e
Add `...` to Radius.Centroids
dcollins15 Mar 22, 2024
e142146
Update docs
dcollins15 Mar 22, 2024
f683ac7
Merge pull request #190 from satijalab/feat/radius_params
dcollins15 Mar 24, 2024
8bcef10
Cleanup initialize.FOV
dcollins15 Mar 7, 2024
df7dee3
Bump version
dcollins15 Mar 17, 2024
ee5ea0c
Merge pull request #192 from satijalab/fix/cleanup_initialize_fov
dcollins15 Mar 24, 2024
fa37bd4
Bug fix in `PolyVtx()`
mojaveazure Mar 29, 2024
c2b5032
Update changelog
mojaveazure Apr 3, 2024
7bb1759
Merge pull request #194 from satijalab/fix/PolyVtx
mojaveazure Apr 3, 2024
308bd20
move feature-level metadata subsetting
Gesmira Apr 15, 2024
7625fec
bump version
Gesmira Apr 15, 2024
bad9626
Update NEWS.md
Gesmira Apr 16, 2024
0218527
Merge pull request #200 from satijalab/fix/subset_feat
Gesmira Apr 16, 2024
4c0a494
Use `packageVersion("SeuratObject")` in `UpdateSeuratObject()`
mojaveazure Apr 10, 2024
169cd32
Tidy NEWS
dcollins15 May 2, 2024
c813bf1
Update NEWS
dcollins15 May 2, 2024
37f2e5e
Bump version
dcollins15 May 2, 2024
ed0fb40
Merge pull request #199 from satijalab/fix/update-seurat-object
dcollins15 May 3, 2024
16dd7d5
Add warning if layer is absent from assay
maxim-h Mar 20, 2024
cf74503
Minor style edits
mojaveazure May 3, 2024
3d3c6b9
Update changelog
mojaveazure May 3, 2024
ceafa1e
Merge pull request #189 from maxim-h/patch-1
mojaveazure May 3, 2024
4ebb728
Fixup subset for multi-image Seurat instances
dcollins15 Apr 11, 2024
d08f3b2
Update NEWS
dcollins15 May 2, 2024
71fff33
Bump version
dcollins15 May 3, 2024
ddd6100
Merge pull request #204 from satijalab/fix/image_subset
dcollins15 May 4, 2024
4e1eef2
Update docstring for Radius generic
dcollins15 May 5, 2024
863eb39
Update NEWS
dcollins15 May 3, 2024
85a41dc
Update docs
dcollins15 May 3, 2024
6184784
Bump version
dcollins15 May 3, 2024
4d9de17
Update cran-comments
dcollins15 May 6, 2024
098fcfe
Fixup cran-comments.md
dcollins15 May 7, 2024
6be58e1
Fixup cran-comments... again
dcollins15 May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Package: SeuratObject
Type: Package
Title: Data Structures for Single Cell Data
Version: 5.0.1
Version: 5.0.2
Authors@R: c(
person(given = 'Rahul', family = 'Satija', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0001-9448-8833')),
person(given = 'Paul', family = 'Hoffman', email = '[email protected]', role = c('aut', 'cre'), comment = c(ORCID = '0000-0002-7693-8957')),
person(given = 'Paul', family = 'Hoffman', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0002-7693-8957')),
person(given = 'Rahul', family = 'Satija', email = '[email protected]', role = c('aut', 'cre'), comment = c(ORCID = '0000-0001-9448-8833')),
person(given = 'David', family = 'Collins', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0001-9243-7821')),
person(given = "Yuhan", family = "Hao", email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0002-1810-0822')),
person(given = "Austin", family = "Hartman", email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0001-7278-1852')),
person(given = "Gesmira", family = "Molla", email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0002-8628-5056')),
Expand All @@ -29,24 +30,24 @@ Description: Defines S4 classes for single-cell genomic data and associated
Hao Y, Hao S, et al (2021) <doi:10.1016/j.cell.2021.04.048> and
Hao Y, et al (2023) <doi:10.1101/2022.02.24.481684> for
more details.
URL: https://mojaveazure.github.io/seurat-object/,
https://github.com/mojaveazure/seurat-object
BugReports: https://github.com/mojaveazure/seurat-object/issues
URL: https://satijalab.github.io/seurat-object/,
https://github.com/satijalab/seurat-object
BugReports: https://github.com/satijalab/seurat-object/issues
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Additional_repositories:
https://bnprks.r-universe.dev
Depends:
R (>= 4.0.0),
R (>= 4.1.0),
sp (>= 1.5.0)
Imports:
future,
future.apply,
grDevices,
grid,
Matrix (>= 1.6.3),
Matrix (>= 1.6.4),
methods,
progressr,
Rcpp (>= 1.0.5),
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ export(Degrees)
export(Distances)
export(Embeddings)
export(EmptyDF)
export(EmptyMatrix)
export(ExtractField)
export(Features)
export(FetchData)
Expand Down Expand Up @@ -506,6 +507,7 @@ export(as.sparse)
export(handlers)
export(intersect)
export(plan)
export(t)
export(with_progress)
exportClasses(Assay)
exportClasses(Assay5)
Expand Down Expand Up @@ -622,7 +624,6 @@ importFrom(sp,SpatialPolygons)
importFrom(sp,bbox)
importFrom(sp,coordinates)
importFrom(sp,over)
importFrom(spam,t)
importFrom(stats,aggregate)
importFrom(stats,median)
importFrom(stats,na.omit)
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# SeuratObject 5.0.2

## Changes:
- Properly re-export `%||%` from rlang (#178)
- Class key-based warnings (#180)
- Require R 4.1 (#180)
- Fix errors in `UpdateSeuratObject` (@ddiez, #182)
- Add `...` to call signature for `Radius` generic (#190)
- Fix bug in `PolyVtx` (#194)
- Fix bug in feature-level subsetting (#200)
- Update `UpdateSeuratObject` to run without `Seurat` installed (#199)
- Add warning in `Layers.Assay()` when the search returns no results (@maxim-h, #189)
- Fix bug in `subset` to allow empty images to be dropped (#204)

# SeuratObject 5.0.1

## Changes:
Expand Down
9 changes: 9 additions & 0 deletions R/assay.R
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,15 @@ Layers.Assay <- function(object, search = NA, ...) {
if (!is_na(x = search)) {
layers <- intersect(x = search, y = layers)
if (length(x = layers) == 0) {
warning(
"Layer ",
search,
" isn't present in the assay ",
deparse(expr = substitute(expr = object)),
"; returning NULL",
call. = FALSE,
immediate. = TRUE
)
return(NULL)
}
}
Expand Down
12 changes: 6 additions & 6 deletions R/assay5.R
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,12 @@ subset.StdAssay <- function(
for (lyr in setdiff(x = layers.all, y = layers)) {
LayerData(object = x, layer = lyr) <- NULL
}
# Subset feature-level metadata
mfeatures <- MatchCells(
new = Features(x = x, layer = NA),
orig = features,
ordered = TRUE
)
# Perform the subsets
for (l in layers) {
lcells <- MatchCells(
Expand Down Expand Up @@ -2442,12 +2448,6 @@ subset.StdAssay <- function(
for (i in c('cells', 'features')) {
slot(object = x, name = i) <- droplevels(x = slot(object = x, name = i))
}
# Subset feature-level metadata
mfeatures <- MatchCells(
new = Features(x = x, layer = NA),
orig = features,
ordered = TRUE
)
slot(object = x, name = 'meta.data') <- slot(
object = x,
name = 'meta.data'
Expand Down
2 changes: 1 addition & 1 deletion R/centroids.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ GetTissueCoordinates.Centroids <- function(object, full = TRUE, ...) {
#' @method Radius Centroids
#' @export
#'
Radius.Centroids <- function(object) {
Radius.Centroids <- function(object, ...) {
return(slot(object = object, name = 'radius'))
}

Expand Down
7 changes: 1 addition & 6 deletions R/fov.R
Original file line number Diff line number Diff line change
Expand Up @@ -904,13 +904,8 @@ setMethod(
setMethod(
f = 'initialize',
signature = 'FOV',
definition = function(.Object, molecules, boundaries, assay, key, ...) {
definition = function(.Object, ...) {
.Object <- callNextMethod(.Object, ...)
slot(object = .Object, name = 'molecules') <- molecules
slot(object = .Object, name = 'boundaries') <- boundaries
slot(object = .Object, name = 'assay') <- assay
slot(object = .Object, name = 'key') <- key
# Reorder cells in boundaries
.Object <- .OrderCells(object = .Object)
validObject(object = .Object)
return(.Object)
Expand Down
5 changes: 4 additions & 1 deletion R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,8 @@ IsGlobal <- function(object, ...) {
#'
#' @concept utils
#'
#' @seealso \code{\link{EmptyMatrix}()}
#'
#' @examples
#' IsMatrixEmpty(new("matrix"))
#' IsMatrixEmpty(matrix())
Expand Down Expand Up @@ -1273,6 +1275,7 @@ Project <- function(object, ...) {
#' Get the spot radius from an image
#'
#' @param object An image object
#' @param ... Arguments passed to other methods
#'
#' @return The radius size
#'
Expand All @@ -1281,7 +1284,7 @@ Project <- function(object, ...) {
#'
#' @concept spatialimage
#'
Radius <- function(object) {
Radius <- function(object, ...) {
UseMethod(generic = 'Radius', object = object)
}

Expand Down
146 changes: 83 additions & 63 deletions R/keymixin.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ setClass(
#'
#' @family key
#'
.KeyPattern <- function() {
return('^[a-zA-Z][a-zA-Z0-9]*_$')
}
.KeyPattern <- \() '^[a-zA-Z][a-zA-Z0-9]*_$'

#' Generate a Random Key
#'
Expand All @@ -63,24 +61,22 @@ setClass(
#' set.seed(42L)
#' .RandomKey()
#'
.RandomKey <- function(length = 7L, ...) {
return(Key(
object = RandomName(
length = length,
chars = c(letters, LETTERS, seq.int(from = 0L, to = 9L)),
...
),
quiet = TRUE
))
}
.RandomKey <- \(length = 7L, ...) Key(
object = RandomName(
length = length,
chars = c(letters, LETTERS, seq.int(from = 0L, to = 9L)),
...
),
quiet = TRUE
)

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Methods for Seurat-defined generics
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#' @param object An object
#' @param quiet Suppress warnings when updating characters to keys
#' @param ... Ignored
#' @param quiet Suppress warnings when updating characters to keys
#' @param value A key to set
#'
#' @details \code{Key.character}: Update a character to a key
Expand All @@ -91,10 +87,14 @@ setClass(
#' @method Key character
#' @export
#'
Key.character <- function(object, quiet = FALSE, ...) {
f <- ifelse(test = isTRUE(x = quiet), yes = suppressWarnings, no = identity)
return(f(UpdateKey(key = object)))
}
Key.character <- \(object, ..., quiet = FALSE) withCallingHandlers(
expr = UpdateKey(key = object),
updatedKeyWarning = \(cnd) tryInvokeRestart(r = ifelse(
test = isTRUE(x = quiet),
yes = 'muffleWarning',
no = RandomName()
))
)

#' @details \code{Key.KeyMixin}: Get the key of a keyed object
#'
Expand Down Expand Up @@ -130,9 +130,7 @@ Key.KeyMixin <- function(object, ...) {
#' @method Key NULL
#' @export
#'
Key.NULL <- function(object, ...) {
return(NULL)
}
Key.NULL <- \(object, ...) NULL

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Methods for R-defined generics
Expand All @@ -142,6 +140,57 @@ Key.NULL <- function(object, ...) {
# Internal
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#' Check Usage of Existing Keys
#'
#' Check key usage against existing keys to ensure key uniqueness
#'
#' @param key Existing key to check usage of; if missing, creates a
#' key from \code{name}
#' @param existing A vector of existing keys to match against \code{key}
#' @param name Name of object that \code{key} is used for; if provided and
#' \code{existing} is named, the entry of \code{existing} for \code{name} is
#' removed from the check
#'
#' @return A key guaranteed to be unique in the context of \code{existing}
#'
#' @keywords internal
#'
#' @noRd
#'
.CheckKey <- function(key, existing = NULL, name = NULL) {
if (rlang::is_missing(x = key) || !length(x = key) || !nzchar(x = key)) {
key <- Key(object = tolower(name) %||% RandomName(), quiet = TRUE)
}
key <- Key(object = key, quiet = TRUE)
if (!is.null(x = names(x = existing)) && !is.null(x = name)) {
existing <- existing[setdiff(x = names(x = existing), y = name)]
}
if (key %in% existing) {
old <- key
key <- Key(object = tolower(x = name %||% RandomName()), quiet = TRUE)
i <- 1L
n <- 5L
while (key %in% existing) {
key <- Key(object = RandomName(length = n), quiet = TRUE)
i <- i + 1L
if (!i %% 7L) {
n <- n + 2L
}
}
warn(
message = paste(
"Key",
sQuote(x = old),
"taken, using",
sQuote(x = key),
"instead"
),
class = 'existingKeyWarning'
)
}
return(key)
}

#' Internal Key Methods
#'
#' Internal key methods for classes that inherit from \code{\link{KeyMixin}};
Expand Down Expand Up @@ -199,18 +248,21 @@ UpdateKey <- function(key) {
if (new.key == '_') {
new.key <- paste0(RandomName(length = 3), '_')
}
warning(
key.msg,
", setting key from ",
key,
" to ",
new.key,
call. = FALSE,
immediate. = TRUE
warn(
message = paste0(
key.msg,
", setting key from ",
key,
" to ",
new.key
),
class = 'updatedKeyWarning'
)
return(new.key)
}

.MetaKey <- Key(object = 'md', quiet = TRUE)

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# S4 methods
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand All @@ -224,7 +276,7 @@ UpdateKey <- function(key) {
#' Keys must be a one-length character vector; a key must be composed of one
#' of the following:
#' \itemize{
#' \item An empty string (eg. \dQuote{\code{''}}) where \code{nzchar() == 0}
#' \item An empty string (eg. \dQuote{\code{''}}) where \code{nchar() == 0}
#' \item An string composed of one or more alphanumeric values
#' (both lower- and upper-case) that ends with an underscore
#' (\dQuote{\code{_}}); the first character must be a letter
Expand Down Expand Up @@ -262,42 +314,10 @@ setValidity(
# Ensure proper key composition
valid <- c(
valid,
paste0("Keys must match the pattern '", .KeyPattern(), "'")
paste("Keys must match the pattern", sQuote(x = .KeyPattern()))
)
}
}
return(valid %||% TRUE)
}
)

.CheckKey <- function(key, existing = NULL, name = NULL) {
if (rlang::is_missing(x = key) || !length(x = key) || !nzchar(x = key)) {
key <- Key(object = tolower(name) %||% RandomName(), quiet = TRUE)
}
if (!is.null(x = names(x = existing)) && !is.null(x = name)) {
existing <- existing[setdiff(x = names(x = existing), y = name)]
}
if (key %in% existing) {
old <- key
key <- Key(object = tolower(x = name %||% RandomName()), quiet = TRUE)
i <- 1L
n <- 5L
while (key %in% existing) {
key <- Key(object = RandomName(length = n), quiet = TRUE)
i <- i + 1L
if (!i %% 7L) {
n <- n + 2L
}
}
warn(
message = paste(
"Key",
sQuote(x = old),
"taken, using",
sQuote(x = key),
"instead"
)
)
}
return(key)
}
Loading
Loading