Closed JasonLiZhou closed 2 years ago
Hi Jason,
I'm happy to look into this in more detail if you're happy to share the original cellranger output of the individual samples and the codes you're written to pre-process the individual samples prior to integration.
Sean wei.wen@imm.ox.ac.uk
Hi Jason,
I'm happy to look into this in more detail if you're happy to share the original cellranger output of the individual samples and the codes you're written to pre-process the individual samples prior to integration.
Sean wei.wen@imm.ox.ac.uk
Hi Sean,
Sorry for the delay in getting back to you. Actually I tested the demo datasets (using Sample 6 and Sample 11) followed by SingCellaR analysis workflow tutorial, and still encountered the same error.
As attached is the code that I used:
######################### Standard analysis workflow for a healthy donor (Sample6) generated by Psaila et al., Mol. Cell, 2020
library(SingCellaR)
data_matrices_dir<-"~/SingCellaR-master/SingCellaR_example_datasets/Psaila_et_al/Sample06_cellranger/"
Sample6<-new("SingCellaR")
Sample6@dir_path_10x_matrix<-data_matrices_dir
Sample6@sample_uniq_id<-"Sample6"
load_matrices_from_cellranger(Sample6,cellranger.version = 3)
process_cells_annotation(Sample6,mito_genes_start_with="MT-")
DoubletDetection_with_scrublet(Sample6)
filter_cells_and_genes(Sample6,
min_UMIs=1000,
max_UMIs=60000,
min_detected_genes=500,
max_detected_genes=8000,
max_percent_mito=15,
genes_with_expressing_cells = 10)
normalize_UMIs(Sample6,use.scaled.factor = T)
remove_unwanted_confounders(Sample6,residualModelFormulaStr="~UMI_count+percent_mito")
get_variable_genes_by_fitting_GLM_model(Sample6,mean_expr_cutoff = 0.05,disp_zscore_cutoff = 0.05)
remove_unwanted_genes_from_variable_gene_set(Sample6,
gmt.file = "~/SingCellaR-master/SingCellaR_example_datasets/Human_genesets/human.ribosomal-mitocondrial.genes.gmt",
removed_gene_sets=c("Ribosomal_gene","Mitocondrial_gene"))
runPCA(Sample6,use.components=50,use.regressout.data = T)
runUMAP(Sample6,dim_reduction_method = "pca",n.dims.use = 20,n.neighbors = 30,
uwot.metric = "euclidean")
identifyClusters(Sample6,n.dims.use = 30,n.neighbors = 30,knn.metric = "euclidean")
runFA2_ForceDirectedGraph(Sample6,n.dims.use = 20,
n.neighbors = 5,n.seed = 1,fa2_n_iter = 1000)
findMarkerGenes(Sample6,cluster.type = "louvain")
save(Sample6,file="~/SingCellaR-master/SingCellaR_example_datasets/Psaila_et_al/SingCellaR_objects/Sample6.SingCellaR.rdata")
######################### Standard analysis workflow for a myelofibrosis patient
data_matrices_dir<-"~/SingCellaR-master/SingCellaR_example_datasets/Psaila_et_al/Sample11_cellranger/"
Sample11<-new("SingCellaR")
Sample11@dir_path_10x_matrix<-data_matrices_dir
Sample11@sample_uniq_id<-"Sample11"
load_matrices_from_cellranger(Sample11,cellranger.version = 3)
process_cells_annotation(Sample11,mito_genes_start_with="MT-")
DoubletDetection_with_scrublet(Sample11)
filter_cells_and_genes(Sample11,
min_UMIs=1000,
max_UMIs=80000,
min_detected_genes=500,
max_detected_genes=8000,
max_percent_mito=15,
genes_with_expressing_cells = 10)
normalize_UMIs(Sample11,use.scaled.factor = T)
remove_unwanted_confounders(Sample11,residualModelFormulaStr="~UMI_count+percent_mito")
get_variable_genes_by_fitting_GLM_model(Sample11,mean_expr_cutoff = 0.05,disp_zscore_cutoff = 0.05)
remove_unwanted_genes_from_variable_gene_set(Sample11,gmt.file = "~/SingCellaR-master/SingCellaR_example_datasets/Human_genesets/human.ribosomal-mitocondrial.genes.gmt",
removed_gene_sets=c("Ribosomal_gene","Mitocondrial_gene"))
runPCA(Sample11,use.components=50,use.regressout.data = T)
runUMAP(Sample11,dim_reduction_method = "pca",n.dims.use = 20,n.neighbors = 30,
uwot.metric = "euclidean")
identifyClusters(Sample11,n.dims.use = 30,n.neighbors = 30,knn.metric = "euclidean")
save(Sample11,file="~/SingCellaR-master/SingCellaR_example_datasets/Psaila_et_al/SingCellaR_objects/Sample11.SingCellaR.rdata")
######################### Integration of multiple samples
library(SingCellaR)
library(reticulate)
library(harmony)
library(liger)
library(Seurat)
library(sva)
################## Initialisation of SingCellaR integration object
human_HSPCs <- new("SingCellaR_Int")
human_HSPCs@dir_path_SingCellR_object_files<-"~/SingCellaR-master/SingCellaR_example_datasets/Psaila_et_al/SingCellaR_objects"
human_HSPCs@SingCellR_object_files=c("Sample6.SingCellaR.rdata", "Sample11.SingCellaR.rdata")
preprocess_integration(human_HSPCs)
And my sessionInfo is:
sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] sva_3.44.0 BiocParallel_1.30.3 genefilter_1.78.0
[4] mgcv_1.8-40 nlme_3.1-157 SingleCellExperiment_1.18.0
[7] SummarizedExperiment_1.26.1 GenomicRanges_1.48.0 GenomeInfoDb_1.32.2
[10] MatrixGenerics_1.8.0 matrixStats_0.62.0 sp_1.5-0
[13] SeuratObject_4.1.0 Seurat_4.1.1 liger_2.0.1
[16] harmony_0.1.0 Rcpp_1.0.8.3 reticulate_1.25
[19] tibble_3.1.7 org.Mm.eg.db_3.15.0 AnnotationDbi_1.58.0
[22] IRanges_2.30.0 S4Vectors_0.34.0 Biobase_2.56.0
[25] BiocGenerics_0.42.0 rasterpdf_0.1.1 patchwork_1.1.1
[28] destiny_3.10.0 dplyr_1.0.9 data.table_1.14.2
[31] R.devices_2.17.1 ggplot2_3.3.6 SingCellaR_1.2.0
loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 scattermore_0.8 ggthemes_4.2.4 R.methodsS3_1.8.2
[5] tidyr_1.2.0 bit64_4.0.5 irlba_2.3.5 DelayedArray_0.22.0
[9] R.utils_2.11.0 rpart_4.1.16 KEGGREST_1.36.2 RCurl_1.98-1.7
[13] doParallel_1.0.17 generics_0.1.2 cowplot_1.1.1 RSQLite_2.2.14
[17] RANN_2.6.1 proxy_0.4-27 future_1.26.1 bit_4.0.4
[21] spatstat.data_2.2-0 httpuv_1.6.5 assertthat_0.2.1 promises_1.2.0.1
[25] DEoptimR_1.0-11 fansi_1.0.3 igraph_1.3.2 DBI_1.1.3
[29] htmlwidgets_1.5.4 spatstat.geom_2.4-0 purrr_0.3.4 ellipsis_0.3.2
[33] RSpectra_0.16-1 ggpubr_0.4.0 backports_1.4.1 annotate_1.74.0
[37] RcppParallel_5.1.5 deldir_1.0-6 sparseMatrixStats_1.8.0 LinkedMatrix_1.4.0
[41] vctrs_0.4.1 here_1.0.1 Cairo_1.5-15 TTR_0.24.3
[45] ROCR_1.0-11 abind_1.4-5 cachem_1.0.6 RcppEigen_0.3.3.9.2
[49] withr_2.5.0 robustbase_0.95-0 progressr_0.10.1 vcd_1.4-10
[53] sctransform_0.3.3 xts_0.12.1 goftest_1.2-3 bigmemory_4.6.1
[57] cluster_2.1.3 lazyeval_0.2.2 laeken_0.5.2 crayon_1.5.1
[61] labeling_0.4.2 edgeR_3.38.1 pkgconfig_2.0.3 nnet_7.3-17
[65] rlang_1.0.2 globals_0.15.1 lifecycle_1.0.1 miniUI_0.1.1.1
[69] bigmemory.sri_0.1.3 polyclip_1.10-0 rprojroot_2.0.3 RcppHNSW_0.3.0
[73] lmtest_0.9-40 graph_1.74.0 Matrix_1.4-1 carData_3.0-5
[77] boot_1.3-28 zoo_1.8-10 base64enc_0.1-3 ggridges_0.5.3
[81] GlobalOptions_0.1.2 pheatmap_1.0.12 viridisLite_0.4.0 png_0.1-7
[85] rjson_0.2.21 bitops_1.0-7 R.oo_1.25.0 KernSmooth_2.23-20
[89] Biostrings_2.64.0 blob_1.2.3 DelayedMatrixStats_1.18.0 shape_1.4.6
[93] stringr_1.4.0 spatstat.random_2.2-0 parallelly_1.32.0 gridGraphics_0.5-1
[97] rstatix_0.7.0 ggsignif_0.6.3 scales_1.2.0 memoise_2.0.1
[101] GSEABase_1.58.0 magrittr_2.0.3 plyr_1.8.7 hexbin_1.28.2
[105] ica_1.0-2 cccd_1.6 zlibbioc_1.42.0 compiler_4.2.0
[109] RColorBrewer_1.1-3 pcaMethods_1.88.0 clue_0.3-61 fitdistrplus_1.1-8
[113] cli_3.3.0 XVector_0.36.0 listenv_0.8.0 pbapply_1.5-0
[117] ggplot.multistats_1.0.0 MASS_7.3-57 tidyselect_1.1.2 stringi_1.7.6
[121] locfit_1.5-9.5 ggrepel_0.9.1 grid_4.2.0 fastmatch_1.1-3
[125] tools_4.2.0 future.apply_1.9.0 parallel_4.2.0 circlize_0.4.15
[129] rstudioapi_0.13 uuid_1.1-0 foreach_1.5.2 AUCell_1.18.1
[133] gridExtra_2.3 smoother_1.1 farver_2.1.0 scatterplot3d_0.3-41
[137] Rtsne_0.16 digest_0.6.29 rgeos_0.5-9 FNN_1.1.3.1
[141] shiny_1.7.1 car_3.1-0 broom_0.8.0 later_1.3.0
[145] RcppAnnoy_0.0.19 httr_1.4.3 ComplexHeatmap_2.12.0 colorspace_2.0-3
[149] tensor_1.5 XML_3.99-0.10 ranger_0.14.1 splines_4.2.0
[153] yulab.utils_0.0.4 uwot_0.1.11 statmod_1.4.36 spatstat.utils_2.3-1
[157] ggplotify_0.1.0 plotly_4.10.0 xtable_1.8-4 jsonlite_1.8.0
[161] R6_2.5.1 pillar_1.7.0 htmltools_0.5.2 mime_0.12
[165] glue_1.6.2 fastmap_1.1.0 VIM_6.1.1 class_7.3-20
[169] codetools_0.2-18 fgsea_1.22.0 utf8_1.2.2 spatstat.sparse_2.1-1
[173] lattice_0.20-45 curl_4.3.2 crochet_2.3.0 leiden_0.4.2
[177] zip_2.2.0 openxlsx_4.2.5 survival_3.2-13 limma_3.52.2
[181] munsell_0.5.0 e1071_1.7-11 GetoptLong_1.0.5 GenomeInfoDbData_1.2.8
[185] iterators_1.0.14 reshape2_1.4.4 gtable_0.3.0 spatstat.core_2.4-4
It would be appreciated if you could kindly check this again. I look forward to hearing from you.
Jason
Hi Jason,
Noticed you didn't run findMarkerGenes on Sample11 prior to saving the R object.
May you do so and re-try the integration please?
Sean
Hi Sean,
I just added the codes and re-tried, but it still not worked.
Jason
I think it might be caused by the source code in Line 95 of SingleCellClasses.R
:
As I mentioned before, the function preprocess_integration
in SingleCell_Integration.R
uses "sce" object as "contain" parameter (in Line 95).
Hi Jason,
Apologies for the delay in getting back to you. I was looking around for a computer in which I can install the same R version as you to reproduce the error. Indeed, this error appears when I use R 4.2.1.
I've re-tried the integration using an earlier version (R 4.1.0) similar to mine and the integration worked.
As a stopgap solution, I would recommend proceeding with your SingCellaR analysis with R 4.1.0: https://cran.r-project.org/bin/macosx/base/R-4.1.0.pkg
Sean
Hi Sean,
Thank you for your time, I really appreciate it. And I will try the solution as you recommended.
Hope everything goes well for you.
Jason
Thanks Jason and Sean!
I have updated the package for R4.2. This problem was fixed for SingCellaR version 1.2.1. Please see the instruction from https://supatt-lab.github.io/SingCellaR.Doc/
Best, Supat
Hi Supat,
Thank you for bringing us this fantastic software for single cell analysis. Recently I tried the integrative mode of SingCellaR, and run into a problem during the
preprocess_integration
step, as shown below:Then I looked into the source code of function
preprocess_integration
inSingleCell_Integration.R
, and found the problem seems to be related to "sce" parameter when creating "SingCellaR_Int" object (in Line 95).I think the code here should be written like this:
object <- new("SingCellaR_Int", **new('SingCellaR', sce)**, dir_path_SingCellR_object_files=data.dir,SingCellR_object_files=input.files)
Could I kindly ask you to check this for me? Thank you in advance.
Jason