打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
单细胞marker基因平均表达量热图
userphoto

2022.12.14 重庆

关注

1、《KS科研分享与服务》公众号有QQ交流群,但是进入门槛是20元,请考虑清楚。群里有推文的注释代码和示例数据,付费内容半价,还可以与大家交流。

2、单细胞转录组全流程代码需收费,收费代码包含公众号付费内容,也有很多新增加的内容。需进群或者需单细胞代码的小伙伴请添加作者微信了解,请备注目的,除此之外请勿添加,谢谢!

3、付费文章集合有打包价哦!

详情请联系作者:

单细胞marker gene热图我们之前做过,也进行过改造:
单细胞基因可视化之热图改造修饰1
单细胞基因可视化之热图的根本改造2
但是那都是将所有细胞展现出来,最近有小伙伴问道如下的文献图,简单明了的一种细胞一列进行marker gene表达展示。这个图其实就是展示了平均的细胞表达量而已。我们简单做一下。此外,顺便复现下基因注释。
(reference:Dissecting the transcriptome landscape of the human fetal neural retina and retinal pigment epithelium by single-cell RNA-seq analysis)

首先我们得到marker gene:
library(Seurat)human_data <- readRDS("D:/KS/human_data.rds")DefaultAssay(human_data) <- "RNA"all.markers  <- FindAllMarkers(human_data,                                only.pos = TRUE,                                min.pct = 0.25,                                logfc.threshold = 0.75)
选择需要的marker gene进行展示,平均表达量使用seurat自带函数AverageExpression进行计算。热图使用Complexheatmap做即可。
#计算平均表达量gene_cell_exp <- AverageExpression(human_data,                                   features = gene,                                   group.by = 'celltype',                                   slot = 'data') gene_cell_exp <- as.data.frame(gene_cell_exp$RNA)
#complexheatmap作图library(ComplexHeatmap)#顶部细胞类型注释df <- data.frame(colnames(gene_cell_exp))colnames(df) <- 'class'top_anno = HeatmapAnnotation(df = df,#细胞名/cluster border = T, show_annotation_name = F, gp = gpar(col = 'black'), col = list(class = c('Macrophage'="#9ECABE", 'T cell'="#F6F5B4", 'mDC'="#2F528F", "Neutrophil"="#E3AD68", "Mast"="#ACD45E")))#颜色设置#数据标准化缩放一下marker_exp <- t(scale(t(gene_cell_exp),scale = T,center = T))Heatmap(marker_exp, cluster_rows = F, cluster_columns = F, show_column_names = F, show_row_names = T, column_title = NULL, heatmap_legend_param = list( title=' '), col = colorRampPalette(c("#0000EF","black","#FDFE00"))(100), border = 'black', rect_gp = gpar(col = "black", lwd = 1), row_names_gp = gpar(fontsize = 10), column_names_gp = gpar(fontsize = 10), top_annotation = top_anno)
重点知识来了,为热图行名添加分屏注释:
col_cluster <- setNames(c(rep("#9ECABE",5), rep("#F6F5B4",6),                          rep("#2F528F",5), rep("#E3AD68",5),                          rep("#ACD45E",4)),                        rownames(marker_exp))#设置对应标签颜色
row_info = rowAnnotation(foo = anno_text(rownames(marker_exp), location = 0, just = "left", gp = gpar(fill = col_cluster, col = "black"), width = max_text_width(rownames(marker_exp))*1.2))

Heatmap(marker_exp, cluster_rows = F, cluster_columns = F, show_column_names = F, show_row_names = T, column_title = NULL, heatmap_legend_param = list( title=' '), col = colorRampPalette(c("#0000EF","black","#FDFE00"))(100), border = 'black', rect_gp = gpar(col = "black", lwd = 1), row_names_gp = gpar(fontsize = 10), column_names_gp = gpar(fontsize = 10), top_annotation = top_anno)+row_info

legend自己修饰一下就可以了。Complexheatmap真的很强大,有很多有用的功能,慢慢的我们探索。觉得分享有用的、点个赞、分享下再走呗!

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
scRNA分析| 和SCI学 定制化聚类点图(Dotplot ),含二行代码出图方式
单细胞RNAseq常规分析流程(10X)
联合单细胞与TCGA数据建立肝癌预后模型
逐步深入绘制热图
R语言学习笔记之热图绘制
ComplexHeatmap()函数解析
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服