GOplot包

加载数据

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Load the library. -------------------------------------------------------

library(GOplot)

# Load the dataset. --------------------------------------------------------

data(EC)

# Get the result from a functions analysis. -------------------------------

head(EC$david)

# Get a list of selected genes and their logFC. ---------------------------

head(EC$genelist)

# Generate the plotting object --------------------------------------------

circ <- circle_dat(EC$david, EC$genelist)

柱状图GObar

1
2
3
4
5
6
7
8
9
10
11
12
# Barplot -----------------------------------------------------------------

# Generate a simple barplot
GOBar(subset(circ, category == 'BP'))

# Facet the barplot according to the categories of the terms
GOBar(circ, display = 'multiple')

# Facet the barplot, add a title and change the colour scale for the z-score
GOBar(circ, display = 'multiple',
title = 'Z-score coloured barplot',
zsc.col = c('yellow', 'black', 'cyan'))

气泡图GObubble

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Bubble plot -------------------------------------------------------------

# Generate the bubble plot with a label threshold of 3
GOBubble(circ, labels = 3)

# Add a title, change the colour of the circles, facet the plot according to the categories and change the label threshold
GOBubble(circ, title = 'Bubble plot',
colour = c('orange', 'darkred', 'gold'),
display = 'multiple',
labels = 3)

# Colour the background according to the category
GOBubble(circ, title = 'Bubble plot with background colour',
display = 'multiple',
bg.col = T,
labels = 3)

# Reduce redundant terms with a gene overlap >= 0.75...
reduced_circ <- reduce_overlap(circ, overlap = 0.75)
GOBubble(reduced_circ, labels = 2.8)

圈图GOCircle

1
2
3
4
5
6
7
8
9
10
11
# GOcircle ----------------------------------------------------------------

#Generate a circular visualization of the results of gene- annotation enrichment analysis
GOCircle(circ)

# Generate a circular visualization of selected terms
IDs <- c('GO:0007507', 'GO:0001568', 'GO:0001944', 'GO:0048729', 'GO:0048514', 'GO:0005886', 'GO:0008092', 'GO:0008047')
GOCircle(circ, nsub = IDs)

# Generate a circular visualization for 10 terms
GOCircle(circ, nsub = 10)

圈图GOChrod

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# GOChrod -----------------------------------------------------------------

# Dataset -----------------------------------------------------------------

# Define a list of genes which you think are interesting to look at. The item EC$genes of the toy
# sample contains the data frame of selected genes and their logFC. Have a look...
head(EC$genes)

# Since we have a lot of significantly enriched processes we selected some specific ones (EC$process)
EC$process

# Create the plot chord. ------------------------------------------------

# The genes and process parameters are optional
chord <- chord_dat(data = circ, genes = EC$genes, process = EC$process)

GOChord(chord, space = 0.02, gene.order = 'logFC', gene.space = 0.25, gene.size = 5)

# Display only genes which are assigned to at least three processes
GOChord(chord, limit = c(3, 0), gene.order = 'logFC')

热图GOHeat

1
2
3
4
5
6
7
8
9
# GOHeat ------------------------------------------------------------------

chord <- chord_dat(data = circ, genes = EC$genes, process = EC$process)

# First, we use the chord object without logFC column to create the heatmap
GOHeat(chord[,-8], nlfc = 0)

# Now we create the heatmap with logFC values and user-defined colour scale
GOHeat(chord, nlfc = 1, fill.col = c('red', 'yellow', 'green'))

聚类图GOCluster

1
2
3
4
5
# GOCluster ---------------------------------------------------------------

GOCluster(circ, EC$process, clust.by = 'logFC', term.width = 2)

GOCluster(circ, EC$process, clust.by = 'term', lfc.col = c('darkgoldenrod1', 'black', 'cyan1'))

Venn图GOVenn

1
2
3
4
5
6
# GOVenn ------------------------------------------------------------------

l1 <- subset(circ, term == 'heart development', c(genes,logFC))
l2 <- subset(circ, term == 'plasma membrane', c(genes,logFC))
l3 <- subset(circ, term == 'tissue morphogenesis', c(genes,logFC))
GOVenn(l1,l2,l3, label = c('heart development', 'plasma membrane', 'tissue morphogenesis'))

在线作图:VennDiagram