satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.28k stars 910 forks source link

New RunUMAP issue #7831

Open graceq88 opened 1 year ago

graceq88 commented 1 year ago

Recently ran into an issue with the RunUMAP step of the introductory vignette. When I execute "pbmc <- RunUMAP(pbmc, dims = 1:10)", this is what I get:

00:04:48 UMAP embedding parameters a = 0.9922 b = 1.112 00:04:48 Read 2638 rows and found 10 numeric columns 00:04:48 Using Annoy for neighbor search, n_neighbors = 30 00:04:48 Building Annoy index with metric = cosine, n_trees = 50 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| 00:04:48 Writing NN index file to temp file /var/folders/s9/l0y815ps4kg6j1g6yfh622vw0000gn/T//Rtmp1VPcib/file8e51593ea0a3 00:04:48 Searching Annoy index using 1 thread, search_k = 3000 00:04:49 Annoy recall = 100% 00:04:49 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30 Error in connected_components_undirected(nrow(X), Xt@i, Xt@p, X@i, X@p) : no slot of name "i" for this object of class "dgRMatrix"

When I use RunTSNE for that line instead, it runs just fine. RunUMAP was working fine for me up until about a week ago, did something change?

breelege commented 1 year ago

I'm getting a similar error when running RunUMAP on my own data: 15:52:20 UMAP embedding parameters a = 0.9922 b = 1.112 15:52:20 Read 113 rows and found 30 numeric columns 15:52:20 Using Annoy for neighbor search, n_neighbors = 30 15:52:20 Building Annoy index with metric = cosine, n_trees = 50 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| 15:52:20 Writing NN index file to temp file /var/folders/wf/wsv9w3n14sddyq0lkpyrtx9w0000gn/T//RtmpGC8DnH/filee49412d85fe9 15:52:20 Searching Annoy index using 1 thread, search_k = 3000 15:52:20 Annoy recall = 100% 15:52:21 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30 Error in connected_components_undirected(nrow(X), Xt@i, Xt@p, X@i, X@p) : no slot of name "i" for this object of class "dgRMatrix"

It also started having an error when trying to use the Seuratwrapper for Velocyto.R function RunVelocity at the same time. Filtering genes in the spliced matrix Filtering genes in the unspliced matrix Calculating embedding distance matrix calculating cell knn ... done calculating convolved matrices ... done fitting gamma coefficients ... Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class ‘structure("dsparseVector", package = "Matrix")’ to a data.frame

mhkowalski commented 1 year ago

Hi,

Thanks for reporting your error. Are you running the vignette with the raw data supplied in the vignette or your own data?Also, could you please try running the code after converting your counts to a dgCMatrix?

library(Matrix)
not.sparse <- as.matrix(GetAssayData(pbmc, slot = "counts"))
dgc <- as(not.sparse, "dgCMatrix")
pbmc <- CreateSeuratObject(counts = dgc)
efratsh12 commented 1 year ago

Hi, I get the same as graceq88 for RunUMAP, running my own data. I checked: class(GetAssayData(sobj, slot = "counts")) [1] "dgCMatrix" attr(,"package") [1] "Matrix" PCA and tSNE works fine.

I added the code above:

not.sparse <- as.matrix(GetAssayData(sobj, slot = "counts")) dgc <- as(not.sparse, "dgCMatrix") sobj <- CreateSeuratObject(counts = dgc) sobj <- subset(sobj, subset = nFeature_RNA > 200 & nFeature_RNA < 3000 ) sobj <- SCTransform(sobj) sobj <- RunUMAP(sobj, dims = 1:10)

Still the same: 11:30:11 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30 Error in connected_components_undirected(nrow(X), Xt@i, Xt@p, X@i, X@p) : no slot of name "i" for this object of class "dgRMatrix" Why dgRMatrix and not dgCMatix?

heba-ali2030 commented 11 months ago

Did you resolve this problem, how?

efratsh12 commented 11 months ago

I stopped using Matrixextra, left with other problem, but not this

Sent from Yahoo Mail on Android

On Sat, Nov 25, 2023 at 1:18 AM, @.***> wrote:

Did you resolve this problem, how?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

heba-ali2030 commented 11 months ago

Ok, thanks.

In my case I got this problem after merging my data with a published data but working on my data separately is still fine.

On Sat, Nov 25, 2023 at 7:38 AM efratsh12 @.***> wrote:

I stopped using Matrixextra, left with other problem, but not this

Sent from Yahoo Mail on Android

On Sat, Nov 25, 2023 at 1:18 AM, @.***> wrote:

Did you resolve this problem, how?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/satijalab/seurat/issues/7831#issuecomment-1826231571, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASXBMOARZLE464RNJ5JMMM3YGGG6NAVCNFSM6AAAAAA5FOVHDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGIZTCNJXGE . You are receiving this because you commented.Message ID: @.***>

Brandjo commented 7 months ago

I'm experiencing a similar issue when trying to run UMAP with seurat v5. I have a sketch from subsetting my data to 15k cells per layer and ran harmony for integration, though both pca embeddings and harmony fail at UMAP. Clustering can still be calculated if I bypass RunUMAP.


sketch <- RunUMAP(sketch, reduction = "harmony", dims = 1:10) %>%
+           FindNeighbors(reduction = "harmony", dims = 1:10) %>%
+           FindClusters(resolution = c(0.1, 0.2), algorithm = "leiden")

11:57:50 UMAP embedding parameters a = 0.9922 b = 1.112
Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics'
Also defined by ‘spam’
11:57:50 Read 30000 rows and found 10 numeric columns
11:57:50 Using Annoy for neighbor search, n_neighbors = 30
Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics'
Also defined by ‘spam’
11:57:50 Building Annoy index with metric = cosine, n_trees = 50
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
11:57:51 Writing NN index file to temp file C:\Users\hdlab\AppData\Local\Temp\Rtmp2tMJMV\file5e10591641a7
11:57:52 Searching Annoy index using 1 thread, search_k = 3000
11:57:58 Annoy recall = 100%
11:57:59 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
Error in connected_components_undirected(nrow(X), Xt@i, Xt@p, X@i, X@p) : 
  no slot of name "i" for this object of class "dgRMatrix"

Session Info:

R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

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

other attached packages:
 [1] MatrixExtra_0.1.15    harmony_1.2.0         Rcpp_1.0.12           BPCells_0.1.0         glmGamPoi_1.14.3      sctransform_0.4.1     Matrix_1.6-5          sceasy_0.0.7          reticulate_1.35.0    
[10] anndata_0.7.5.6       lubridate_1.9.3       forcats_1.0.0         stringr_1.5.1         dplyr_1.1.4           purrr_1.0.2           readr_2.1.5           tidyr_1.3.1           tibble_3.2.1         
[19] ggplot2_3.5.0         tidyverse_2.0.0       SeuratDisk_0.0.0.9021 Seurat_5.0.2          SeuratObject_5.0.1    sp_2.1-3             

loaded via a namespace (and not attached):
  [1] fs_1.6.3                    matrixStats_1.2.0           spatstat.sparse_3.0-3       bitops_1.0-7                enrichplot_1.22.0           HDO.db_0.99.1               httr_1.4.7                 
  [8] RColorBrewer_1.1-3          doParallel_1.0.17           tools_4.3.2                 utf8_1.2.4                  R6_2.5.1                    HDF5Array_1.30.1            lazyeval_0.2.2             
 [15] uwot_0.1.16                 rhdf5filters_1.14.1         GetoptLong_1.0.5            withr_3.0.0                 prettyunits_1.2.0           gridExtra_2.3               progressr_0.14.0           
 [22] cli_3.6.2                   Biobase_2.62.0              spatstat.explore_3.2-6      fastDummies_1.7.3           scatterpie_0.2.1            labeling_0.4.3              spatstat.data_3.0-4        
 [29] ggridges_0.5.6              pbapply_1.7-2               slingshot_2.10.0            yulab.utils_0.1.4           Rsamtools_2.18.0            gson_0.1.0                  DOSE_3.28.2                
 [36] R.utils_2.12.3              parallelly_1.37.0           rstudioapi_0.15.0           RSQLite_2.3.5               gridGraphics_0.5-1          generics_0.1.3              shape_1.4.6.1              
 [43] ica_1.0-3                   spatstat.random_3.2-2.001   GO.db_3.18.0                fansi_1.0.6                 S4Vectors_0.40.2            abind_1.4-5                 R.methodsS3_1.8.2          
 [50] lifecycle_1.0.4             SummarizedExperiment_1.32.0 qvalue_2.34.0               rhdf5_2.46.1                SparseArray_1.2.4           BiocFileCache_2.10.1        Rtsne_0.17                 
 [57] grid_4.3.2                  blob_1.2.4                  promises_1.2.1              crayon_1.5.2                miniUI_0.1.1.1              lattice_0.21-9              cowplot_1.1.3              
 [64] KEGGREST_1.42.0             pillar_1.9.0                ComplexHeatmap_2.18.0       fgsea_1.28.0                GenomicRanges_1.54.1        rjson_0.2.21                future.apply_1.11.1        
 [71] codetools_0.2-19            fastmatch_1.1-4             leiden_0.4.3.1              glue_1.7.0                  ggfun_0.1.4                 data.table_1.15.0           float_0.3-2                
 [78] treeio_1.26.0               vctrs_0.6.5                 png_0.1-8                   spam_2.10-0                 gtable_0.3.4                assertthat_0.2.1            cachem_1.0.8               
 [85] princurve_2.1.6             Signac_1.12.0               S4Arrays_1.2.0              mime_0.12                   tidygraph_1.3.1             survival_3.5-7              SingleCellExperiment_1.24.0
 [92] RcppRoll_0.3.0              SCP_0.5.6                   iterators_1.0.14            ellipsis_0.3.2              fitdistrplus_1.1-11         ROCR_1.0-11                 nlme_3.1-163               
 [99] ggtree_3.10.1               bit64_4.0.5                 filelock_1.0.3              progress_1.2.3              RcppAnnoy_0.0.22            GenomeInfoDb_1.38.7         rprojroot_2.0.4            
[106] R.cache_0.16.0              irlba_2.3.5.1               KernSmooth_2.23-22          colorspace_2.1-0            BiocGenerics_0.48.1         DBI_1.2.2                   tidyselect_1.2.0           
[113] proxyC_0.3.4                curl_5.2.0                  bit_4.0.5                   compiler_4.3.2              hdf5r_1.3.9                 xml2_1.3.6                  DelayedArray_0.28.0        
[120] plotly_4.10.4               shadowtext_0.1.3            scales_1.3.0                lmtest_0.9-40               rappdirs_0.3.3              digest_0.6.34               goftest_1.2-3              
[127] spatstat.utils_3.0-4        XVector_0.42.0              RhpcBLASctl_0.23-42         htmltools_0.5.7             pkgconfig_2.0.3             sparseMatrixStats_1.14.0    MatrixGenerics_1.14.0      
[134] dbplyr_2.4.0                fastmap_1.1.1               rlang_1.1.3                 GlobalOptions_0.1.2         htmlwidgets_1.6.4           shiny_1.8.0                 DelayedMatrixStats_1.24.0  
[141] farver_2.1.1                zoo_1.8-12                  jsonlite_1.8.8              BiocParallel_1.36.0         GOSemSim_2.28.1             R.oo_1.26.0                 RCurl_1.98-1.14            
[148] magrittr_2.0.3              ggplotify_0.1.2             GenomeInfoDbData_1.2.11     dotCall64_1.1-1             patchwork_1.2.0             Rhdf5lib_1.24.2             munsell_0.5.0              
[155] TrajectoryUtils_1.10.1      ggnewscale_0.4.10           ape_5.7-1                   viridis_0.6.5               stringi_1.8.3               ggraph_2.1.0                zlibbioc_1.48.0            
[162] MASS_7.3-60                 plyr_1.8.9                  parallel_4.3.2              listenv_0.9.1               ggrepel_0.9.5               deldir_2.0-2                graphlayouts_1.1.0         
[169] Biostrings_2.70.2           splines_4.3.2               tensor_1.5                  hms_1.1.3                   circlize_0.4.16             igraph_2.0.2                spatstat.geom_3.2-8        
[176] RcppHNSW_0.6.0              reshape2_1.4.4              biomaRt_2.58.2              stats4_4.3.2                XML_3.99-0.16.1             RcppParallel_5.1.7          tweenr_2.0.2               
[183] tzdb_0.4.0                  foreach_1.5.2               httpuv_1.6.14               RANN_2.6.1                  polyclip_1.10-6             future_1.33.1               clue_0.3-65                
[190] scattermore_1.2             ggforce_0.4.2               xtable_1.8-4                tidytree_0.4.6              RSpectra_0.16-1             later_1.3.2                 viridisLite_0.4.2          
[197] aplot_0.2.2                 clusterProfiler_4.10.0      memoise_2.0.1               AnnotationDbi_1.64.1        IRanges_2.36.0              cluster_2.1.4               timechange_0.3.0           
[204] globals_0.16.2              here_1.0.1