seurat icon indicating copy to clipboard operation
seurat copied to clipboard

s[['pca']] <- CreateDimReducObject Calls ERROR: [[<- -> [[<- -> Key -> Key.Seurat -> vapply

Open Bio-MingChen opened this issue 2 years ago • 2 comments

I run demo script below and get the error

library(Seurat)

s <- readRDS('pbmc_predicted.rds')

data <- GetAssayData(s[["RNA"]], slot = "scale.data")

pcs <- prcomp(x = data)
print(str(pcs))

s[['pca']] <- CreateDimReducObject(
  embeddings = pcs$rotation,
  loadings = pcs$x,
  stdev = pcs$sdev,
  key = "PC",
  assay = "RNA"
)

print(str(s))

Error: Attaching SeuratObject Attaching sp Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from PC to PC_ Warning: All keys should be one or more alphanumeric characters followed by an underscore '', setting key to PC Error in vapply(X = keyed.objects, FUN = function(x) { : values must be length 1, but FUN(X[[1]]) result is length 0 Calls: [[<- -> [[<- -> Key -> Key.Seurat -> vapply Execution halted

Any idea about this?

Bio-MingChen avatar May 10 '22 15:05 Bio-MingChen

I run this code on version Seurat 4 and higher ,but not on 3.2.3 version

Bio-MingChen avatar May 10 '22 15:05 Bio-MingChen

What version of SeuratObject did you use to create the object? Can you show the output of sessionInfo()?

Related issue here: https://github.com/timoast/signac/issues/872

timoast avatar May 20 '22 18:05 timoast

This should be fixed if you update your SeuratObject. Feel free to reopen if you are still facing issues.

saketkc avatar Jun 30 '23 19:06 saketkc