satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.27k stars 910 forks source link

invalid class “LogMap” object: Rownames must be supplied When trying to create a Seurat object #8105

Closed Sharonbdr closed 9 months ago

Sharonbdr commented 10 months ago

I've been trying to create a Seurat object:

nuc.seurat <- CreateSeuratObject(counts = as.matrix(UMIs), project = i, min.cells = 3, min.features = 200)

however I keep on getting the following error:

Error in validObject(.Object) : 
  invalid class “LogMap” object: Rownames must be supplied

The weird thing is, just a day ago it worked completely fine with the exact same pipline. UMIs in this case is a count dataframe, and it has rownames (despite what the error is suggesting):

         Sample1 Sample2 Sample3 Sample4
A1BG          21       0       6       1
A1BG-AS1       2       0       0       0
A1CF           9       3       8       2
A2M           17       0       4       0
A2M-AS1        0       0       0       0

(UMIs is a lot larger this is just a subset)

I do not have a lot of experience in R or using Seurat so any input would help! Thank you!

I have tried removing some of the input args of CreateSeuratObject and that did work:

nuc.seurat <- CreateSeuratObject(counts = as.matrix(UMIs), project = i, min.cells = 3)

However, filtering by min.features at this step reduces object size and eliminates other error down the line (NA data and so on). So it's not a good enough solution.

Also, trying to downgrade Matrix produces an incompatibility error so I cannot run CreateSeuratObject .

Seurat v 5.0.1 Matrix v 1.6-3

longmanz commented 10 months ago

Hi, Sorry. It is indeed a Matrix issue and has been reported multiple time. When you say you cannot downgrade Matrix, what kind of error message did you receive? remotes::install_version("Matrix", version = "1.6-1.1")

Sharonbdr commented 10 months ago

Error: package or namespace load failed for ‘SeuratObject’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace ‘Matrix’ 1.6-1.1 is being loaded, but >= 1.6.3 is required

longmanz commented 10 months ago

Hi, This is strange. Can you try re-install Seurat and SeuratObject from CRAN directly? The latest SeuratObject (v5.0.1) will install the latest Matrix (v.1.6-4) will be installed. This should no longer cause any issue. Can you check your as.matrix(UMIs) to see if there is really any cell with enough min.features (>=200) ?

Sharonbdr commented 10 months ago

Didn't work. When creating a Seurat object without that threshold and looking at the minimum number of nFeature_RNA it returns 459. So technically I don't actually need this threshold but this is just one example.

longmanz commented 10 months ago

Hi, This is really strange and we cannot reproduce it from our end. Glad that the workaround of not using min.features works. If possible, please try using the latest Matrix package and try again. Or if you can provide us a minimal reproducible dataset (either your own data or any data from our vignette) it will be very helpful.

longmanz commented 9 months ago

Hi, I am closing this issue for now. I will re-open if the issue persists.

aaltulea commented 3 months ago

This table can produce the error if you still want to investigate the issue. It is publicly available under GSM5140521

GSM5140521_Young-2-ProxCol.csv.gz

test.R

library(tidyverse)
library(Seurat)
table = read.csv("GSE168448_ageing_colon/data/GSM5140521_Young-2-ProxCol.csv.gz") %>% column_to_rownames("X")
seurat = CreateSeuratObject(table, min.cells = 20, min.features = 50)

Error in validObject(.Object) (test.R#4): invalid class “LogMap” object: Rownames must be supplied

szhaoaf commented 3 months ago

I have seen the same error and it turns out to be your min.features parameters is too high, thus leading to no filtered features (genes of your rownames) detected. Try to low down your min.features = 1. And the error will be resolved.

Bests.

chris257-ux commented 2 months ago

I meet the same question. So I check the data and find that there isn't really any cell with enough min.features (>=200) .

RodrigoGM commented 1 month ago

Hi, this issue was posted on Stackoverflow, I've posted an answer there. Here is the link to the post:

https://stackoverflow.com/questions/77503371/invalid-class-logmap-object-rownames-must-be-supplied-when-trying-to-create-a