simspec icon indicating copy to clipboard operation
simspec copied to clipboard

Error in features_usage[, "data"] : subscript out of bounds

Open MorticiaGiulia opened this issue 1 year ago • 2 comments

Hello there,

Thank you for developing CSS! We are trying to use it on a set of Seurat objects created via Seurat_V5.

Basically, I have 2 Seurat objects each from a separate experiment. I merged them using merge(), which led to multiple "data layers" (e.g. "data.S1", "data.S2"). However, in the merged Seurat object, there isn't a data layer that's just called "data". And that seems to be a problem when I ran cluster_sim_spectrum(). Please kindly see my script below. It shows that I got an error, saying "Error in features_usage[, "data"] : subscript out of bounds"

`org.WT$Genotype <- rep("WT", nrow([email protected])) org.KO$Genotype <- rep("KO", nrow([email protected]))

data<-merge(org.WT,org.KO, add.cell.ids = c("WT","KO"), project = "test")

a <- NormalizeData(data, normalization.method = "LogNormalize", scale.factor = 10000) a <- FindVariableFeatures(a, selection.method = "vst", nfeatures = 2000) a <- ScaleData(a, features = VariableFeatures(a)) a <- RunPCA(a, features = VariableFeatures(object = a))

a <- cluster_sim_spectrum(object = a, label_tag = "Genotype", spectrum_type = "corr_ztransform",corr_method = "spearman")

Error in features_usage[, "data"] : subscript out of bounds`

I looked into the cluster_sim_spectrum function from here. The issue comes from this line normdata <- object[[[email protected]]]@layers$data. And this is because this line is looking for the layer called "data" but there isn't one in my merged Seurat object.

I know I can join the layers via JoinLayers() in Seurat_V5 to get a single "data" layer. However, I thought I shouldn't join layers before performing any integration (e.g. via CSS). This means I would not have the layer called "data". And if I don't have the "data", then I can't proceed with the rest of the function.

Could anyone please provide some clues as to how to resolve this issue? My apologies if I'm missing something obvious here.

Thank you very much for your time!

MorticiaGiulia avatar Aug 11 '24 16:08 MorticiaGiulia

Hi @MorticiaGiulia ,

Is there any update on this issue?

Thanks, Medhat

MeHelmy avatar Sep 03 '24 19:09 MeHelmy

Hi, both, Thanks for using CSS and yes, we have noticed this issue. We plan to look into it and find a solution, but due to the limited capacity right now we have to postpone the process until some higher priority jobs are done. We will come back to this pretty soon.

All the best, Zhisong

zhisonghe avatar Sep 04 '24 06:09 zhisonghe