Monocle2拟时序报错:Error in orderCell
2024-01-07 本文已影响0人
春秋至
Error in orderCells: long vectors not supported yet
报错的具体信息:
cds <- orderCells(cds)
# Error in graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, :
# long vectors not supported yet: ../../src/include/Rinlinedfuns.h:138
# Calls: orderCells ... project2MST -> graph.adjacency -> graph.adjacency.dense -> .Call
这个报错的原因是细胞数量太多导致矩阵太大,在monocle2中会发生报错。有两个解决方案:
- 1.更新使用monocle3软件(推荐)。
- 2.减少用于拟时序分析的细胞数量或者特征数量。代码示例如下:
# sce是矩阵
monocle.matrix <- as.matrix(sce@assays$RNA@counts[disp.genes, ], 'sparseMatrix') # 事先使用高变基因或特定基因进行提取
monocle.sample <- sce@meta.data
monocle.geneAnn <- data.frame(gene_short_name = row.names(monocle.matrix), row.names = row.names(monocle.matrix))
monocle.geneAnn$gene_kk_name <- monocle.geneAnn$gene_short_name
data <- as(as.matrix(monocle.matrix), 'sparseMatrix')
pd <- new("AnnotatedDataFrame", data = monocle.sample)
fd <- new("AnnotatedDataFrame", data = monocle.geneAnn)
cds <- newCellDataSet(data, phenoData = pd, featureData = fd)
参考链接
https://github.com/cole-trapnell-lab/monocle-release/issues/138