carmonalab / STACAS

R package for semi-supervised single-cell data integration
GNU General Public License v3.0
75 stars 9 forks source link

error in FindAnchors.STACAS #4

Closed JavieraVillar closed 3 years ago

JavieraVillar commented 3 years ago

Hello, thanks you for the tutorial! I am trying to do the integration of my data (I have 10 samples with around 20,000 cells in total) with STACAS, but I got an error at the beginning when running FindAnchors.STACAS:

 Error in new(Class = "AnchorSet", object.list = object.list, reference.objects = reference %||%  : 
   trying to generate an object from a virtual class ("AnchorSet")

Do you know why I could get this?

thanks you a lot in advance, Javiera.

mass-a commented 3 years ago

Hello Javiera,

can you provide some more details: what command and parameters are you using? what version of STACAS and Seurat do you have? and do you see this error also while running the tutorial, or only on your data?

-massimo

JavieraVillar commented 3 years ago

Hello Massimo,

I am using Seurat v3.9.9.9010 and STACAS 1.0.1. I just tried, and got the same error with the tutorial...

And this is my script:

`var.genes.n <- 800
var.genes.integrated.n <- 500

for (sample_id in 1:length(samples.10X.RNA.filtered.separated)) {
  Idents(samples.10X.RNA.filtered.separated[[sample_id]]) <- samples.10X.RNA.filtered.separated[[sample_id]]$sample
  DefaultAssay(object = samples.10X.RNA.filtered.separated[[sample_id ]]) <- "RNA"

  samples.10X.RNA.filtered.separated[[sample_id]] <- NormalizeData(object = samples.10X.RNA.filtered.separated[[sample_id]], verbose = FALSE)
  samples.10X.RNA.filtered.separated[[sample_id]] <- FindVariableFeatures(object = samples.10X.RNA.filtered.separated[[sample_id]], selection.method = "vst", nfeatures = var.genes.n*2 , verbose = FALSE)

    mito.genes <- grep(pattern = "^mt-", rownames(samples.10X.RNA.filtered.separated[[sample_id]]), value = TRUE)
    ribo.genes <- grep(pattern = "^Rp[ls]", rownames(samples.10X.RNA.filtered.separated[[sample_id]]), value = TRUE)

    samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features <- setdiff(samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features, cellCycle.symbol)
    samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features <- setdiff(samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features, mito.genes)
    samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features <- setdiff(samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features, ribo.genes)
    samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features <- head( samples.10X.RNA.filtered.separated[[sample_id]]@assays$RNA@var.features, var.genes.n)
}

#Find integration anchors with pair-wise dataset distances
ndim=10
ref.anchors <- FindAnchors.STACAS(samples.10X.RNA.filtered.separated, dims=1:ndim, anchor.features= var.genes.integrated.n)

Maybe it is related with the Seurat version?

Javiera.

mass-a commented 3 years ago

Yes, it is related to the Seurat version. I see you are using the beta release of Seurat v4.0, and we have not yet addressed compatibility issues with this version.

For now, I suggest to use the latest official release of Seurat (v3.2.x) to run STACAS.

mass-a commented 3 years ago

Just an update,

this problem should be now solved in STACAS version 1.1.0, which is compatible with updated data structures of Seurat 4.