GO分類(lèi)條形圖

R 繪圖腳本

rm(list = ls())
library(ggplot2)
windowsFonts(myFont = windowsFont("Times New Roman"))
setwd("D:\\data\\kegg_go_class")
data <- read.table("test.DESeq2.goClass.xls.counts",sep='\t',header = T)
pdf(file="test.DESeq2.goClass.pdf",width=10,height=10)
dorder = factor(as.integer(rownames(data)),labels=data$GO_term) #對(duì)數(shù)據(jù)按GO_term排序
ggplot(data,aes(x=GO_term,y=Number_of_Genes,fill=GO_category))  +   #定義X軸,Y軸的數(shù)據(jù)和顏色填充
  geom_bar(stat="identity",position=position_dodge(0.7),width=0.8,aes(x=dorder))  + #定義柱形圖的寬度和間距
  coord_flip() +  #轉(zhuǎn)換橫縱坐標(biāo)
  ylim(0,600) +
  scale_fill_discrete(name="GO category") + #修改legend的tittle
  theme_bw() +
  theme(panel.grid =element_blank(),axis.text=element_text(size = 10,face = "bold")) + 
  geom_text(mapping = aes(label = Number_of_Genes),size = 4,hjust = -0.5) +
  ylab("Number of genes")  +#修改X軸標(biāo)簽
  xlab("")
dev.off()

繪圖結(jié)果

image.png

測(cè)試數(shù)據(jù)

GO_term GO_category Number_of_Genes
Aging   Organismal Systems  42
Excretory system    Organismal Systems  46
Environmental adaptation    Organismal Systems  72
Sensory system  Organismal Systems  78
Circulatory system  Organismal Systems  80
Digestive system    Organismal Systems  93
Development Organismal Systems  108
Endocrine system    Organismal Systems  207
Immune system   Organismal Systems  225
Nervous system  Organismal Systems  246
Biosynthesis of other secondary metabolites Metabolism  6
Xenobiotics biodegradation and metabolism   Metabolism  14
Metabolism of terpenoids and polyketides    Metabolism  19
Metabolism of cofactors and vitamins    Metabolism  23
Energy metabolism   Metabolism  27
Metabolism of other amino acids Metabolism  28
Overview    Metabolism  34
Nucleotide metabolism   Metabolism  37
Glycan biosynthesis and metabolism  Metabolism  40
Amino acid metabolism   Metabolism  52
Carbohydrate metabolism Metabolism  56
Lipid metabolism    Metabolism  78
Transcription   Genetic Information Processing  7
Replication and repair  Genetic Information Processing  9
Translation Genetic Information Processing  25
Folding, sorting and degradation    Genetic Information Processing  55
Membrane transport  Environmental Information Processing    9
Signaling molecules and interaction Environmental Information Processing    229
Signal transduction Environmental Information Processing    517
Cellular community - prokaryotes    Cellular Processes  6
Cell motility   Cellular Processes  47
Cell growth and death   Cellular Processes  146
Cellular community - eukaryotes Cellular Processes  158
Transport and catabolism    Cellular Processes  163

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 一:LoadRunner常見(jiàn)問(wèn)題整理1.LR 腳本為空的解決方法:1.去掉ie設(shè)置中的第三方支持取消掉2.在系統(tǒng)屬...
    0100閱讀 4,654評(píng)論 0 11
  • 一、 軟件測(cè)試基本概念 1 bug的概念 bug類(lèi)型:defect、fault、problem、error… pr...
    三口一個(gè)瓜閱讀 4,029評(píng)論 0 12
  • feisky云計(jì)算、虛擬化與Linux技術(shù)筆記posts - 1014, comments - 298, trac...
    不排版閱讀 4,379評(píng)論 0 5
  • 《R語(yǔ)言入門(mén)》的讀書(shū)筆記 本書(shū)的重點(diǎn)內(nèi)容及感悟: 第一章 導(dǎo)言 1、R是一個(gè)有著統(tǒng)計(jì)分析功能及強(qiáng)大作圖功能的軟件系...
    格式化_001閱讀 12,692評(píng)論 0 9
  • 淺草閑花,雀鳴春揚(yáng),枝頭未綠意已至,三兩戲風(fēng)翔。 矮樓斜窗,抹影散蕩,洗練碧藍(lán)萬(wàn)尺空,一目眺暖望。
    圖臣閱讀 213評(píng)論 0 2

友情鏈接更多精彩內(nèi)容