ArchR icon indicating copy to clipboard operation
ArchR copied to clipboard

Seurat FindClusters() Error when running addDoubletScores() and addIterativeLSI() ----> no slot of name "i" for this object of class "Graph"

Open solvi808 opened this issue 1 year ago • 6 comments

I am getting this error when running addDoubletScores() as well as addIterativeLSI()

no slot of name "i" for this object of class "Graph"

And it seems to originate in Seurats FindClusters 2023-03-22 14:07:38.16408 : Running Seurats FindClusters (Stuart et al. Cell 2019), 0 mins elapsed.

Attach your log file The logfile is attached ArchR-addDoubletScores-ee665622c22e-Date-2023-03-22_Time-14-04-57.383597.log

Bug addDoubletScores fails to run on my system for certain datasets. It works on the tutorial dataset but for some reason it fails for others.

I tried setting nthreads to 1, and force = TRUE, it didnt change anything.

To Reproduce

inputFiles
                                                                                                         scATAC 
"fragments.tsv.gz" 

ArrowFiles <- createArrowFiles(
  inputFiles = inputFiles,
  sampleNames = names(inputFiles),
  minTSS = 4, 
  minFrags = 1000, 
  addTileMat = TRUE,
  addGeneScoreMat = TRUE
)

doubScores <- addDoubletScores(
+   input = ArrowFiles,
+   k = 10, #Refers to how many cells near a "pseudo-doublet" to count.
+   knnMethod = "UMAP", #Refers to the embedding to use for nearest neighbor search with doublet projection.
+   force = FALSE ,
+   # threads=1 ,
+   LSIMethod = 1
+ )

Generates error

2023-03-22 13:20:57.377812 : ERROR Found in FindClusters for  
LogFile = ArchRLogs/ArchR-addDoubletScores-26752e67c3b2-Date-2023-03-22_Time-13-20-00.65384.log

<simpleError in check_valid_matrix(x): no slot of name "i" for this object of class "Graph">

etc.. ( see logfile)

NOTE I am also getting the same error for function addIterativeLSI()

proj <- addIterativeLSI(ArchRProj = proj, useMatrix = "TileMatrix", name = "IterativeLSI")
Checking Inputs...
ArchR logging to : ArchRLogs/ArchR-addIterativeLSI-d97d16b3ccec-Date-2023-03-22_Time-14-26-57.107646.log
If there is an issue, please report to github with logFile!
2023-03-22 14:26:57.257123 : Computing Total Across All Features, 0 mins elapsed.
2023-03-22 14:26:57.756215 : Computing Top Features, 0.009 mins elapsed.
###########
2023-03-22 14:26:59.68856 : Running LSI (1 of 2) on Top Features, 0.041 mins elapsed.
###########
2023-03-22 14:26:59.731368 : Sampling Cells (N = 10000) for Estimated LSI, 0.042 mins elapsed.
2023-03-22 14:26:59.73243 : Creating Sampled Partial Matrix, 0.042 mins elapsed.
2023-03-22 14:27:18.659442 : Computing Estimated LSI (projectAll = FALSE), 0.357 mins elapsed.
2023-03-22 14:28:35.906647 : Identifying Clusters, 1.645 mins elapsed.

************************************************************
2023-03-22 14:28:43.217833 : ERROR Found in FindClusters for  
LogFile = ArchRLogs/ArchR-addIterativeLSI-d97d16b3ccec-Date-2023-03-22_Time-14-26-57.107646.log

<simpleError in check_valid_matrix(x): no slot of name "i" for this object of class "Graph">

************************************************************


************************************************************
2023-03-22 14:28:43.222528 : ERROR Found in runClusters for  
LogFile = ArchRLogs/ArchR-addIterativeLSI-d97d16b3ccec-Date-2023-03-22_Time-14-26-57.107646.log

<simpleError in .logError(e, fn = "FindClusters", info = "", errorList = errorList,     logFile = logFile): Exiting See Error Above>

************************************************************


************************************************************
2023-03-22 14:28:43.232524 : ERROR Found in .LSICluster for  
LogFile = ArchRLogs/ArchR-addIterativeLSI-d97d16b3ccec-Date-2023-03-22_Time-14-26-57.107646.log

<simpleError in .logError(e, fn = "runClusters", info = "", errorList = errorList,     logFile = logFile): Exiting See Error Above>

************************************************************

Error in clusterDF$clusters : $ operator is invalid for atomic vectors

Session Info

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux bookworm/sid

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.21.so

Random number generation:
 RNG:     L'Ecuyer-CMRG 
 Normal:  Inversion 
 Sample:  Rejection 
 
locale:
[ArchR-addDoubletScores-d97d555f033f-Date-2023-03-22_Time-13-25-13.log](https://github.com/GreenleafLab/ArchR/files/11039871/ArchR-addDoubletScores-d97d555f033f-Date-2023-03-22_Time-13-25-13.log)

 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] SeuratObject_4.1.3                 Seurat_4.3.0                       Rsamtools_2.12.0                   BSgenome.Mmusculus.UCSC.mm10_1.4.3
 [5] BSgenome_1.64.0                    rtracklayer_1.56.1                 Biostrings_2.64.1                  XVector_0.36.0                    
 [9] hexbin_1.28.3                      rhdf5_2.40.0                       SummarizedExperiment_1.26.1        Biobase_2.56.0                    
[13] MatrixGenerics_1.8.1               Rcpp_1.0.10                        Matrix_1.5-3                       GenomicRanges_1.48.0              
[17] GenomeInfoDb_1.32.4                IRanges_2.30.1                     S4Vectors_0.34.0                   BiocGenerics_0.42.0               
[21] matrixStats_0.63.0                 data.table_1.14.8                  stringr_1.5.0                      plyr_1.8.8                        
[25] magrittr_2.0.3                     ggplot2_3.4.1                      gtable_0.3.3                       gtools_3.9.4                      
[29] gridExtra_2.3                      ArchR_1.0.2                        patchwork_1.1.2                    optparse_1.7.3                    

loaded via a namespace (and not attached):
  [1] circlize_0.4.15          igraph_1.4.1             MatrixExtra_0.1.13       lazyeval_0.2.2           sp_1.6-0                 splines_4.2.2           
  [7] BiocParallel_1.30.4      listenv_0.9.0            scattermore_0.8          digest_0.6.31            foreach_1.5.2            htmltools_0.5.4         
 [13] float_0.3-1              fansi_1.0.4              tensor_1.5               cluster_2.1.4            doParallel_1.0.17        ROCR_1.0-11             
 [19] ComplexHeatmap_2.12.1    globals_0.16.2           spatstat.sparse_3.0-1    colorspace_2.1-0         ggrepel_0.9.3            dplyr_1.1.0             
 [25] crayon_1.5.2             RCurl_1.98-1.10          jsonlite_1.8.4           spatstat.data_3.0-1      progressr_0.13.0         survival_3.5-5          
 [31] zoo_1.8-11               iterators_1.0.14         glue_1.6.2               polyclip_1.10-4          zlibbioc_1.42.0          leiden_0.4.3            
 [37] GetoptLong_1.0.5         DelayedArray_0.22.0      Rhdf5lib_1.18.2          future.apply_1.10.0      shape_1.4.6              abind_1.4-5             
 [43] scales_1.2.1             DBI_1.1.3                spatstat.random_3.1-4    miniUI_0.1.1.1           viridisLite_0.4.1        xtable_1.8-4            
 [49] clue_0.3-64              reticulate_1.28          htmlwidgets_1.6.2        httr_1.4.5               getopt_1.20.3            RColorBrewer_1.1-3      
 [55] ellipsis_0.3.2           ica_1.0-3                pkgconfig_2.0.3          XML_3.99-0.14            uwot_0.1.14              deldir_1.0-6            
 [61] utf8_1.2.3               reshape2_1.4.4           tidyselect_1.2.0         rlang_1.1.0              later_1.3.0              munsell_0.5.0           
 [67] tools_4.2.2              cachem_1.0.7             cli_3.6.0                generics_0.1.3           ggridges_0.5.4           fastmap_1.1.1           
 [73] goftest_1.2-3            yaml_2.3.7               RhpcBLASctl_0.23-42      fitdistrplus_1.1-8       purrr_1.0.1              RANN_2.6.1              
 [79] nlme_3.1-162             pbapply_1.7-0            future_1.32.0            mime_0.12                compiler_4.2.2           rstudioapi_0.14         
 [85] plotly_4.10.1            png_0.1-8                spatstat.utils_3.0-2     tibble_3.2.1             stringi_1.7.12           lattice_0.20-45         
 [91] vctrs_0.6.1              pillar_1.9.0             lifecycle_1.0.3          rhdf5filters_1.8.0       spatstat.geom_3.1-0      lmtest_0.9-40           
 [97] GlobalOptions_0.1.2      RcppAnnoy_0.0.20         cowplot_1.1.1            bitops_1.0-7             irlba_2.3.5.1            httpuv_1.6.9            
[103] R6_2.5.1                 BiocIO_1.6.0             promises_1.2.0.1         KernSmooth_2.23-20       parallelly_1.34.0        codetools_0.2-19        
[109] MASS_7.3-58.3            rjson_0.2.21             withr_2.5.0              sctransform_0.3.5        GenomicAlignments_1.32.1 GenomeInfoDbData_1.2.8  
[115] tidyr_1.3.0              Cairo_1.6-0              Rtsne_0.16               spatstat.explore_3.1-0   shiny_1.7.4              restfulr_0.0.15     

solvi808 avatar Mar 22 '23 12:03 solvi808

Hi @solvi808! 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.
Before we help you, you must respond to the following questions 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. Can you recapitulate your error using the tutorial code and dataset? If so, provide a reproducible example. 3. Did you post your log file? If not, add it now. 4. 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 avatar Mar 22 '23 12:03 rcorces

This error is coming from Seurat's FindClusters() function. I couldnt really say what is causing it. Maybe you could provide the ouptut of traceback() after getting the error?

rcorces avatar Mar 22 '23 19:03 rcorces

Hello, sure.

Here is the traceback from addDoubletScores()

12: stop("Exiting See Error Above")
11: .logError(e, fn = "addIterativeLSI", info = prefix, errorList = list(ArrowFile = ArrowFile), 
        logFile = logFile)
10: value[[3L]](cond)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
8: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch({
       do.call(addIterativeLSI, LSIParams)
   }, error = function(e) {
       .logError(e, fn = "addIterativeLSI", info = prefix, errorList = list(ArrowFile = ArrowFile), 
           logFile = logFile)
   })
6: FUN(X[[i]], ...)
5: lapply(...)
4: (function (..., threads = 1, preschedule = FALSE) 
   {
       if (tolower(.Platform$OS.type) == "windows") {
           threads <- 1
       }
       if (threads > 1) {
           .requirePackage("parallel", source = "cran")
           o <- mclapply(..., mc.cores = threads, mc.preschedule = preschedule)
           errorMsg <- list()
           for (i in seq_along(o)) {
               if (inherits(o[[i]], "try-error")) {
                   capOut <- utils::capture.output(o[[i]])
                   capOut <- capOut[!grepl("attr\\(\\,|try-error", 
                     capOut)]
                   capOut <- head(capOut, 10)
                   capOut <- unlist(lapply(capOut, function(x) substr(x, 
                     1, 250)))
                   capOut <- paste0("\t", capOut)
                   errorMsg[[length(errorMsg) + 1]] <- paste0(c(paste0("Error Found Iteration ", 
                     i, " : "), capOut), "\n")
    ...
3: do.call(.safelapply, args)
2: .batchlapply(args, sequential = TRUE)
1: addDoubletScores(input = ArrowFiles, k = 10, knnMethod = "UMAP", 
       force = FALSE, LSIMethod = 1)

traceback for addIterativeLSI() doesn't show much

1: addIterativeLSI(ArchRProj = proj, useMatrix = "TileMatrix", name = "IterativeLSI")

the error was Error in clusterDF$clusters : $ operator is invalid for atomic vectors

solvi808 avatar Mar 23 '23 10:03 solvi808

Sorry - I'm not really sure on this one. If you can make a reproducible example, I might be able to help.

rcorces avatar Mar 24 '23 21:03 rcorces

Hi, how it goes, did you solved the problem? I also faced the same problem for my dataset. Thank in advance.

frucelee avatar May 01 '23 08:05 frucelee

Hello, I have not but perhaps now with a different Seurat release it will be fixed (one can hope)

Since a reproducible example is needed, I could perhaps upload the fragments file on github (it is around 1.5GB)

solvi808 avatar May 02 '23 10:05 solvi808