#安装任意包
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()$repos
options()$BioC_mirror
#https://bioconductor.org/packages/release/bioc/html/GEOquery.html
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("GOplot",ask = F,update = F)
data(EC)
david<- EC$david
colnames(david)
david[1:5,1:5]
genelist<- EC$genelist
colnames(genelist)
genelist[1:5,1:5]

生成circ
circ <- circle_dat(EC$david, EC$genelist)#创建绘图对象
dim(david)
dim(genelist)
dim(circ)
colnames(circ)
circ[1:5,1:8]

####
genes<- EC$genes
dim(genes)
colnames(genes)
genes[1:5,1:2]
process<-EC$process
class(process)
print(process)
# chord <- chord_dat(data = circ, genes = EC$genes)#生成带有选定基因列表的矩阵
# chord <- chord_dat(data = circ, process = EC$process)#生成带有选定GO term列表的矩阵
chord <- chord_dat(data=circ, genes=EC$genes, process=EC$process)#构建数据
head(chord)

最后画图
GOChord(chord, title="GOChord plot",#标题设置
space = 0.02, #GO term处间隔大小设置
limit = c(3, 5),#第一个数值为至少分配给一个基因的Goterm数,第二个数值为至少分配给一个GOterm的基因数
gene.order = 'logFC', gene.space = 0.25, gene.size = 5,#基因排序,间隔,名字大小设置
lfc.col=c('firebrick3', 'white','royalblue3'),##上调下调颜色设置
#ribbon.col=colorRampPalette(c("blue", "red"))(length(EC$process)),#GO term 颜色设置
ribbon.col=brewer.pal(length(EC$process), "Set3"),#GO term 颜色设置
)

bubble图
GOBubble(circ, title="GOBubble plot",##设置标题
labels = 5,##-log(adj p-value)>5
ID = TRUE,##TRUE显示符合标准的GO term ID,FALSE显示GO term name
table.legend = TRUE, table.col = TRUE, ##右侧表格设置
bg.col = FALSE#背景颜色设置
)

网友评论