seurat
seurat copied to clipboard
s[['pca']] <- CreateDimReducObject Calls ERROR: [[<- -> [[<- -> Key -> Key.Seurat -> vapply
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?
I run this code on version Seurat 4 and higher ,but not on 3.2.3 version
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
This should be fixed if you update your SeuratObject. Feel free to reopen if you are still facing issues.