Skip to content

Comments

Switch FilterObjects to .FilterObjects#275

Merged
anashen merged 2 commits intosatijalab:mainfrom
bbimber:FilterObjects
Dec 17, 2025
Merged

Switch FilterObjects to .FilterObjects#275
anashen merged 2 commits intosatijalab:mainfrom
bbimber:FilterObjects

Conversation

@bbimber
Copy link
Contributor

@bbimber bbimber commented Dec 17, 2025

Hello,

I'm not sure how your branches work, so this might not be the right target. I would ideally like to see this as a bugfix to 5.3.0.

We just updated our docker images to SeuratObject 5.3.0 and Seurat 5.4. When doing a simple merge(), this results in this error. I think this is b/c SeuratObject is using FetchData, which is marked as deprecated_stop() in 5.0.0.

16 Dec 2025 18:43:25,993 DEBUG: 	  5.       └─CellMembrane:::.DoMergeSimple(...)
16 Dec 2025 18:43:26,005 DEBUG: 	  6.         ├─base::merge(...)
16 Dec 2025 18:43:26,010 DEBUG: 	  7.         └─SeuratObject:::merge.Seurat(...)
16 Dec 2025 18:43:26,016 DEBUG: 	  8.           ├─methods (local) `[[<-`(`*tmp*`, , value = `<df[,255]>`)
16 Dec 2025 18:43:26,021 DEBUG: 	  9.           └─SeuratObject (local) `[[<-`(`*tmp*`, , value = `<df[,255]>`)
16 Dec 2025 18:43:26,028 DEBUG: 	 10.             ├─methods (local) `[[<-`(`*tmp*`, names(x = value), value = `<df[,255]>`)
16 Dec 2025 18:43:26,033 DEBUG: 	 11.             └─SeuratObject (local) `[[<-`(`*tmp*`, names(x = value), value = `<df[,255]>`)
16 Dec 2025 18:43:26,039 DEBUG: 	 12.               ├─methods (local) `[[<-`(`*tmp*`, n, value = `<date>`)
16 Dec 2025 18:43:26,044 DEBUG: 	 13.               └─SeuratObject (local) `[[<-`(`*tmp*`, n, value = `<date>`)
16 Dec 2025 18:43:26,050 DEBUG: 	 14.                 ├─colnames(x = meta.data) %in% FilterObjects(object = x)
16 Dec 2025 18:43:26,055 DEBUG: 	 15.                 └─SeuratObject::FilterObjects(object = x)
16 Dec 2025 18:43:26,061 DEBUG: 	 16.                   └─SeuratObject::.Deprecate(...)
16 Dec 2025 18:43:26,068 DEBUG: 	 17.                     └─lifecycle::deprecate_stop(...)
16 Dec 2025 18:43:26,075 DEBUG: 	 18.                       └─lifecycle:::deprecate_stop0(msg)
16 Dec 2025 18:43:26,082 DEBUG: 	 19.                         └─rlang::cnd_signal(...)

@anashen anashen changed the base branch from v5.3-stable to main December 17, 2025 15:46
Copy link
Member

@anashen anashen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bbimber for the bug fix! Tested with example at satijalab/seurat#10251 (comment).


Notes: FilterObjects was deprecated and replaced with .FilterObjects in v5.0.0, marked as defunct in v5.3.0 (automatically via .Deprecate); #171 intended to replace all calls but missed the instances here. We reach the problematic condition on line 4093 only when adding metadata of an S3 class, hence routine testing did not find the defunction error.

@bbimber
Copy link
Contributor Author

bbimber commented Dec 17, 2025

@anashen: thank you. what is your release plan for bugfixes like this?

@anashen
Copy link
Member

anashen commented Dec 17, 2025

@bbimber I will get back to you on that. For urgent needs I would suggest either 1) downgrading, 2) installing the main branch via devtools::install_github after I've merged this PR shortly, or 3) converting the offending metadata into a factor before adding it to the Seurat object.

I modified the example you provided, and verified that this does not error:

createDummyObj <- function(minFeatures = 2) {
  #simulate a seurat object with all features
  features <- paste0('Gene-', 1:50)
  nCell <- 100
  mtx <- matrix(
    rpois(nCell * length(features), lambda = 2),
    ncol = nCell,
    nrow = length(features)
  )
  
  colnames(mtx) <- paste0("Cell-", seq_len(nCell))
  rownames(mtx) <- features
  
  seuratObj <- suppressWarnings(CreateSeuratObject(
    counts = mtx,
    min.cells = 3,
    min.features = minFeatures
  ))
  
  date_factor <- factor(as.Date('2020-01-01'))
  seuratObj$DateColumn<- date_factor
  seuratObj$MetaCol2 <- 'B'

  return(seuratObj)
}

seuratObj1 <- createDummyObj()
seuratObj2 <- createDummyObj()

seuratObjM <- merge(seuratObj1, seuratObj2)

@bbimber
Copy link
Contributor Author

bbimber commented Dec 17, 2025

Got it, thank you. And yes, we already downgraded to 5.2.0 in our CI and docker images

@anashen anashen merged commit 144d90a into satijalab:main Dec 17, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants