Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindNeighbors() error: invalid class “Graph” object: superclass "Mnumeric" not defined.. #4436

Closed
BarryDigby opened this issue May 4, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@BarryDigby
Copy link

BarryDigby commented May 4, 2021

Hi,

Initially ran into this error on a small 1k pbmc dataset, but was able to reproduce it using the dataset given for the Guided Clustering Tutorial using the exact same Rmd file. IIRC, the error popped up when attempting to knit the document (however, when assembling my custom Rmd file, the code chunks ran perfectly fine). Since attempting to knit the document, the error has persisted - even after restarts of both RStudio and Ubuntu. Perhaps worth mentioning that I recently updated Ubuntu and did a fresh install of R, RStudio, perhaps I am missing a package but it is not obvious to me with my limited experience with Seurat.

line 267:

pbmc <- FindNeighbors(pbmc, dims = 1:10) # <- problem line
pbmc <- FindClusters(pbmc, resolution = 0.5)

# Look at cluster IDs of the first 5 cells
head(Idents(pbmc), 5)

Error:

Error in validObject(.Object) : invalid class “Graph” object: superclass "Mnumeric" not defined in the environment of the object's class

Traceback:

13. stop(msg, ": ", errors, domain = NA)
12. validObject(.Object)
11. .nextMethod(.Object = .Object, ... = ...)
10. callNextMethod()
9. initialize(value, ...)
8. initialize(value, ...)
7. new(Class = "Graph", i = c(0L, 6L, 102L, 203L, 292L, 421L, 451L, 511L, 547L, 618L, 651L, 767L, 963L, 978L, 1005L, 1043L, 1148L, 1156L, 1264L, 1337L, 1338L, 1385L, 1504L, 1554L, 1573L, 1620L, 1695L, 1851L, 1904L, 1991L, 2079L, 2136L, 2187L, 2296L, 2317L, ...
6. do.call(what = "new", args = object.list)
5. UpdateSlots(object = object)
4. `DefaultAssay<-.Graph`(object = `*tmp*`, value = assay)
3. `DefaultAssay<-`(object = `*tmp*`, value = assay)
2. FindNeighbors.Seurat(pbmc, dims = 1:10)
1. FindNeighbors(pbmc, dims = 1:10)

> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_IE.UTF-8       LC_NUMERIC=C               LC_TIME=en_IE.UTF-8        LC_COLLATE=en_IE.UTF-8     LC_MONETARY=en_IE.UTF-8   
 [6] LC_MESSAGES=en_IE.UTF-8    LC_PAPER=en_IE.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] SeuratObject_4.0.0 dplyr_1.0.5        patchwork_1.1.1    Seurat_4.0.1      

loaded via a namespace (and not attached):
  [1] nlme_3.1-152          spatstat.sparse_2.0-0 matrixStats_0.58.0    RcppAnnoy_0.0.18      RColorBrewer_1.1-2    httr_1.4.2            sctransform_0.3.2    
  [8] tools_4.0.5           utf8_1.2.1            R6_2.5.0              irlba_2.3.3           rpart_4.1-15          KernSmooth_2.23-20    uwot_0.1.10          
 [15] mgcv_1.8-35           DBI_1.1.1             lazyeval_0.2.2        colorspace_2.0-1      withr_2.4.2           tidyselect_1.1.1      gridExtra_2.3        
 [22] compiler_4.0.5        cli_2.5.0             plotly_4.9.3          labeling_0.4.2        scales_1.1.1          spatstat.data_2.1-0   lmtest_0.9-38        
 [29] ggridges_0.5.3        pbapply_1.4-3         goftest_1.2-2         stringr_1.4.0         digest_0.6.27         spatstat.utils_2.1-0  rmarkdown_2.7        
 [36] pkgconfig_2.0.3       htmltools_0.5.1.1     parallelly_1.25.0     fastmap_1.1.0         htmlwidgets_1.5.3     rlang_0.4.11          rstudioapi_0.13      
 [43] shiny_1.6.0           farver_2.1.0          generics_0.1.0        zoo_1.8-9             jsonlite_1.7.2        ica_1.0-2             magrittr_2.0.1       
 [50] Matrix_1.3-3          Rcpp_1.0.6            munsell_0.5.0         fansi_0.4.2           abind_1.4-5           reticulate_1.20       lifecycle_1.0.0      
 [57] stringi_1.5.3         yaml_2.2.1            MASS_7.3-54           Rtsne_0.15            plyr_1.8.6            grid_4.0.5            parallel_4.0.5       
 [64] listenv_0.8.0         promises_1.2.0.1      ggrepel_0.9.1         crayon_1.4.1          deldir_0.2-10         miniUI_0.1.1.1        lattice_0.20-44      
 [71] cowplot_1.1.1         splines_4.0.5         tensor_1.5            knitr_1.33            pillar_1.6.0          igraph_1.2.6          spatstat.geom_2.1-0  
 [78] future.apply_1.7.0    reshape2_1.4.4        codetools_0.2-18      leiden_0.3.7          glue_1.4.2            evaluate_0.14         data.table_1.14.0    
 [85] png_0.1-7             vctrs_0.3.8           httpuv_1.6.0          polyclip_1.10-0       gtable_0.3.0          RANN_2.6.1            purrr_0.3.4          
 [92] spatstat.core_2.1-2   tidyr_1.1.3           scattermore_0.7       future_1.21.0         assertthat_0.2.1      ggplot2_3.3.3         xfun_0.22            
 [99] mime_0.10             xtable_1.8-4          later_1.2.0           survival_3.2-11       viridisLite_0.4.0     tibble_3.1.1          tinytex_0.31         
[106] cluster_2.1.2         globals_0.14.0        fitdistrplus_1.1-3    ellipsis_0.3.2        ROCR_1.0-11  
@BarryDigby BarryDigby added the bug Something isn't working label May 4, 2021
@fana-nn
Copy link

fana-nn commented May 4, 2021

HI! Same issue appeared on my macOS Catalina 10.15.7... not recalling if I updated anything. Perhaps just restarted my MAC.

sobj <- FindNeighbors(object = sobj, reduction = "pca", dims = 1:pcs)

Computing nearest neighbor graph Computing SNN Error in validObject(.Object) : invalid class “Graph” object: superclass "Mnumeric" not defined in the environment of the object's class

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

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.0/Resources/lib/libRlapack.dylib

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] grid stats graphics grDevices utils datasets methods base

other attached packages:
[1] Signac_1.2.0 RColorBrewer_1.1-2 gtools_3.8.2 cowplot_1.1.1
[5] gridExtra_2.3 gplots_3.1.1 ggplot2_3.3.3 pheatmap_1.0.12
[9] SeuratObject_4.0.0 Seurat_4.0.1 dplyr_1.0.5

loaded via a namespace (and not attached):
[1] fastmatch_1.1-0 plyr_1.8.6 igraph_1.2.6
[4] lazyeval_0.2.2 splines_4.0.3 BiocParallel_1.24.1
[7] listenv_0.8.0 SnowballC_0.7.0 scattermore_0.7
[10] GenomeInfoDb_1.26.7 digest_0.6.27 htmltools_0.5.1.1
[13] fansi_0.4.2 magrittr_2.0.1 tensor_1.5
[16] cluster_2.1.2 ROCR_1.0-11 limma_3.46.0
[19] globals_0.14.0 Biostrings_2.58.0 matrixStats_0.58.0
[22] docopt_0.7.1 spatstat.sparse_2.0-0 colorspace_2.0-1
[25] ggrepel_0.9.1 sparsesvd_0.2 crayon_1.4.1
[28] RCurl_1.98-1.3 jsonlite_1.7.2 spatstat.data_2.1-0
[31] survival_3.2-11 zoo_1.8-9 ape_5.5
[34] glue_1.4.2 polyclip_1.10-0 gtable_0.3.0
[37] zlibbioc_1.36.0 XVector_0.30.0 leiden_0.3.7
[40] future.apply_1.7.0 BiocGenerics_0.36.1 abind_1.4-5
[43] scales_1.1.1 DBI_1.1.1 edgeR_3.32.1
[46] miniUI_0.1.1.1 Rcpp_1.0.6 viridisLite_0.4.0
[49] xtable_1.8-4 tidytree_0.3.3 reticulate_1.20
[52] spatstat.core_2.1-2 stats4_4.0.3 htmlwidgets_1.5.3
[55] httr_1.4.2 ellipsis_0.3.2 ica_1.0-2
[58] pkgconfig_2.0.3 farver_2.1.0 ggseqlogo_0.1
[61] uwot_0.1.10 deldir_0.2-10 locfit_1.5-9.4
[64] utf8_1.2.1 labeling_0.4.2 tidyselect_1.1.1
[67] rlang_0.4.11 reshape2_1.4.4 later_1.2.0
[70] munsell_0.5.0 tools_4.0.3 generics_0.1.0
[73] ggridges_0.5.3 stringr_1.4.0 fastmap_1.1.0
[76] goftest_1.2-2 ggtree_2.4.2 fitdistrplus_1.1-3
[79] caTools_1.18.2 purrr_0.3.4 RANN_2.6.1
[82] pbapply_1.4-3 future_1.21.0 nlme_3.1-152
[85] mime_0.10 slam_0.1-48 RcppRoll_0.3.0
[88] aplot_0.0.6 compiler_4.0.3 rstudioapi_0.13
[91] plotly_4.9.3 png_0.1-7 spatstat.utils_2.1-0
[94] treeio_1.14.4 tibble_3.1.1 tweenr_1.0.2
[97] stringi_1.5.3 lattice_0.20-44 Matrix_1.3-3
[100] vctrs_0.3.8 pillar_1.6.0 lifecycle_1.0.0
[103] BiocManager_1.30.12 spatstat.geom_2.1-0 lmtest_0.9-38
[106] RcppAnnoy_0.0.18 data.table_1.14.0 bitops_1.0-7
[109] irlba_2.3.3 httpuv_1.6.0 patchwork_1.1.1
[112] GenomicRanges_1.42.0 R6_2.5.0 promises_1.2.0.1
[115] lsa_0.73.2 KernSmooth_2.23-20 IRanges_2.24.1
[118] parallelly_1.25.0 codetools_0.2-18 MASS_7.3-54
[121] assertthat_0.2.1 withr_2.4.2 qlcMatrix_0.9.7
[124] sctransform_0.3.2 Rsamtools_2.6.0 S4Vectors_0.28.1
[127] GenomeInfoDbData_1.2.4 mgcv_1.8-35 parallel_4.0.3
[130] rpart_4.1-15 tidyr_1.1.3 rvcheck_0.1.8
[133] Rtsne_0.15 ggforce_0.3.3 shiny_1.6.0

@JoeHarman
Copy link

Hi, I'm also encountering the same issue, exact same command and error message. I installed Seurat in a fresh conda environment around 8 hours ago, and it worked fine. I then installed Scater, and suddenly I'm getting this error message. Perhaps there's specific dependency causing an issue?

R version 4.0.3 (2020-10-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

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

other attached packages:
[1] SeuratObject_4.0.0 Seurat_4.0.1

loaded via a namespace (and not attached):
[1] nlme_3.1-152 spatstat.sparse_2.0-0 matrixStats_0.58.0
[4] RcppAnnoy_0.0.18 RColorBrewer_1.1-2 httr_1.4.2
[7] repr_1.1.3 sctransform_0.3.2 tools_4.0.3
[10] utf8_1.2.1 R6_2.5.0 irlba_2.3.3
[13] rpart_4.1-15 KernSmooth_2.23-20 uwot_0.1.10
[16] mgcv_1.8-35 DBI_1.1.1 lazyeval_0.2.2
[19] colorspace_2.0-1 tidyselect_1.1.1 gridExtra_2.3
[22] compiler_4.0.3 plotly_4.9.3 scales_1.1.1
[25] spatstat.data_2.1-0 lmtest_0.9-38 ggridges_0.5.3
[28] pbapply_1.4-3 goftest_1.2-2 pbdZMQ_0.3-5
[31] stringr_1.4.0 digest_0.6.27 spatstat.utils_2.1-0
[34] base64enc_0.1-3 pkgconfig_2.0.3 htmltools_0.5.1.1
[37] parallelly_1.25.0 fastmap_1.1.0 htmlwidgets_1.5.3
[40] rlang_0.4.11 shiny_1.6.0 generics_0.1.0
[43] zoo_1.8-9 jsonlite_1.7.2 ica_1.0-2
[46] dplyr_1.0.5 magrittr_2.0.1 patchwork_1.1.1
[49] Matrix_1.3-3 Rcpp_1.0.6 IRkernel_1.1.1
[52] munsell_0.5.0 fansi_0.4.2 abind_1.4-5
[55] reticulate_1.20 lifecycle_1.0.0 stringi_1.5.3
[58] MASS_7.3-54 Rtsne_0.15 plyr_1.8.6
[61] grid_4.0.3 parallel_4.0.3 listenv_0.8.0
[64] promises_1.2.0.1 ggrepel_0.9.1 crayon_1.4.1
[67] deldir_0.2-10 miniUI_0.1.1.1 lattice_0.20-44
[70] IRdisplay_1.0 cowplot_1.1.1 splines_4.0.3
[73] tensor_1.5 pillar_1.6.0 igraph_1.2.6
[76] uuid_0.1-4 spatstat.geom_2.1-0 future.apply_1.7.0
[79] reshape2_1.4.4 codetools_0.2-18 leiden_0.3.7
[82] glue_1.4.2 evaluate_0.14 data.table_1.14.0
[85] png_0.1-7 vctrs_0.3.8 httpuv_1.6.0
[88] polyclip_1.10-0 spatstat.core_2.1-2 gtable_0.3.0
[91] RANN_2.6.1 purrr_0.3.4 tidyr_1.1.3
[94] scattermore_0.7 future_1.21.0 assertthat_0.2.1
[97] ggplot2_3.3.3 mime_0.10 xtable_1.8-4
[100] later_1.2.0 viridisLite_0.4.0 survival_3.2-11
[103] tibble_3.1.1 cluster_2.1.2 globals_0.14.0
[106] fitdistrplus_1.1-3 ellipsis_0.3.2 ROCR_1.0-11

@ftencaten
Copy link

I believe it's a problem related to the latest version of the Matrix package (1.3-3). I updated my packages today and ran into the same error message. Searching the web, I found this issue associating a similar error with the Matrix package. Downgrading for version 1.3-2 solved the problem.

A modification related to 'Mnumeric' is mentioned in the description of the update (https://cloud.r-project.org/web/packages/Matrix/news.html):
"removed the nowhere used (and unexported but still active) class union "Mnumeric" which actually trickled into many base classes properties. Notably would it break validity of factor with a proposed change in validity checking, as factors were also "Mnumeric" but did not fulfill its validity method."

@BarryDigby
Copy link
Author

Super detective work @ftencaten 😎

For posterity:

remove.packages("Matrix")
packageurl <- "https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.3-2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

@Zymaniswenzai
Copy link

Super detective work @ftencaten 😎

For posterity:

remove.packages("Matrix")
packageurl <- "https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.3-2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Very useful, thanks! And do not forget to restart your Rstudio. 😎

@Fiona-Pan
Copy link

same issue but the Matrix version 1.3-2 is not available for MacOS, please help

@BarryDigby
Copy link
Author

@Fiona-Pan One of our students mentioned this (mac specific) issue when attempting to install from source:
image

@Fiona-Pan
Copy link

@Fiona-Pan One of our students mentioned this (mac specific) issue when attempting to install from source:
image

thank you! that works!

@mojaveazure
Copy link
Member

Hi all,

This has been addressed with SeuratObject v4.0.1; from a fresh R session, simply reinstall SeuratObject to fix this compatibility issue with Matrix 1.3-3

install.packages("SeuratObject")

Please note: binaries have not been built for all platforms or pushed to all mirrors yet, so you may have to allow R to build SeuratObject from source

@ektapathak08
Copy link

thanks.
it solved the problem.

@peizhengdoudou
Copy link

I met the same issue for MacOS, and my friend noticed that it may be a version problem. So we install R package "Seurat" again, then the problem is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants