我正在利用R中的ggplot2軟件包通過計數來繪製功能類別。正如下圖所示,這些類別是按蛋白質計數排序的,也是根據它們所屬的類別排序的。在ggplot2中按類別劃分條形圖,同時保留Y軸的標籤結構
這裏是我參與工作的數據集的部分:
GO_Category protein_count Class
aromatic amino acid family metabolic process 24 Amino acid metabolism
glutamine family amino acid metabolic process 14 Amino acid metabolism
aspartate family amino acid metabolic process 10 Amino acid metabolism
glutamine family amino acid biosynthetic process 9 Amino acid metabolism
branched-chain amino acid metabolic process 8 Amino acid metabolism
peptidyl-lysine modification to hypusine 4 Amino acid metabolism
ornithine metabolic process 3 Amino acid metabolism
single-organism carbohydrate metabolic process 125 Carbohydrate metabolism
carbohydrate biosynthetic process 55 Carbohydrate metabolism
pentose metabolic process 7 Carbohydrate metabolism
mannose metabolic process 3 Carbohydrate metabolism
organelle organization 101 Cellular components
ribonucleoprotein complex biogenesis 41 Cellular components
plastid organization 35 Cellular components
這裏是一個代碼,我使用R:
nameorder <- df$GO_Category[order(df$Class, df$protein_count)]
df$GO_Category <- factor(df$GO_Category, levels=nameorder)
ggplot(data=df, aes(x=GO_Category, y=protein_count, fill=GO_Category)) +
geom_bar(color="black", stat="identity", width=0.5, position=position_dodge(.5)) +
coord_flip() +
guides(fill=FALSE) +
ylab("Protein Association Count") + xlab("Gene Ontology Category") +
theme(panel.grid.minor.y=element_blank(), panel.grid.major.y=element_blank(), axis.text.y=element_text(colour="#999999")) +
theme(panel.background = element_blank()) +
theme(text = element_text(size = 10)) +
geom_text(aes(label = protein_count), size = 3, hjust = -0.5)
我想do是通過它們的Class標識符面向組,但是保持y軸的結構。我在這方面的嘗試產生了一些相當醜陋的情節,似乎在每個方面重複y軸上的標籤。
這些類,你下載他們在哪? –