readsCountSM <- as(as.matrix(readsCount),"dgCMatrix") # str(M1) 想转回去,as.matrix() 就可以了。 经测试, dgCMatrix格式的Rdata仅有CSV文本的十分之一大小,极大的节省了存储空间,建议转化成功后,删除所有CSV文本。 参考: Coercion of matrix tosparsematrix (dgCMatrix) and maintainingdimnames....
# we only convert the data layer, and keep the counts on-disk obj.sub[["RNA"]]$data <- as(obj.sub[["RNA"]]$data, Class = "dgCMatrix") # recluster the cells obj.sub <- FindVariableFeatures(obj.sub) obj.sub <- ScaleData(obj.sub) obj.sub <- RunPCA(obj.sub) obj.sub <- ...
方法调用:as.spM_DF(as(as.matrix(getData(100)),"dgCMatrix")) 2、 超大型数据框转换出稀疏矩阵 as.DF_spM<-function(data.use,chun_size="20000000",sparseClass="dgCMatrix"){lapply(split(seq(nrow(data.use)),(seq(nrow(data.use))-1)%/%as.numeric(chun_size)),function(nx){switch(sparseClass...
首先是安装和加载必备的包: remotes::install_github("bnprks/BPCells")# https://api.github.com/repos/bnprks/BPCells/tarball/HEADlibrary(BPCells)library(Seurat)library(SeuratObject)library(SeuratDisk)library(Azimuth)# needs to be set for large dataset analysisoptions(future.globals.maxSize =1e9) ...
library("Matrix")dg<-as(matrix_object,"dgCMatrix") 具体关于构建和解释稀疏矩阵,可以参照:https://blog.csdn.net/jeffery0207/article/details/122507934 题外 最后,其实如果不想这么麻烦,又不想去sample随机取样缩减数据量,大家也不用那么死板,那就先把大矩阵拆分成几个小的,转完之后再合并就行了,效果是一样...
方法调用:as.spM_DF(as(as.matrix(getData(100)),"dgCMatrix")) 2、 超大型数据框转换出稀疏矩阵 as.DF_spM <- function(data.use,chun_size="20000000",sparseClass="dgCMatrix") { lapply(split(seq(nrow(data.use)), (seq(nrow(data.use))-1) %/%as.numeric(chun_size) ) , function(nx) {...
就是BPCells这个R包可以通过on-disk storage的方法来读取和存储130万单细胞的数据集,然后Sketching这个方法可以从130万单细胞的数据集里面抽样但是还保留数据集的特性。 安装BPCells包 首先是安装和加载必备的包: 代码语言:javascript 代码运行次数:0 运行
就是BPCells这个R包可以通过on-disk storage的方法来读取和存储130万单细胞的数据集,然后Sketching这个方法可以从130万单细胞的数据集里面抽样但是还保留数据集的特性。 安装BPCells包 首先是安装和加载必备的包: 代码语言:javascript 代码运行次数:0 复制
row_var_dgcmatrix: ./seurat-4.1.0/R/RcppExports.R:120:row_var_dgcmatrix <- function(x, i, rows, cols) { RowVar, C 函数 ./seurat-4.1.0/R/RcppExports.R:64:RowVar <- function(x) { 3. R tips (1) 近似PCA: irlba::irlba() 部分奇异值分解 ...
Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int(0) ..@ p : int [1:8190] 0 0 0 0 0 0 0 0 0 0 ... ..@ Dim : int [1:2] 320127 8189 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ...