Monocle2: orderCells()

计算每个基因的 pseudotime

require(monocle)
require(Seurat)
require(dplyr)

#-------------------------------------------------------#
#Identify genes for ordering cells, "fullModelFormulaStr=" specify the conditions that we want to dominate the cell trajectory
#Or, we can use the genes identify by other ways
diff_test_res <- differentialGeneTest(Monocle2_object, fullModelFormulaStr = "~Media")   #In this case, "Media" is condition that we want to dominate the cell trajectory
trajectory_ordering_genes <- row.names (subset(diff_test_res, qval < 0.01))

#-------------------------------------------------------#
#Set the highly variable genes for dimension reduction
Monocle2_object <- setOrderingFilter(Monocle2_object, ordering_genes=trajectory_ordering_genes)

#-------------------------------------------------------#
#Dimension reduction by PCA, then other method based on PCA results
#For pseudotime calculation, the dimension reduction method "DDRTree" is recommended
Monocle2_object <- reduceDimension(Monocle2_object, max_components = 2, num_dim = 6, reduction_method = 'DDRTree', verbose = T)

#-------------------------------------------------------#
#Order cells (calculate pseudotime) by dimension reduction results (not PCA) produced by reduceDimension()
Monocle2_object <- orderCells(Monocle2_object, num_paths=1)

#-------------------------------------------------------#
#Show the dimention reduction and pseudotime results
plot_cell_trajectory(Monocle2_object)

版权声明:
作者:cc
链接:https://www.techfm.club/p/68727.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>