偷偷问一下,关注了吗?
内容获取
1、购买打包合集(2025KS微信VIP付费合集),价格感人,可以加入微信VIP群(答疑交流群,甚至有小伙伴觉得群比代码更好),可以获取建号以来所有内容,群成员专享视频教程,提前更新,其他更多福利!
2、《KS科研分享与服务》公众号有QQ群,进入门槛是20元(完全是为了防止白嫖党,请理解),请考虑清楚。群里有免费推文的注释代码和示例数据(终身拥有),没有付费内容,群成员福利是购买单个付费内容半价!
需要者详情请联系作者(非需要者勿扰,处理太费时间):
函数参数如下:增加的参数首先第一个rownames_anno,传入一个向量,是需要标记的基因,如果基因过多的时候,不适宜全部展示,show_row_names选择F。第二个就是anno_enrich,默认F,如果需要添加富集结果的注释,选择T,需要注意,函数并未提供富集,富集结果需要手动展示。对应的注释传入enrich_terms,是一个list,此外,添加富集注释,一定要设置cluster_order,而且cluster_gene_length要与cluster_order一致。
library(Seurat)
library(ComplexHeatmap)
library(dplyr)
library(circlize)
library(rlang)
library(grDevices)
source('./ks_single_gene_heatmap.R')
Epi_cells$cluster <- as.character(Epi_cells$cluster)
#heatmap
pdf('./nmf_heat1.pdf', height = 8,width = 8)
ks_single_gene_heatmap(object=Epi_cells,assay = 'RNA',
genes = cluster_gene$gene,
bar = c("cluster"),
show_rownames = F,
heat_cols = colorRampPalette(c('#FFF7F3', '#FDE0DD', '#FCC5C0', '#FA9FB5', '#F768A1',
'#DD3497', '#AE017E', '#7A0177', '#49006A'))(100),
rownames_anno = c("NME2","GLIS3","DNAI1","PTPRC",
"GABARAP","PARD3","CDHR3","SRGN",
"PRDX2","MECOM","CFAP299","FYN",
"HINT1","CFAP157","CCL5"))
dev.off()
#标注富集结果
text2 = list("1"=c("labyrinthine layer morphogenesis",
"neural tube closure",
"epithelial tube morphogenesis"),
"2" =c("positive regulation of cell adhesion",
"Cell adhesion molecules",
"Inflammatory response pathway"),
"3"=c("Signaling by MET",
"PI3K-Akt signaling pathway"),
"4"=c("cellular response to abiotic stimulus",
"cellular response to environmental stimulus"))
pdf('./nmf_heat2.pdf', height = 8,width = 12)
ks_single_gene_heatmap(object=Epi_cells,assay = 'RNA',
genes = cluster_gene$gene, bar = c("cluster"),
show_rownames = F,
rownames_anno = c("NME2","GLIS3","DNAI1","PTPRC",
"GABARAP","PARD3","CDHR3","SRGN",
"PRDX2","MECOM","CFAP299","FYN",
"HINT1","CFAP157","CCL5"),
heat_cols = colorRampPalette(c('#FFF7F3', '#FDE0DD', '#FCC5C0', '#FA9FB5', '#F768A1',
'#DD3497', '#AE017E', '#7A0177', '#49006A'))(100),
anno_enrich=T,cluster_gene_length=c(50,50,50,50),
enrich_terms = text2,cluster_order = c("1","2","3","4"))
dev.off()
关注我们获取精彩内容:
关注不迷路:扫描下面二维码关注公众号!
B站视频号链接:https://space.bilibili.com/471040659?spm_id_from=333.1007.0.0
关注 KS科研分享与服务,
认清正版优质内容和服务!
优质内容持续输出,物超所值!
合作联系:ks_account@163.com