Skip to content

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

@MorticiaGiulia

Description

@MorticiaGiulia

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions