stuart-lab / signac

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

CreateChromatinAssay() incompatible with chromVAR #1525

Closed sbdaxia closed 11 months ago

sbdaxia commented 11 months ago

Using the CreateChromatinAssay function with Seurat 5 loaded renders the following error

Error in .local(x, na.rm, dims, ...) : object 'R_sparse_marginsum' not found

Downgrading Seurat to 4.4.0 resolved this issue. So I presume this error is coming from incompatibility between Seurat 5 and the current version of Signac.

timoast commented 11 months ago

please show the full code you're running and the output of sessionInfo()

timoast commented 11 months ago

@sbdaxia any update on this?

sbdaxia commented 11 months ago

Sorry took me a bit of time to establish a reproducible example. It turns out the error is actually coming from a conflict between the chromVAR package and the Signac package.

I was able to run the following code with no error if chromVAR is not loaded.

chrom_assay <- CreateChromatinAssay(
  counts = atac_mtx,
  assay = "sci",
  genome = "mm10",
  ranges = sci_geo_peaks,
  project = 'sci'
)

However, as soon as chromVAR is loaded, running the same code gives me the following error

Error in .local(x, na.rm, dims, ...) : 
  object 'R_sparse_marginsum' not found

I have changed the title of this thread to better describe this issue. Would this be something that I should post to the chromVAR Github?

Below is my sessionInfo

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

Random number generation:
 RNG:     L'Ecuyer-CMRG 
 Normal:  Inversion 
 Sample:  Rejection 

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

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

other attached packages:
 [1] chromVAR_1.24.0             lubridate_1.9.3             forcats_1.0.0               dplyr_1.1.3                
 [5] purrr_1.0.2                 readr_2.1.4                 tidyr_1.3.0                 tibble_3.2.1               
 [9] tidyverse_2.0.0             ArchRtoSignac_1.0.3         rhdf5_2.46.0                SummarizedExperiment_1.32.0
[13] MatrixGenerics_1.14.0       Rcpp_1.0.11                 matrixStats_1.1.0           data.table_1.14.8          
[17] stringr_1.5.1               plyr_1.8.9                  magrittr_2.0.3              gtable_0.3.4               
[21] gtools_3.9.4                gridExtra_2.3               ArchR_1.0.2                 EnsDb.Mmusculus.v79_2.99.0 
[25] ensembldb_2.26.0            AnnotationFilter_1.26.0     GenomicFeatures_1.54.1      AnnotationDbi_1.64.1       
[29] Biobase_2.62.0              rtracklayer_1.62.0          GenomicRanges_1.54.1        GenomeInfoDb_1.38.0        
[33] IRanges_2.36.0              S4Vectors_0.40.1            BiocGenerics_0.48.1         Matrix_1.6-1               
[37] ggplot2_3.4.4               Seurat_5.0.0                SeuratObject_5.0.0          sp_2.1-1                   
[41] Signac_1.12.0              

loaded via a namespace (and not attached):
  [1] ProtGenerics_1.34.0         spatstat.sparse_3.0-3       bitops_1.0-7                DirichletMultinomial_1.44.0
  [5] TFBSTools_1.40.0            httr_1.4.7                  RColorBrewer_1.1-3          tools_4.3.1                
  [9] sctransform_0.4.1           utf8_1.2.4                  R6_2.5.1                    DT_0.30                    
 [13] lazyeval_0.2.2              uwot_0.1.16                 rhdf5filters_1.14.1         withr_2.5.2                
 [17] prettyunits_1.2.0           progressr_0.14.0            cli_3.6.1                   Cairo_1.6-1                
 [21] spatstat.explore_3.2-5      fastDummies_1.7.3           spatstat.data_3.0-3         ggridges_0.5.4             
 [25] pbapply_1.7-2               Rsamtools_2.18.0            R.utils_2.12.2              parallelly_1.36.0          
 [29] BSgenome_1.70.1             rstudioapi_0.15.0           RSQLite_2.3.3               generics_0.1.3             
 [33] BiocIO_1.12.0               ica_1.0-3                   spatstat.random_3.2-1       GO.db_3.18.0               
 [37] fansi_1.0.5                 abind_1.4-5                 R.methodsS3_1.8.2           lifecycle_1.0.4            
 [41] yaml_2.3.7                  SparseArray_1.2.2           BiocFileCache_2.10.1        Rtsne_0.16                 
 [45] blob_1.2.4                  promises_1.2.1              crayon_1.5.2                miniUI_0.1.1.1             
 [49] lattice_0.22-5              cowplot_1.1.1               annotate_1.80.0             KEGGREST_1.42.0            
 [53] pillar_1.9.0                knitr_1.45                  rjson_0.2.21                future.apply_1.11.0        
 [57] codetools_0.2-19            fastmatch_1.1-4             leiden_0.4.3                glue_1.6.2                 
 [61] vctrs_0.6.4                 png_0.1-8                   spam_2.10-0                 poweRlaw_0.70.6            
 [65] cachem_1.0.8                xfun_0.41                   S4Arrays_1.2.0              mime_0.12                  
 [69] pracma_2.4.4                survival_3.5-7              RcppRoll_0.3.0              ellipsis_0.3.2             
 [73] fitdistrplus_1.1-11         ROCR_1.0-11                 nlme_3.1-163                bit64_4.0.5                
 [77] progress_1.2.2              filelock_1.0.2              RcppAnnoy_0.0.21            irlba_2.3.5.1              
 [81] KernSmooth_2.23-22          colorspace_2.1-0            seqLogo_1.68.0              DBI_1.1.3                  
 [85] tidyselect_1.2.0            bit_4.0.5                   compiler_4.3.1              curl_5.1.0                 
 [89] xml2_1.3.5                  DelayedArray_0.28.0         plotly_4.10.3               scales_1.2.1               
 [93] caTools_1.18.2              lmtest_0.9-40               rappdirs_0.3.3              digest_0.6.33              
 [97] goftest_1.2-3               spatstat.utils_3.0-4        rmarkdown_2.25              XVector_0.42.0             
[101] htmltools_0.5.7             pkgconfig_2.0.3             dbplyr_2.4.0                fastmap_1.1.1              
[105] rlang_1.1.2                 htmlwidgets_1.6.2           shiny_1.7.5.1               zoo_1.8-12                 
[109] jsonlite_1.8.7              BiocParallel_1.36.0         R.oo_1.25.0                 RCurl_1.98-1.13            
[113] GenomeInfoDbData_1.2.11     dotCall64_1.1-0             patchwork_1.1.3             Rhdf5lib_1.24.0            
[117] munsell_0.5.0               reticulate_1.34.0           stringi_1.8.1               zlibbioc_1.48.0            
[121] MASS_7.3-60                 parallel_4.3.1              listenv_0.9.0               ggrepel_0.9.4              
[125] deldir_1.0-9                CNEr_1.38.0                 Biostrings_2.70.1           splines_4.3.1              
[129] tensor_1.5                  hms_1.1.3                   igraph_1.5.1                spatstat.geom_3.2-7        
[133] RcppHNSW_0.5.0              reshape2_1.4.4              biomaRt_2.58.0              TFMPvalue_0.0.9            
[137] XML_3.99-0.15               evaluate_0.23               tzdb_0.4.0                  httpuv_1.6.12              
[141] RANN_2.6.1                  polyclip_1.10-6             future_1.33.0               scattermore_1.2            
[145] xtable_1.8-4                restfulr_0.0.15             RSpectra_0.16-1             later_1.3.1                
[149] viridisLite_0.4.2           memoise_2.0.1               GenomicAlignments_1.38.0    cluster_2.1.4              
[153] timechange_0.2.0            globals_0.16.2 
timoast commented 11 months ago

You can try re-installing SeuratObject, this could be related to some other issues reported here: https://github.com/mojaveazure/seurat-object/commit/d567ec8b0f49534bd51c29f153f2e0b877dedc34

sbdaxia commented 11 months ago

I can confirm that after updating SeuratObject to 5.0.1, the issue has been resolved. Thank you so much for your help!