❝1、《KS科研分享与服务》公众号有QQ交流群,进入门槛是20元(完全是为了防止白嫖党,请理解),请考虑清楚。群里有免费推文的注释代码和示例数据(终身拥有),没有付费内容,群成员福利是购买单个付费内容半价!
2、《KS科研分享与服务》微信VIP群只针对购买打包代码的小伙伴(公众号所有付费内容合集)!微信群不是单独的,是对于打包的人答疑解惑和交流的平台、群成员专享视频教程,帖子提前发布,以及其他更多福利!
点击:→ 加入微信vip群:2024-2025《KS科研分享与服务》付费内容打包集合
3、需进QQ群或者打包代码入微信VIP的小伙伴请添加作者微信了解,请备注目的,除此之外请勿添加,谢谢!
详情请联系作者:
❞
还是个花里胡哨的可视化,是关于GSEA的。首先进行致谢:https://github.com/YuLab-SMU/enrichplot,复现Nature图表:GSEA分析及可视化包装函数。富集分析(clusterProfiler)和部分可视化函数参考Y叔的包。也注意,我们这个函数的可视化针对的就是clusterProfiler包的GSEA分析结果,其他不适用!一部分可视化思路使用的是之前我们号“TS的美梦”发布的函数。完整版函数已发布微信VIP,请查收!可视化结果如下:
为什么有这样的可视化,之前群里有老师发的,目前没有参考文献!我们对其进行了优化,直接包为函数,方便使用,展示上做了选择,可以直接展示值,可以展示气泡图。首先看看函数参数:
res
#
# Gene Set Enrichment Analysis
#
#...@organism hsa
#...@setType KEGG
#...@keytype ENTREZID
#...@geneList Named num [1:15681] 9.58 8.87 8.07 7.94 7.67 ...
- attr(*, "names")= chr [1:15681] "11314" "84634" "123787" "4884" ...
#...nPerm
#...pvalues adjusted by 'BH' with cutoff <0.05
#...37 enriched terms found
'data.frame': 37 obs. of 11 variables:
$ ID : chr "hsa05168" "hsa03010" "hsa04080" "hsa04020" ...
$ Description : chr "Herpes simplex virus 1 infection" "Ribosome" "Neuroactive ligand-receptor interaction" "Calcium signaling pathway" ...
$ setSize : int 454 130 167 191 183 52 62 88 119 199 ...
$ enrichmentScore: num -0.385 0.601 0.528 0.497 0.478 ...
$ NES : num -1.97 2.17 1.95 1.85 1.78 ...
$ pvalue : num 4.85e-15 7.92e-10 2.36e-07 1.85e-06 1.26e-05 ...
$ p.adjust : num 1.62e-12 1.33e-07 2.63e-05 1.55e-04 8.45e-04 ...
$ qvalue : num 1.26e-12 1.03e-07 2.04e-05 1.20e-04 6.56e-04 ...
$ rank : num 4133 3497 1750 2180 3295 ...
$ leading_edge : chr "tags=43%, list=26%, signal=33%" "tags=65%, list=22%, signal=51%" "tags=32%, list=11%, signal=28%" "tags=31%, list=14%, signal=27%" ...
$ core_enrichment: chr "ZNF234/ZNF155/ZNF559/TBK1/ZNF790/ZNF3/ZNF761/ZNF565/ZNF763/ZNF79/ZNF180/ZFP37/SRSF7/ZSCAN32/ZNF286A/ZNF746/TNFR"| __truncated__ "MRPS6/RPL22L1/RPS27/RPS28/RPS9/RPL28/RPL12/RPL36/FAU/RPLP2/RPL10/RPL36AL/MRPL1/MRPL17/RPL10A/RPS21/RPL21/RPL37A"| __truncated__ "KISS1R/NMU/LEP/APLN/ADRB3/OPRK1/PTH1R/GABRB2/NMB/CHRM2/ADRA2B/ADRB1/GRIK4/GRIN2A/BDKRB1/PRSS3/EDN2/HRH1/CHRM4/A"| __truncated__ "CXCR4/ADRB3/FGF4/FGF22/CHRM2/NOS3/PDE1B/ADRB1/PRKCB/CACNA1I/CACNA1F/GRIN2A/BDKRB1/PDGFRA/HRH1/CACNA1E/VEGFA/SLC"| __truncated__ ...
#...Citation
T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu.
clusterProfiler 4.0: A universal enrichment tool for interpreting omics data.
The Innovation. 2021, 2(3):100141
setwd("D:\\KS项目\\公众号文章\\GSEA可视化new")
'df_Genes.csv', header = T) df <- read.csv(
$gene <- rownames(df) df
'df.csv') write.csv(df, file =
$gene_name, res <- KS_GSEA(gene = df
$log2FoldChange, LogFC = df
"KEGG", analysis =
'clusterProfiler', package =
'org.Hs.eg.db') OrgDb =
"res.RData") save(res, file =
# load("D:/KS项目/公众号文章/GSEA可视化new/res.RData")
ks_plot_gsea(data = res,
term = res@result$Description[1:10],
rankColor="#90191B",
labels_size=T)
ks_plot_gsea(data = res,
term = res@result$Description[1:10],
rankColor="#90191B",
labels_size=F)
ks_plot_gsea(data = res,
"immunoglobulin production", term = c(
"detection of light stimulus",
"B cell receptor signaling pathway",
"respiratory system development",
"regulation of viral entry into host cell",
"transmission of nerve impulse",
"macrophage migration",
"T cell cytokine production",
"regulation of guanylate cyclase activity",
"regulation of dendrite extension"),
"#90191B", rankColor=
labels_size=T)
ks_plot_gsea(data = res,
"immunoglobulin production", term = c(
"detection of light stimulus",
"B cell receptor signaling pathway",
"respiratory system development",
"regulation of viral entry into host cell",
"transmission of nerve impulse",
"macrophage migration",
"T cell cytokine production",
"regulation of guanylate cyclase activity",
"regulation of dendrite extension"),
"#90191B", rankColor=
labels_size=F)