问题遇到的现象和发生背景
根据视频学习单细胞测序拟时序分析中出现的报错应该怎么解决
问题相关代码,请勿粘贴截图
library(monocle)
data <- as(as.matrix(scRNA@assays$RNA@counts), 'sparseMatrix')
pd <- new('AnnotatedDataFrame', data = scRNA@meta.data)
fData <- data.frame(gene_short_name = row.names(data), row.names = row.names(data))
fd <- new('AnnotatedDataFrame', data = fData)
mycds <- newCellDataSet(data,
phenoData = pd,
featureData = fd,
expressionFamily = negbinomial.size())
save(mycds, file = "c:/Users/LWD/Desktop/scRNAseq/mycds_raw.Rdata")
rm(list = ls())
load("../../tmp/mycds_raw.Rdata")
#library("monocle")
mycds <- estimateSizeFactors(mycds)
mycds <- estimateDispersions(mycds, cores=4, relative_expr = TRUE) #!
load("../../tmp/markergene.Rdata")
markers.gene <- all.markers$gene
mycds <- setOrderingFilter(mycds, markers.gene)
mycds <- reduceDimension(mycds, max_components = 2, method = 'DDRTree') #!
mycds <- orderCells(mycds)
#save(mycds,file = "../../tmp/mycds_reduced.Rdata")
load("../../tmp/mycds_reduced.Rdata")
p1 <- plot_cell_trajectory(mycds, color_by = "seurat_clusters")
ggsave("../../out/3.4trajectory_1.pdf", plot = p1)
p2 <- plot_cell_trajectory(mycds, color_by = "State")
ggsave("../../out/3.4trajectory_2.pdf", plot = p2)
运行结果及报错内容
data <- as(as.matrix(scRNA@assays$RNA@counts), 'sparseMatrix')
pd <- new('AnnotatedDataFrame', data = scRNA@meta.data)
fData <- data.frame(gene_short_name = row.names(data), row.names = row.names(data))
fd <- new('AnnotatedDataFrame', data = fData)
mycds <- newCellDataSet(data,
phenoData = pd,
featureData = fd,
expressionFamily = negbinomial.size())
save(mycds, file = "c:/Users/LWD/Desktop/scRNAseq/mycds_raw.Rdata")
mycds <- estimateSizeFactors(mycds)
mycds <- estimateDispersions(mycds, cores=4, relative_expr = TRUE)
Removing 95 outliers
Warning messages:
1:group_by_()
was deprecated in dplyr 0.7.0.
Please usegroup_by()
instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Calllifecycle::last_lifecycle_warnings()
to see where this warning was generated.
2:select_()
was deprecated in dplyr 0.7.0.
Please useselect()
instead.
This warning is displayed once every 8 hours.
Calllifecycle::last_lifecycle_warnings()
to see where this warning was generated.
markers.gene <- all.markers$gene
mycds <- setOrderingFilter(mycds, markers.gene)
mycds <- reduceDimension(mycds, max_components = 2, method = 'DDRTree')
p1 <- plot_cell_trajectory(mycds, color_by = "seurat_clusters")
mycds <- orderCells(mycds)
Error in if (class(projection) != "matrix") projection <- as.matrix(projection) :
the condition has length > 1
In addition: Warning message:
In graph.dfs(dp_mst, root = root_cell, neimode = "all", unreachable = FALSE, :
Argumentneimode' is deprecated; use
mode' instead
我的解答思路和尝试过的方法
感觉无从下手
我想要达到的结果
能解决报错并成功出图