11  Annotation and Gene Ontology enrichment

A list of regions is hard to read on its own. This chapter shows two ways to give it meaning: annotation, which says what lies at and near each region, and Gene Ontology (GO) enrichment, which asks whether the genes near a set of regions share a function.

11.1 The question

Where are my regions: at promoters, in introns, or far from genes? And do the genes near them have something in common, such as a pathway or a cell function?

11.2 How it works

Assigning each region to a genomic feature

A gene annotation file (for example from GENCODE, Chapter 3) lists every gene, transcript, exon and untranslated region (UTR). Annotation tools overlap each region with these features. Because features overlap each other, a tool needs an order of priority. ChIPseeker, a widely used tool, “adopted the following priority”: promoter, 5′ UTR, 3′ UTR, exon, intron, downstream, intergenic (Yu et al. 2015; Yu 2026). By default, a promoter is the region from 3 kb upstream to 3 kb downstream of a transcription start site (TSS) (Yu et al. 2015).

Assigning each region to a gene

The simplest rule gives each region to its nearest gene. This is often wrong for enhancers, which can act on genes further away. The rule also has a bias: genes with long empty stretches of DNA around them collect many regions by chance. GREAT, a tool for enrichment of regions, found that “associating each binding site with the one or two nearest genes—introduces a strong bias toward genes that are flanked by large intergenic regions” (McLean et al. 2010).

GREAT instead gives each gene a regulatory domain: “a basal domain that extends 5 kb upstream and 1 kb downstream from its transcription start site”, extended to the domains of the nearest genes on each side, up to 1 Mb (McLean et al. 2010). A region belongs to every gene whose domain contains it.

Testing for enrichment

The Gene Ontology gives each gene terms that describe its biological process, molecular function and cellular component (Gene Ontology Consortium 2023). Enrichment asks: do more of my regions fall near genes with a term than you would expect by chance?

GREAT runs two tests (McLean et al. 2010):

  • A region test (binomial): do more regions than expected fall in the domains of the term’s genes, given how much of the genome those domains cover?
  • A gene test (hypergeometric): are more of the term’s genes hit by at least one region than expected?

The two tests answer different questions. A term that passes both is spread over many genes. A term that passes only the region test often comes from many regions near a few genes. GREAT calls the first “term-derived enrichment” and the second “gene-specific enrichment” (McLean et al. 2010).

Choosing the background

Enrichment always compares your regions with a background. The choice of background decides the question you ask:

  • One sample’s peaks against the whole genome asks: what kind of cell is this? The answer is usually the cell’s identity.
  • Changed regions against all tested regions asks: what is special about the regions that changed? This is the question of the experiment.

11.3 In EpiNexus

NoteIn EpiNexus 1.2

Annotation. EpiNexus annotates every sample’s peaks with the gene annotation of the genome (GENCODE for human and mouse), using ChIPseeker’s order of priority and a promoter of ±3 kb. Each peak also gets its nearest gene and its distance to that gene’s TSS. The Annotation page has the tabs Feature Distribution, Distance to TSS, Genomic Distribution and Annotation Table.

GO enrichment. EpiNexus uses GREAT’s regulatory domains (5 kb upstream and 1 kb downstream, extended up to 1 Mb) and the GO annotations of NCBI for the genome. It tests:

  • each sample’s peaks against the genome, with the region and the gene test;
  • each comparison’s gained and lost regions against all tested regions, with a region test.

On the GO Enrichment page, choose the region set and the ontology. The table shows, for each term, the number of regions, the fold enrichment, the region FDR, the genes hit (for example 4 / 9: four of the term’s nine genes), the gene FDR and the genes themselves.

TipBest practice

Look at terms that pass both tests. GREAT’s own results view shows only terms “statistically significant by both the binomial and hypergeometric tests”, with at least two-fold enrichment, because “each test has a bias that is compensated by the other test” (GREAT team 2026). EpiNexus uses the same rule, at FDR < 0.05, for one sample’s peaks. For gained and lost regions, which are tested against all tested regions, only the region test applies. EpiNexus then calls a term at FDR < 0.05 with at least two-fold enrichment, and shows the gene FDR beside it.

11.4 Reading the result

Where the peaks lie

Table 11.1 compares the H3K27ac peaks of the heart dataset (Chapter 14) with the ATAC-seq peaks of the stem-cell dataset (Chapter 16).

Table 11.1: Where the peaks of all samples lie, for H3K27ac (242,515 peaks, run cafc042f) and ATAC-seq (393,780 peaks, run 1e7862c4). Shares are rounded, so a column can add up to 101 %.
Feature H3K27ac, heart ATAC-seq, stem cells
Promoter (≤ 1 kb) 22 % 17 %
Promoter (1–3 kb) 11 % 9 %
Intron 43 % 39 %
Distal intergenic 18 % 27 %
Exon, UTRs, downstream 6 % 9 %
Median distance to the nearest TSS 9.5 kb 11.5 kb
A horizontal stacked bar of 100 %: promoter up to 1 kb 22 %, promoter 1–2 kb 5 %, promoter 2–3 kb 6 %, 5′ UTR 0 %, 3′ UTR 1 %, exon 3 %, intron 43 %, downstream up to 3 kb 2 %, distal intergenic 18 %.
Figure 11.1: Genomic features of the H3K27ac peaks of all four libraries (242,515 peaks). Figure made by EpiNexus 1.2.0 (run cafc042f).

In both datasets, only about a fifth of the peaks lie within 1 kb of a gene start. Most lie in introns or between genes, a median of about 10 kb from the nearest TSS. Many of them are likely enhancers. For them, the nearest gene is only a first guess (Chapter 13).

GO of all peaks: the cell type

For each of the four H3K27ac libraries, EpiNexus found more than 200 significant terms. The top ones were “focal adhesion”, “actin filament organization” and “contractile muscle fiber”. These describe heart muscle. They confirm the tissue, but they say nothing about the experiment.

GO of the changed regions: the experiment

Table 11.2: GO enrichment of the changed regions in the two case studies.
Dataset, region set Significant terms Pass both tests Top term by the region test
H3K27ac, lost (2,267 regions) 284 38 “response to denervation involved in regulation of muscle adaptation”: 26 regions, 4 genes
H3K27ac, gained (194 regions) 5 0 “type 2 fibroblast growth factor receptor binding”: 4 regions, 1 gene
ATAC-seq, lost (6,561 regions) 89 6 “arachidonate epoxygenase activity”: 29 regions, 25 Cyp genes

Read the top terms with care (Table 11.2):

  • In the H3K27ac sets, they rest on one to four genes. Their gene tests are not significant. This is GREAT’s “gene-specific enrichment”.
  • In the ATAC-seq set, the term passes both tests (gene FDR 0.03), but all 25 of its genes are Cyp genes. Members of this family lie side by side in the genome. The gene test counts genes, and cannot see that they are neighbours. So a cluster of related genes can pass both tests.

The strongest terms pass both tests and come from genes spread over the genome. For the H3K27ac lost regions, such terms describe heart conduction and contraction (Chapter 14).

Figure 11.2 shows these results on the GO Enrichment page.

A horizontal bar chart of the top 15 GO terms by minus log10 FDR of the region test, led by response to denervation involved in regulation, response to muscle inactivity and response to inactivity. Below it, a table sorted by gene FDR whose first row is cell communication involved in cardiac conduction, GO:0086065, 37 regions, 16.9 expected, fold 2.19, region FDR 0.001, genes hit 15 of 34, gene FDR 1.8e-4.
Figure 11.2: The GO Enrichment page for the lost H3K27ac regions of the heart example (run cafc042f), ontology Biological process. The chart shows the terms with the smallest region FDR; the first, “response to denervation …”, rests on four genes. The table below is sorted by gene FDR. Its first term, “cell communication involved in cardiac conduction”, passes both tests: 37 regions where 16.9 were expected (region FDR 0.001), and 15 of its 34 genes (gene FDR 1.8 × 10−4). EpiNexus 1.2 interface; not covered by the book’s licence.

11.5 Pitfalls

WarningPitfall: reading the GO terms of all peaks as a result

GO terms of a sample’s full peak list describe the cell type. To learn about the experiment, test the regions that changed between conditions, against all tested regions.

WarningPitfall: trusting a term without looking at its genes

Before you report a term, look at how many genes stand behind it, and whether the gene test agrees. A term carried by a few genes, or by one gene cluster, is about those genes, not a pathway.

WarningPitfall: the nearest gene as the target

In both examples, half of the peaks lie about 10 kb or more from a gene start. For such regions, the nearest gene is a guess. Enhancer–gene links (Chapter 13) give a better estimate, and experiments are needed to prove it.

11.6 Further reading

  • McLean et al. (2010): GREAT, its regulatory domains and its two tests.
  • Yu et al. (2015): ChIPseeker and genomic annotation.
  • Gene Ontology Consortium (2023): the Gene Ontology.