?1、《KS科研分享與服務》公眾號有QQ交流群,但是進入門檻是20元,請考慮清楚。群里有推文的注釋代碼和示例數(shù)據(jù),付費內容半價,還可以與大家交流。 2、單細胞轉錄組全流程代碼需收費,收費代碼包含公眾號付費內容,也有很多新增加的內容。需進群或者需單細胞代碼的小伙伴請?zhí)砑幼髡呶⑿帕私?,請備注目的,除此之外請勿添加,謝謝! 3、付費文章集合有打包價哦! 詳情請聯(lián)系作者: ? 單細胞marker gene熱圖我們之前做過,也進行過改造:但是那都是將所有細胞展現(xiàn)出來,最近有小伙伴問道如下的文獻圖,簡單明了的一種細胞一列進行marker gene表達展示。這個圖其實就是展示了平均的細胞表達量而已。我們簡單做一下。此外,順便復現(xiàn)下基因注釋。(reference:Dissecting the transcriptome landscape of the
human fetal neural retina and retinal pigment
epithelium by single-cell RNA-seq analysis)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自帶函數(shù)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")))#顏色設置 #數(shù)據(jù)標準化縮放一下 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真的很強大,有很多有用的功能,慢慢的我們探索。覺得分享有用的、點個贊、分享下再走唄!
|