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 in features_usage[, "data"] : subscript out of bounds #14

Open
MorticiaGiulia opened this issue Aug 11, 2024 · 2 comments
Open

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

MorticiaGiulia opened this issue Aug 11, 2024 · 2 comments

Comments

@MorticiaGiulia
Copy link

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!

@MeHelmy
Copy link

MeHelmy commented Sep 3, 2024

Hi @MorticiaGiulia ,

Is there any update on this issue?

Thanks,
Medhat

@zhisonghe
Copy link
Collaborator

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

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

3 participants