carmonalab / ProjecTILs

Interpretation of cell states using reference single-cell maps
GNU General Public License v3.0
231 stars 27 forks source link

Incompatibility with Seurat v5 #66

Closed ElviMagda closed 8 months ago

ElviMagda commented 8 months ago

Dear ProjecTILs team,

first of all, thank you for making our life much easier with this wonderful package :)

I have recently changed to Seurat version 5, and I have encountered an error when I try to run the following code:

Change default assay to RNA

DefaultAssay(GEX_Tcells) <- "RNA"

Pre-process

Normalize data (log normalize)

GEX_Tcells <- NormalizeData(GEX_Tcells, verbose = FALSE)

Find variable features

GEX_Tcells <- FindVariableFeatures(GEX_Tcells, nfeatures = 3000, verbose = FALSE)

Scale data

GEX_Tcells <- ScaleData(GEX_Tcells, vars.to.regress = vars.regress, verbose = FALSE)

Load Human reference for CD4 and CD8 TILs

ref_CD4 <- loadRDS("../Data/Raw_data/Reference/CD4T_human_ref_v1.rds") ref_CD8 <- loadRDS("../Data/Raw_data/Reference/CD8T_human_ref_v1.rds")

Run ProjecTILs classifier

GEX_Tcells <- ProjecTILs.classifier(GEX_Tcells, ref = ref_CD4) | | 0%[1] "Using assay RNA for query"

|=====================================================================================>============================| 100%

Error: BiocParallel errors 1 remote errors, element index: 1 0 unevaluated and other errors first remote error: Error in as.vector(x): no slot of name "var.features" for this object of class "Assay5"

When I run ProjecTILs with the SCT assay, I have no problem.

I guess it has something to do with the new structure of the RNA Assay5. Is there any quick solution for this? Would it be okay to use it the SCT-processed data?

Thank you very much! Best, Elvira

Here my session info:

sessionInfo() R version 4.3.1 (2023-06-16 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=English_Europe.utf8 LC_CTYPE=English_Europe.utf8 LC_MONETARY=English_Europe.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Europe.utf8

attached base packages: [1] grid stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] ComplexHeatmap_2.15.4 ProjecTILs_3.1.2 scDblFinder_1.15.1 patchwork_1.1.3 tidyr_1.3.0
[6] dplyr_1.1.3 viridis_0.6.4 viridisLite_0.4.2 scales_1.2.1 sctransform_0.4.1
[11] Seurat_5.0.0 SeuratObject_5.0.0 sp_2.1-1 ggplot2_3.4.4 SingleCellExperiment_1.24.0 [16] SummarizedExperiment_1.32.0 Biobase_2.62.0 GenomicRanges_1.54.0 GenomeInfoDb_1.38.0 IRanges_2.36.0
[21] S4Vectors_0.40.0 BiocGenerics_0.48.0 MatrixGenerics_1.14.0 matrixStats_1.0.0

mass-a commented 8 months ago

Hello Elvira, yes we are currently working on addressing compatibility with the new Assay5 data structure from Seurat. You can try installing the development version of ProjecTILs, which should solve most issues:

remotes::install_github("carmonalab/ProjecTILs", ref="dev")

Alternatively, you can convert from Assay5 to the older Assay data structure by using the following:

GEX_Tcells[["RNA"]] <- as(GEX_Tcells["RNA"]], Class = "Assay")

Let me know if that works for you. Best -m

ElviMagda commented 8 months ago

Hi Massimo,

Thanks for your quick response. I downloaded the development version and it worked well. I will keep trying with other datasets. If I see any other issue, I will report it.

Thanks again! Best, Elvira