Skip to content

Compatibility issue with SeuratObject 5.x: slot argument defunct in GetAssayData() #2

@RosyGH

Description

@RosyGH

Hi SpatialCellChat team,
I'm encountering a compatibility issue between SpatialCellChat and the latest SeuratObject 5.x. Here's the problem:
Environment
R version: 4.5
SeuratObject: 5.3.0
Seurat: 5.4.0
SpatialCellChat: latest version from GitHub

When running createSpatialCellChat() with SeuratObject 5.x, I get the following error:

chat <- createSpatialCellChat(
  object = seu, # Seurat
  group.by = "final.clusters",
  assay = "Spatial", # normalized
  datatype = "spatial",
  coordinates = spatial.locs,
  spatial.factors = spatial.factors
)

chat
Error:
! The `slot` argument of `GetAssayData()` was deprecated in SeuratObject
  5.0.0 and is now defunct.
i Please use the `layer` argument instead.
Traceback:

1. Seurat::GetAssayData(object, assay = assay, slot = "data")
2. GetAssayData.Seurat(object, assay = assay, slot = "data")
3. .Deprecate(when = "5.0.0", what = "GetAssayData(slot = )", with = "GetAssayData(layer = )")
4. deprecate_stop(when = wv, what = what, with = with, env = caller, 
 .     ...)
5. deprecate_stop0(msg)
6. cnd_signal(error_cnd(c("lifecycle_error_deprecated", "defunctError"), 
 .     old = NULL, new = NULL, package = NULL, message = msg))
7. signal_abort(cnd)
8. signalCondition(cnd)

Attempted Workaround
I tried downgrading SeuratObject to version 4.1.4 to avoid this issue. However, after downgrading, I cannot load SpatialCellChat at all:

Error: package or namespace load failed for 'SpatialCellChat':
 object 'DefaultLayer<-' is not exported by 'namespace:SeuratObject'
Traceback:

1. tryCatch({
 .     attr(package, "LibPath") <- which.lib.loc
 .     ns <- loadNamespace(package, lib.loc)
 .     env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
 . }, error = function(e) {
 .     P <- if (!is.null(cc <- conditionCall(e))) 
 .         paste(" in", deparse(cc)[1L])
 .     else ""
 .     msg <- gettextf("package or namespace load failed for %s%s:\n %s", 
 .         sQuote(package), P, conditionMessage(e))
 .     if (logical.return && !quietly) 
 .         message(paste("Error:", msg), domain = NA)
 .     else stop(msg, call. = FALSE, domain = NA)
 . })
2. tryCatchList(expr, classes, parentenv, handlers)
3. tryCatchOne(expr, names, parentenv, handlers[[1L]])
4. value[[3L]](cond)
5. stop(msg, call. = FALSE, domain = NA)
6. .handleSimpleError(function (cnd) 
 . {
 .     watcher$capture_plot_and_output()
 .     cnd <- sanitize_call(cnd)
 .     watcher$push(cnd)
 .     switch(on_error, continue = invokeRestart("eval_continue"), 
 .         stop = invokeRestart("eval_stop"), error = NULL)
 . }, "package or namespace load failed for 'SpatialCellChat':\n object 'DefaultLayer<-' is not exported by 'namespace:SeuratObject'", 
 .     base::quote(NULL))

Could you please provide guidance on which version combination works currently?
Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions