Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when converting SCE object to Seurat despite counts and logcounts present in assays #8798

Open
sagrikachugh opened this issue Apr 19, 2024 · 3 comments

Comments

@sagrikachugh
Copy link

I am using Seurat v5.0.2 , SeuratObject v5.0.1 and SingleCellExperiment v1.22.0 trying to convert a SCE object to Seurat using the following code

so <- as.Seurat(sce, counts = "counts", data = "logcounts")

This results in error:

Error: No data in provided assay - logcounts

Here is how my SCE looks like:

sce
class: SingleCellExperiment 
dim: 28421 111867 
metadata(1): Samples
assays(2): counts logcounts
rownames(28421): Xkr4 Gm1992 ... CAAA01147332.1 AC149090.1
rowData names(4): ID Symbol Type CHR
colnames(111867): 1_AAACCCACAAGTGACG-1 1_AAACCCACACTCACTC-1
  ... 15_TTTGTTGGTTAGTCGT-1 15_TTTGTTGGTTTGGGAG-1
colData names(29): Sample Barcode ... cluster cluster_colours
reducedDimNames(2): PCA UMAP
mainExpName: RNA
@Gesmira
Copy link
Contributor

Gesmira commented Apr 23, 2024

Can you share a small example file where this is occurring?

@sagrikachugh
Copy link
Author

sagrikachugh commented Apr 24, 2024

@Gesmira Thanks for looking into this.
Here's a reproducible example using the scater package

Creating a sce object first

test_sce <- scater::mockSCE()
test_sce
class: SingleCellExperiment 
dim: 2000 200 
metadata(0):
assays(1): counts
rownames(2000): Gene_0001 Gene_0002 ... Gene_1999 Gene_2000
rowData names(0):
colnames(200): Cell_001 Cell_002 ... Cell_199 Cell_200
colData names(3): Mutation_Status Cell_Cycle Treatment
reducedDimNames(0):
mainExpName: NULL
altExpNames(1): Spikes

Now, we add logcounts to the test_sce object as as.Seurat function needs both "counts" and "logcounts" in the assay slot

test_sce <- scater::logNormCounts(test_sce)

Now we have "logcounts" in our assays as shown below

test_sce
class: SingleCellExperiment 
dim: 2000 200 
metadata(0):
assays(2): counts logcounts
rownames(2000): Gene_0001 Gene_0002 ... Gene_1999 Gene_2000
rowData names(0):
colnames(200): Cell_001 Cell_002 ... Cell_199 Cell_200
colData names(4): Mutation_Status Cell_Cycle Treatment sizeFactor
reducedDimNames(0):
mainExpName: NULL
altExpNames(1): Spikes

Converting test_sce to seurat object

test_so <- as.Seurat(test_sce, counts = "counts", data = "logcounts")

This results in error -

Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Error: No data in provided assay - logcounts

@sagrikachugh
Copy link
Author

@Gesmira Could you please have a look at the above example with mockSCE. It seems like a bug now.

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

No branches or pull requests

2 participants