刚刚更新完monocle2的视频教程((视频教程): Monocle2安装包测试、分析流程及可视化修饰),那么monocle3也不能落下,毕竟不能厚此薄彼,有小伙伴也是有需求。所以我们紧接着制作了这部分内容。主要做了两个事情,第一是对流程进行了讲解,第二是写了两个函数,一个是分析函数,一个是热图可视化函数,主要的目的还是为了简化工作。至于monocle3其他的内容强参考之前的帖子。
首先是分析过程,monocle3的分析其实很简洁;
##run
cds_data <- ks_run_monocle3(object=cytotrace2_sce,
idents="cluster",
use_partition=F,
learn_graph_control=list(minimal_branch_len=9.5,euclidean_distance_ratio=1),
define_root=T,
know_root=T,
root_state="YSMP")
#plot
plot_cells(cds_data, label_cell_groups = F,
color_cells_by = "pseudotime",
label_branch_points = F,
label_roots =F,
label_leaves =F,
graph_label_size = 0,
cell_size=2,
trajectory_graph_color='black',
trajectory_graph_segment_size = 2)
然后就是拟时热图绘制:
#在monocle3分析中,我们使用graph_test函数分析过拟时差异基因,这个过程比较慢
modulated_genes <- graph_test(cds_data, neighbor_graph = "principal_graph", cores = 5)
plot_genes <- row.names(subset(modulated_genes, q_value < 0.01 & morans_I > 0.25))
image.png
#plot
ht1 = ks_monocle3_heatmap(cds = cds_data,
graph_gene = plot_genes,
celltype_color = c("#E69253", "#EDB931", "#E4502E", "#4f372d"),
cluster_color =c("#8f657d", "#42819F", "#86AA7D", "#CBB396"),
num_clusters=4)
image.png
#label gene
genes <- c("C1QB","C1QC","C1QA","MRC1","LGMN","MS4A7","MAF","FOLR2",
"HLA-DPA1","CLEC10A","IL10RA","CD163","KCTD12","CLEC7A","MS4A6A","CD14",
"ITM2A","CYTL1","MDK","SELP","CD24",
"S100A8","S100A9","S100A12")
ht2 = ks_monocle3_heatmap(cds = cds_data,
graph_gene = plot_genes,
celltype_color = c("#E69253", "#EDB931", "#E4502E", "#4f372d"),
cluster_color =c("#8f657d", "#42819F", "#86AA7D", "#CBB396"),
num_clusters=4,
labels = T,
label_genes = genes)
image.png
网友评论