stuart-lab / signac

R toolkit for the analysis of single-cell chromatin data
https://stuartlab.org/signac/
Other
308 stars 84 forks source link

Error: non-conformable matrix dimensions in dimCheck(e1, e2) during running GeneActivity #1399

Closed CJ-Liu closed 12 months ago

CJ-Liu commented 1 year ago

Dear @timoast, I encountered an error message of "Error: non-conformable matrix dimensions in dimCheck(e1, e2)" while running GeneActivity to obtain the counts matrix. I followed the Vignette (https://stuartlab.org/signac/articles/integrate_atac.html) to integrate scATAC-seq data from more than 20 libraries. After integrating the data, I attempted to create a new gene activity assay derived from the scATAC-seq data using GeneActivity. However, after each step of "Extracting reads overlapping genomic regions", an error occurred. Thank you very much for your help.

gene.activities <- GeneActivity(integrated)

Extracting gene coordinates Extracting reads overlapping genomic regions |+++++++++++++++ | 30% ~01m 51s 'as(, "dgCMatrix")' is deprecated. Use 'as(., "dMatrix")' instead. See help("Deprecated") and help("Matrix-deprecated"). |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02m 26s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01m 44s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=04m 59s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=04m 47s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02m 52s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=03m 34s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=12m 53s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=18m 46s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=22m 24s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=19m 00s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=17m 06s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09m 51s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=20m 30s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=28m 25s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=22m 50s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=21m 13s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=24m 15s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=24m 27s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=13m 42s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=07m 09s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=15m 59s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=12m 47s Extracting reads overlapping genomic regions |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=16m 27s Error: non-conformable matrix dimensions in dimCheck(e1, e2)

sessionInfo() R version 4.1.3 (2022-03-10) Platform: x86_64-conda-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS/LAPACK: /path/to/conda/envs/scATAC/lib/libopenblasp-r0.3.21.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] Signac_1.7.0 SeuratObject_4.1.3 Seurat_4.3.0

loaded via a namespace (and not attached): [1] Rtsne_0.16 colorspace_2.1-0 deldir_1.0-6 [4] ellipsis_0.3.2 ggridges_0.5.4 XVector_0.34.0 [7] GenomicRanges_1.46.1 spatstat.data_3.0-1 leiden_0.4.3 [10] listenv_0.9.0 ggrepel_0.9.3 fansi_1.0.4 [13] codetools_0.2-19 splines_4.1.3 RcppRoll_0.3.0 [16] polyclip_1.10-4 jsonlite_1.8.4 Rsamtools_2.10.0 [19] ica_1.0-3 cluster_2.1.4 png_0.1-8 [22] uwot_0.1.14 shiny_1.7.4 sctransform_0.3.5 [25] spatstat.sparse_3.0-1 compiler_4.1.3 httr_1.4.5 [28] Matrix_1.5-4 fastmap_1.1.1 lazyeval_0.2.2 [31] cli_3.6.1 later_1.3.0 htmltools_0.5.5 [34] tools_4.1.3 igraph_1.4.2 gtable_0.3.3 [37] glue_1.6.2 GenomeInfoDbData_1.2.7 RANN_2.6.1 [40] reshape2_1.4.4 dplyr_1.1.2 fastmatch_1.1-3 [43] Rcpp_1.0.10 scattermore_0.8 Biostrings_2.62.0 [46] vctrs_0.6.2 spatstat.explore_3.1-0 nlme_3.1-162 [49] progressr_0.13.0 lmtest_0.9-40 spatstat.random_3.1-4 [52] stringr_1.5.0 globals_0.16.2 mime_0.12 [55] miniUI_0.1.1.1 lifecycle_1.0.3 irlba_2.3.5.1 [58] goftest_1.2-3 future_1.32.0 MASS_7.3-54 [61] zlibbioc_1.40.0 zoo_1.8-12 scales_1.2.1 [64] promises_1.2.0.1 spatstat.utils_3.0-2 parallel_4.1.3 [67] RColorBrewer_1.1-3 reticulate_1.28 pbapply_1.7-0 [70] gridExtra_2.3 ggplot2_3.3.5 stringi_1.7.12 [73] S4Vectors_0.32.4 BiocGenerics_0.40.0 BiocParallel_1.28.3 [76] GenomeInfoDb_1.30.1 rlang_1.1.0 pkgconfig_2.0.3 [79] matrixStats_0.63.0 bitops_1.0-7 lattice_0.21-8 [82] ROCR_1.0-11 purrr_1.0.1 tensor_1.5 [85] patchwork_1.1.2 htmlwidgets_1.6.2 cowplot_1.1.1 [88] tidyselect_1.2.0 parallelly_1.35.0 RcppAnnoy_0.0.20 [91] plyr_1.8.8 magrittr_2.0.3 R6_2.5.1 [94] IRanges_2.28.0 generics_0.1.3 pillar_1.9.0 [97] fitdistrplus_1.1-11 survival_3.5-5 abind_1.4-5 [100] RCurl_1.98-1.12 sp_1.6-0 tibble_3.2.1 [103] future.apply_1.10.0 crayon_1.5.2 KernSmooth_2.23-20 [106] utf8_1.2.3 spatstat.geom_3.1-0 plotly_4.10.1 [109] grid_4.1.3 data.table_1.14.8 digest_0.6.31 [112] xtable_1.8-4 tidyr_1.3.0 httpuv_1.6.9 [115] stats4_4.1.3 munsell_0.5.0 viridisLite_0.4.1

timoast commented 1 year ago

Hi, can you try updating to the latest Signac version and see if you still have this issue?

rdacemel commented 1 year ago

Hi! I'm experiencing the same. It's an integrated dataset of 6 experiments. It calculates GA for a while (there are six messages so I assume it manages to do it for all the fragments files) and then it crashes with the same message. Below my versions (I think 1.9.0 is the latest Signac?).

other attached packages: [1] plyranges_1.14.0 RColorBrewer_1.1-2 ComplexHeatmap_2.8.0
[4] viridis_0.6.1 viridisLite_0.4.0 Matrix_1.5-3
[7] biomaRt_2.48.3 ensembldb_2.16.4 AnnotationFilter_1.16.0 [10] GenomicFeatures_1.44.2 AnnotationDbi_1.54.1 Biobase_2.52.0
[13] GenomicRanges_1.44.0 GenomeInfoDb_1.33.3 IRanges_2.26.0
[16] S4Vectors_0.30.0 BiocGenerics_0.38.0 patchwork_1.1.1
[19] Signac_1.9.0 janitor_2.1.0 readxl_1.4.2
[22] lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0
[25] dplyr_1.1.2 purrr_1.0.1 readr_2.1.4
[28] tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.2
[31] tidyverse_2.0.0 data.table_1.14.0 SeuratObject_4.1.3
[34] Seurat_4.3.0

timoast commented 1 year ago

Would you mind sharing the seurat object and associated fragment file that reproduces this error? Then I can look into it more. You can email a download link to stuartt@gis.a-star.edu.sg

timoast commented 12 months ago

Closing since I haven't heard back, please reopen if you're still having issues and can supply the requested information

BenayounLaboratory commented 11 months ago

Hi - I am encountering the exact same error. It's a dataset with 8 samples, and the sheer size the files means it's not easily shareable. The fact that several independent users are reporting the error means something is amiss there? I am using the latest version of Signac (1.10.0). Would you be able to assist there on at least what may be causing the error to help troubleshoot it?

timoast commented 11 months ago

Hi @BenayounLaboratory

Happy to look into this, I just can't reproduce it with the data I have so it's hard to work out what is causing an error. If you can share a link to your data (eg, google drive or dropbox), via email above I can take a look

BenayounLaboratory commented 11 months ago

While trying to create a smaller dataset that reproduces the error, I found that splitting my object with 8 libraries into a list of 8 subobject and running the function on each subelement runs without the error. However, the gene activity matrices do not end up with the same amount of rows (there is a 2-5 row discrepancy out of > 20K rows). Maybe the error stems from a merging step when this is run on multiple libraries?

timoast commented 11 months ago

Yes that could be the issue. Not sure why sometimes the gene activity matrix would have a different dimension but that could explain the non-matching dimension error message.