GreenleafLab / ArchR

ArchR : Analysis of Regulatory Chromatin in R (www.ArchRProject.com)
MIT License
384 stars 137 forks source link

Error with addGeneIntegrationMatrix() - length of 'dimnames' [1] not equal to array extent - (persists even with tutorial data) #2042

Closed dgagler closed 11 months ago

dgagler commented 11 months ago

Hi. I'm trying to integrate scRNA and ATAC data and failing on the addGeneIntegrationMatrix() step with both my own data and the tutorial data. ArchR has been updated to the most current version and I'm running Seurat v4.3. I'm using the tutorial heme data (both ATAC and RNA). For the ATAC side, I have simply created an ArchR object from the provided Arrow files, ran dimensionality reduction with IterativeLSI, loaded the RNA data, and then ran addGeneIntegrationMatrix() with standard inputs. Code and output below:

projHeme1 <- addGeneIntegrationMatrix(
    ArchRProj = projHeme1, 
    useMatrix = "GeneScoreMatrix",
    matrixName = "GeneIntegrationMatrix",
    reducedDims = "IterativeLSI",
    seRNA = seRNA,
    addToArrow = FALSE,
    groupRNA = "BioClassification",
    nameCell = "predictedCell_Un",
    nameGroup = "predictedGroup_Un",
    nameScore = "predictedScore_Un"
)

ArchR logging to : ArchRLogs/ArchR-addGeneIntegrationMatrix-58614bf112a-Date-2023-10-30_Time-15-42-50.log
If there is an issue, please report to github with logFile!
2023-10-30 15:42:51 : Running Seurat's Integration Stuart* et al 2019, 0.002 mins elapsed.
2023-10-30 15:42:51 : Checking ATAC Input, 0.005 mins elapsed.
2023-10-30 15:42:51 : Checking RNA Input, 0.008 mins elapsed.
2023-10-30 15:42:56 : Found 18601 overlapping gene names from gene scores and rna matrix!, 0.086 mins elapsed.
2023-10-30 15:42:56 : Creating Integration Blocks, 0.086 mins elapsed.
2023-10-30 15:42:56 : Prepping Interation Data, 0.09 mins elapsed.
2023-10-30 15:42:56 : Computing Integration in 1 Integration Blocks!, 0 mins elapsed.
2023-10-30 15:42:56 : Block (1 of 1) : Computing Integration, 0 mins elapsed.
2023-10-30 15:42:58 : Block (1 of 1) : Identifying Variable Genes, 0.023 mins elapsed.
2023-10-30 15:43:00 : Block (1 of 1) : Getting GeneScoreMatrix, 0.055 mins elapsed.
2023-10-30 15:43:03 : Block (1 of 1) : Imputing GeneScoreMatrix, 0.119 mins elapsed.
Getting ImputeWeights
2023-10-30 15:43:33 : Block (1 of 1) : Seurat FindTransferAnchors, 0.612 mins elapsed.
FN : Error occured, attempting again (1 of 2)
FN : Error occured, attempting again (2 of 2)
FN : Error occured and could not be resolved after 2 additional attempts!
<simpleError in dimnames(x) <- dn: length of 'dimnames' [1] not equal to array extent>

Attach your log file ArchR-addGeneIntegrationMatrix-58614bf112a-Date-2023-10-30_Time-15-42-50.log

To Reproduce Using tutorial data. See above.

Been struggling with this issue for over a week now. With my own data I've tried subsetting the cells to match cell names, changing the default assay to RNA, using rPCA integration instead of SCTransform integration, rerunning normalization/scaling/FindingVariableFeatures after integration, all to no avail. Any help would be very much appreciated. Thanks.

rcorces commented 11 months ago

Hi @dgagler! Thanks for using ArchR! Please make sure that your post belongs in the Issues section. Only bugs and error reports belong in the Issues section. Usage questions and feature requests should be posted in the Discussions section, not in Issues.
It is worth noting that there are very few actual bugs in ArchR. If you are getting an error, it is probably something specific to your dataset, usage, or computational environment, all of which are extremely challenging to troubleshoot. As such, we require reproducible examples (preferably using the tutorial dataset) from users who want assistance. If you cannot reproduce your error, we will not be able to help. Before going through the work of making a reproducible example, search the previous Issues, Discussions, function definitions, or the ArchR manual and you will likely find the answers you are looking for. If your post does not contain a reproducible example, it is unlikely to receive a response.
In addition to a reproducible example, you must do the following things before we help you, unless your original post already contained this information: 1. If you've encountered an error, have you already searched previous Issues to make sure that this hasn't already been solved? 2. Did you post your log file? If not, add it now. 3.__ Remove any screenshots that contain text and instead copy and paste the text using markdown's codeblock syntax (three consecutive backticks). You can do this by editing your original post.

rcorces commented 11 months ago

The error is coming from Seurat. I imagine it is an environment problem and some package incompatibilities.

dgagler commented 11 months ago

Thanks for clarifying. I've gone over there to see if they can help...will mess around with package versions until then.

Jyoung-0108 commented 11 months ago

Hi, I encountered the same error. Have you figured it out? Thanks!

dgagler commented 11 months ago

Hey! I seem to have resolved this with the tutorial data by reverting to SeuratObject v4.1.3 (in tandem with Seurat v4.3)

remove.packages("SeuratObject")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/SeuratObject/SeuratObject_4.1.3.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Here's my sessionInfo() as well:

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

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

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

other attached packages:
 [1] uwot_0.1.16                 nabor_0.5.0                 SeuratObject_4.1.3          Seurat_4.3.0                rhdf5_2.42.1                SummarizedExperiment_1.28.0
 [7] Biobase_2.58.0              MatrixGenerics_1.10.0       Rcpp_1.0.11                 Matrix_1.6-1.1              GenomicRanges_1.50.2        GenomeInfoDb_1.34.9        
[13] IRanges_2.32.0              S4Vectors_0.36.2            BiocGenerics_0.44.0         matrixStats_1.0.0           data.table_1.14.8           stringr_1.5.0              
[19] plyr_1.8.9                  magrittr_2.0.3              ggplot2_3.4.4               gtable_0.3.4                gtools_3.9.4                gridExtra_2.3              
[25] ArchR_1.0.2                

loaded via a namespace (and not attached):
  [1] spam_2.9-1                        circlize_0.4.15                   igraph_1.5.1                      lazyeval_0.2.2                    sp_2.1-1                         
  [6] splines_4.2.2                     BiocParallel_1.32.6               listenv_0.9.0                     scattermore_1.2                   digest_0.6.33                    
 [11] foreach_1.5.2                     htmltools_0.5.6.1                 fansi_1.0.5                       BSgenome_1.66.3                   tensor_1.5                       
 [16] cluster_2.1.4                     doParallel_1.0.17                 ROCR_1.0-11                       remotes_2.4.2.1                   ComplexHeatmap_2.14.0            
 [21] globals_0.16.2                    Biostrings_2.66.0                 spatstat.sparse_3.0-3             colorspace_2.1-0                  ggrepel_0.9.4                    
 [26] xfun_0.40                         dplyr_1.1.3                       crayon_1.5.2                      RCurl_1.98-1.12                   jsonlite_1.8.7                   
 [31] spatstat.data_3.0-3               progressr_0.14.0                  survival_3.5-7                    zoo_1.8-12                        iterators_1.0.14                 
 [36] glue_1.6.2                        polyclip_1.10-6                   zlibbioc_1.44.0                   XVector_0.38.0                    leiden_0.4.3                     
 [41] GetoptLong_1.0.5                  DelayedArray_0.24.0               Rhdf5lib_1.20.0                   future.apply_1.11.0               shape_1.4.6                      
 [46] abind_1.4-5                       scales_1.2.1                      spatstat.random_3.2-1             miniUI_0.1.1.1                    viridisLite_0.4.2                
 [51] xtable_1.8-4                      clue_0.3-65                       reticulate_1.34.0                 dotCall64_1.1-0                   htmlwidgets_1.6.2                
 [56] httr_1.4.7                        RColorBrewer_1.1-3                ellipsis_0.3.2                    ica_1.0-3                         farver_2.1.1                     
 [61] pkgconfig_2.0.3                   XML_3.99-0.14                     deldir_1.0-9                      utf8_1.2.4                        labeling_0.4.3                   
 [66] reshape2_1.4.4                    tidyselect_1.2.0                  rlang_1.1.1                       later_1.3.1                       munsell_0.5.0                    
 [71] tools_4.2.2                       cli_3.6.1                         generics_0.1.3                    ggridges_0.5.4                    evaluate_0.22                    
 [76] fastmap_1.1.1                     goftest_1.2-3                     yaml_2.3.7                        knitr_1.45                        fitdistrplus_1.1-11              
 [81] purrr_1.0.2                       RANN_2.6.1                        nlme_3.1-163                      pbapply_1.7-2                     future_1.33.0                    
 [86] mime_0.12                         compiler_4.2.2                    rstudioapi_0.15.0                 plotly_4.10.3                     png_0.1-8                        
 [91] spatstat.utils_3.0-4              tibble_3.2.1                      stringi_1.7.12                    lattice_0.21-9                    vctrs_0.6.4                      
 [96] pillar_1.9.0                      lifecycle_1.0.3                   rhdf5filters_1.10.1               spatstat.geom_3.2-7               lmtest_0.9-40                    
[101] GlobalOptions_0.1.2               RcppAnnoy_0.0.21                  cowplot_1.1.1                     bitops_1.0-7                      irlba_2.3.5.1                    
[106] httpuv_1.6.12                     patchwork_1.1.3                   rtracklayer_1.58.0                R6_2.5.1                          BiocIO_1.8.0                     
[111] promises_1.2.1                    KernSmooth_2.23-22                parallelly_1.36.0                 codetools_0.2-19                  MASS_7.3-60                      
[116] rjson_0.2.21                      withr_2.5.2                       sctransform_0.4.1                 GenomicAlignments_1.34.1          Rsamtools_2.14.0                 
[121] GenomeInfoDbData_1.2.9            parallel_4.2.2                    tidyr_1.3.0                       rmarkdown_2.25                    BSgenome.Hsapiens.UCSC.hg19_1.4.3
[126] Cairo_1.6-1                       Rtsne_0.16                        spatstat.explore_3.2-5            shiny_1.7.5.1                     restfulr_0.0.15   
rcorces commented 11 months ago

thanks for reporting back

HaixJiang commented 8 months ago

I encountered the same issue and used the method provided by @dgagler to downgrade the SeuratObject to version 4.1.4. Is this a long-term solution to address the problem?

remove.packages("SeuratObject")
packageurl <- "http://cran.r-project.org/src/contrib/Archive/SeuratObject/SeuratObject_4.1.4.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
BartBryant commented 8 months ago

thanks @dgagler , i was able to resolve the same issue you had by removing current SeuratObject and installing SeuratObject_4.1.3 running with Seurat_4.3.0