> scRNA <- FindNeighbors(scRNA, dims = pc.num)
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
Seurat执行FindNeighbor出现
invalid class “Graph” object: superclass "Mnumeric" not defined in the environment of the object's class
原因是 Matrix package (1.3-3) 新版本不兼容,解决方法就是降级到1.3-2
首先,我们需要卸载当前的Matrix
remove.packages("Matrix")
然后从存档里安装旧版本的Matrix
packageurl <- "https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.3-2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
国内用户可以用情况镜像源 (文件也就是1.9Mb, 应该不需要用到国内镜像进行加速)
packageurl <- "https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/Archive/Matrix/Matrix_1.3-2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
然后测试下, 发现问题已经解决了。
library(Seurat)
pbmc_small <- FindNeighbors(pbmc_small, reduction = "pca", dims = 1:10)
> library(Matrix)
Error in value[[3L]](cond) :
Package ‘Matrix’ version 1.3.3 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘Matrix’ is imported by ‘DelayedMatrixStats’, ‘mgcv’, ‘sctransform’, ‘SummarizedExperiment’, ‘irlba’, ‘BiocNeighbors’, ‘uwot’, ‘Seurat’, ‘rsvd’, ‘reticulate’, ‘BiocSingular’, ‘DelayedArray’, ‘leiden’, ‘survival’, ‘spatstat.data’, ‘spatstat’, ‘scater’ so cannot be unloaded
|
|
|
参考资料
https://github.com/satijalab/seurat/issues/4436