GseaVis 多条通路可视化 - junjunlab/GseaVis GitHub Wiki
引言
Y 叔的 gseaplot2 可以可视化多条通路,但是 GseaVis 只能可视化单条通路的,有小伙伴也想让 GseaVis 来可视化多条通路,于是花了一些时间改了改代码,仿照着 gseaplot2 的样子画画。
安装
github 地址:
重新安装获取新功能:
# install.packages("devtools")
devtools::install_github("junjunlab/GseaVis")
欢迎大家在 github 上留下你的小心心。
测试
加载测试数据:
library(GseaVis)
# load data
test_data <- system.file("extdata", "gseaRes.RDS", package = "GseaVis")
gseaRes <- readRDS(test_data)
选择多条通路绘图:
geneSetID = c('GOBP_NUCLEOSIDE_DIPHOSPHATE_METABOLIC_PROCESS',
'GOBP_REGULATION_OF_OSSIFICATION',
'GOBP_TISSUE_MIGRATION')
# all plot
gseaNb(object = gseaRes,
geneSetID = geneSetID)
保留上面两个图层:
# sub plot
gseaNb(object = gseaRes,
geneSetID = geneSetID,
subPlot = 2)
当然你也可以去除热图:
# remove heatbar
gseaNb(object = gseaRes,
geneSetID = geneSetID,
subPlot = 2,
rmHt = T)
调整图例位置
和长度
:
# wrap term name and adjust position
gseaNb(object = gseaRes,
geneSetID = geneSetID,
subPlot = 2,
termWidth = 35,
legend.position = c(0.8,0.8))
当然你还可以标注通路里的基因名称:
# add gene name
gene <- c("Entpd8","Htr2a","Nt5e","Actn3","Entpd1",
"Pfkp", "Tpi1","Igf1","Ddit4","Ak9")
gseaNb(object = gseaRes,
geneSetID = geneSetID,
subPlot = 2,
termWidth = 35,
legend.position = c(0.8,0.8),
addGene = gene)
你还可以添加NES
和P
值,不过我这里 采用了表格的形式:
# add NES and Pvalue
gseaNb(object = gseaRes,
geneSetID = geneSetID,
subPlot = 2,
termWidth = 35,
legend.position = c(0.8,0.8),
addGene = gene,
addPval = T,
pvalX = 0.05,pvalY = 0.05)
修改线条颜色, 如果超过四个通路,你可能得自己提供颜色,因为默认只有三个颜色:
# change line color
gseaNb(object = gseaRes,
geneSetID = geneSetID,
subPlot = 2,
termWidth = 35,
legend.position = c(0.8,0.8),
addGene = gene,
addPval = T,
pvalX = 0.05,pvalY = 0.05,
curveCol = jjAnno::useMyCol('paired',3))
结尾
感兴趣的小伙伴可以试试。有任何问题或者疑问欢迎在 github 留言讨论。