其他
gggsea 个性化绘制 GSEA 图
就像傍晚夜色中的酒
1引言
分享一个没人关注的 R 包 gggsea, 基于 ggplot 绘图系统去绘制 GSEA 图形,方便更多的个性化调整和修饰。
github 地址:
https://github.com/NicolasH2/gggsea
2安装
devtools::install_github("nicolash2/gggsea")
3使用介绍
输入数据需要你的排序的基因
和基因集
:
library(gggsea)
library(ggplot2)
# the sorted vector must be a named!
# The names are gene IDs and the actual values are numbers (some metric, e.g. log2FC)
rl <- gggsea::myRankedlist
# check
head(rl)
# 23026 80380 114836 84168 103695366 126353
# 4.289487 4.142811 4.121009 3.995638 3.911376 3.911376
# this list must be named! Each list item is a vector of gene IDs
setlist <- gggsea::mySetlist
# check
# head(setlist)
# $KEGG_GLYCOLYSIS_GLUCONEOGENESIS
# [1] "55902" "2645" "5232" "5230" "5162" "5160" "5161" "55276" "7167" "84532" "2203"
# [12] "125" "3099" "126" "3098" "3101" "127" "5224" "128" "5223" "124" "230"
# [23] "501" "92483" "5313" "160287" "2023" "5315" "5214" "669" "5106" "5105" "219"
# [34] "217" "218" "10327" "8789" "5213" "5211" "3948" "2597" "2027" "2026" "441531"
# [45] "131" "130" "3945" "220" "221" "222" "223" "224" "130589" "226" "1738"
# [56] "1737" "229" "57818" "3939" "2538" "5236" "2821"
#
# $KEGG_FRUCTOSE_AND_MANNOSE_METABOLISM
# [1] "4351" "5373" "5372" "8789" "5213" "2762" "5210" "5211" "9107" "7167" "29085"
# [12] "5209" "197258" "5208" "8776" "5207" "57016" "8790" "3795" "2203" "8898" "3099"
# [23] "3101" "3098" "226" "230" "229" "9108" "7264" "231" "6652" "29926" "5214"
# [34] "29925"
绘图:
# df needs the ranked list and a
df <- gseaCurve(rl, setlist)
# plot
ggplot() +
geom_gsea(df)
修改主题:
# the number defines the textsize
ggplot2::ggplot() +
geom_gsea(df) +
theme_gsea(7)
添加统计指标:
这里是使用 fgsea 包来计算 NES 及 p 值 的:
gsea <- fgsea::fgsea(setlist, rl, nperm = 1000)
df2 <- gseaCurve(rl, setlist, gsea)
ggplot2::ggplot() +
geom_gsea(df2) +
theme_gsea(7)
自定义颜色:
# you can also set linesize and ticksize
ggplot2::ggplot() +
geom_gsea(df2, linecolor=c("black","purple"),
tickcolor=c("green", "cyan")) +
theme_gsea(7)
添加水平线:
ggplot2::ggplot() +
geom_gsea(df2, zeroline = T) +
theme_gsea(7)
改变排列方式:
# you can also set ncol
ggplot2::ggplot() +
geom_gsea(df2, nrow=2) +
theme_gsea(7)
4结尾
大家感兴趣的可以去尝试一下。
欢迎加入生信交流群。加我微信我也拉你进 微信群聊 老俊俊生信交流群
(微信交流群需收取20元入群费用(防止骗子和便于管理)
)。
老俊俊微信:
知识星球:
所以今天你学习了吗?
今天的分享就到这里了,敬请期待下一篇!
最后欢迎大家分享转发,您的点赞是对我的鼓励和肯定!
如果觉得对您帮助很大,赏杯快乐水喝喝吧!
往期回顾
◀scRNAtoolVis 绘制单细胞 Marker 基因均值表达热图
◀genesorteR 快速准确鉴定亚群 Marker 基因
◀Seurat 官网单细胞教程四 (SCTransform 使用及 SCTransform V2 版本)
◀...