Skip to content

Converting SingleCellExperiment objects into Seurat objects #6692

Closed
@mass-a

Description

Hello,

I am having trouble converting SingleCellExperiment objects from the scRNAseq bioconductor collection using as.Seurat. Here's a reproducible example:

BiocManager::install('scRNAseq')
library(scRNAseq)

sce <- ZilionisLungData('mouse')
seurat <- as.Seurat(sce, counts = "counts", data=NULL)
Error in embeddings[i, j, drop = drop, ...] : subscript out of bounds

Several other datasets in the collection give similar errors. Any idea what's going on here? can I e.g. ask as.Seurat to only convert counts and metadata?

Thanks in advance,
-massimo

Activity

alikhuseynov

alikhuseynov commented on Nov 18, 2022

@alikhuseynov
Contributor

Hi,
..same issue as well.
it only works when removing embeddings (maybe something is wrong with them in that sce object)

library(scRNAseq)
sce <- ZilionisLungData('mouse')
reducedDim(sce) <- NULL # remove dr
object <- as.Seurat(sce, counts = "counts", data = NULL)
An object of class Seurat 
28205 features across 17549 samples within 1 assay 
Active assay: originalexp (28205 features, 0 variable features)

# package versions
lapply(seq(2), function(i) package.version(c("SeuratObject", "Seurat")[i])) %>% unlist
1] "4.1.3"      "4.2.1.9000"

timoast

timoast commented on Dec 7, 2022

@timoast
Collaborator

The problem with this dataset is many of the cell names are duplicated:

library(scRNAseq)
sce <- ZilionisLungData('mouse')
length(unique(colnames(sce)))
[1] 2711
length(colnames(sce))
[1] 17549

This is unusual, and we require that within a Seurat object a cell name is unique to one cell. The issue here is that we are automatically renaming cells with conflicting names, but that renaming is not being performed on the dimension reduction object

added a commit that references this issue on Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Converting SingleCellExperiment objects into Seurat objects · Issue #6692 · satijalab/seurat