plger / scDblFinder

Methods for detecting doublets in single-cell sequencing data
https://plger.github.io/scDblFinder/
GNU General Public License v3.0
162 stars 17 forks source link

Multiple errors: samples argument and Matrix #103

Closed mainyanghr closed 7 months ago

mainyanghr commented 7 months ago

Dear Pierre, Thanks for the package! Please see following code. I have a seurat object called Tcells that contains many samples from different experiments.

sce <- scDblFinder(GetAssayData(Tcells, slot= "counts"), samples = "experiment", multiSampleMode = "split", BPPARAM=MulticoreParam(3), clusters = Idents(Tcells))

1: It seems that samples is not an argument Assuming the input to be a matrix of counts or expected counts. Error in .checkColArg(sce, samples) : Could not findsamplescolumn in

2: when I delete the samples argument, I have another errors, which might have something to do with the Matrix version (1.6-5). But I am not able to downgrade the Matrix to version 1.6-2 by using following code : remotes::install_version(package = 'Matrix', version = '1.6-2'). It will be great if you could help. I also noticed that people reported that downgrading Matrix is not enough as well.

Assuming the input to be a matrix of counts or expected counts. 15 clusters Creating ~8633 artificial doublets... Dimensional reduction Error in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE, : function 'as_cholmod_sparse' not provided by package 'Matrix'

I appreciate for your kind help!

Best, Harry

plger commented 7 months ago

Hi,

regarding your problem 1, for obvious reasons passing the name of a column doesn't work if your object is just a matrix of counts (as it is in your case). I've now added to devel a check and clear error message to this effect. In your case, you can simply use samples=Tcells$experiment .

Regarding problem 2, see issue #91 . Rather than downgrading Matrix, you can simply re-build irlba from source.

mainyanghr commented 7 months ago

Thank you very much for your fast response. I did the followings and problem is still there. 1: install.packages("Matrix", type = "source") install.packages("irlba", type = "source")

2: sce <- scDblFinder(GetAssayData(Tcells, slot= "counts"), samples = Tcells$experiment, multiSampleMode = "split", BPPARAM=MulticoreParam(3), clusters = Idents(Tcells))

3; Errors Assuming the input to be a matrix of counts or expected counts. Warning: 'package:stats' may not be available when loadingWarning: 'package:stats' may not be available when loadingWarning: 'package:stats' may not be available when loadingError: BiocParallel errors 3 remote errors, element index: 1, 4, 7 5 unevaluated and other errors first remote error: Error in value[[3L]](cond): An error occured while processing sample '1': Error in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE, : function 'as_cholmod_sparse' not provided by package 'Matrix' Here comes my session: attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] irlba_2.3.5.1 BiocParallel_1.36.0 scDblFinder_1.16.0 [4] SingleCellExperiment_1.24.0 clusterProfiler_4.10.0 DESeq2_1.42.0 [7] fgsea_1.29.1 celldex_1.12.0 SingleCellMultiModal_1.14.0 [10] MultiAssayExperiment_1.28.0 SingleR_2.4.0 SummarizedExperiment_1.32.0 [13] Biobase_2.62.0 GenomicRanges_1.54.1 GenomeInfoDb_1.38.5 [16] IRanges_2.36.0 S4Vectors_0.40.2 BiocGenerics_0.48.1 [19] MatrixGenerics_1.14.0 matrixStats_1.2.0 SeuratWrappers_0.3.2 [22] glmGamPoi_1.14.0 presto_1.0.0 data.table_1.14.10 [25] BiocManager_1.30.22 remotes_2.4.2.1 harmony_1.2.0 [28] Rcpp_1.0.12 ggsci_3.0.0 viridis_0.6.4 [31] viridisLite_0.4.2 magrittr_2.0.3 sctransform_0.4.1 [34] Azimuth_0.5.0 shinyBS_0.61.1 pbmcsca.SeuratData_3.0.0 [37] pbmcref.SeuratData_1.0.0 bmcite.SeuratData_0.3.0 SeuratData_0.2.2.9001 [40] SeuratDisk_0.0.0.9021 patchwork_1.2.0 RCurl_1.98-1.14 [43] cowplot_1.1.3 scales_1.3.0 Matrix_1.6-5 [46] lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 [49] dplyr_1.1.4 purrr_1.0.2 readr_2.1.5 [52] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.4.4 [55] tidyverse_2.0.0 Seurat_5.0.1 devtools_2.4.5 [58] usethis_2.2.2 SeuratObject_5.0.1 sp_2.1-2

plger commented 7 months ago

Were the install commands actually successful? (The error message is pretty clearly the aforementioned issue, so I somehow doubt that you did in fact re-build the packages from source).

mainyanghr commented 7 months ago

Great, You are right, It is working now. Thank you very much.