11  Annotation and Gene Ontology enrichment

Annotation and Gene Ontology (GO) enrichment relate a list of regions to genes. 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 GO enrichment, which asks whether the genes near a set of regions share a function.

NoteIn this chapter you will learn
  • how annotation tools assign each region to a genomic feature and to a gene;
  • why the nearest gene is a biased choice, and how GREAT’s regulatory domains assign regions to genes instead;
  • what GREAT’s region test and gene test each ask;
  • how the choice of background decides the question that an enrichment test answers;
  • how to read GO terms, and how to recognise a term that rests on only a few genes.

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). An annotation tool overlaps each region with these features. Because features overlap each other, the 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 assigns each region to its nearest gene. This rule is often wrong for enhancers, which can act on genes further away. In addition, the rule has a bias: genes surrounded by long stretches of DNA without other genes collect many regions by chance. GREAT, a tool for the enrichment analysis 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 is assigned to every gene whose domain contains it.

Testing for enrichment

The Gene Ontology describes each gene with terms for its biological process, its molecular function and its cellular component (Gene Ontology Consortium 2023). An enrichment test asks whether more of your regions fall near the genes of a term than expected by chance.

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

  • A region test (binomial) asks whether more regions fall in the domains of the term’s genes than expected from the share of the genome that these domains cover.
  • A gene test (hypergeometric) asks whether more of the term’s genes are hit by at least one region than expected by chance.

The two tests answer different questions. A term that passes both tests is spread over many genes, whereas 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

An enrichment test always compares your regions with a background. The choice of background decides the question that the test answers:

  • 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.4

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 is also assigned 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 NCBI’s GO annotations for the genome. It tests:

  • each sample’s peaks against the genome, with the region test and the gene test;
  • each comparison’s gained and lost regions against all tested regions, with a region test. Since version 1.3.0, a long region that the differential analysis split into pieces is counted once.

On the GO Enrichment page, choose the region set and the ontology. For each term, the table shows the number of regions, the fold enrichment, the region false discovery rate (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 compared with all tested regions, only the region test applies. For these regions, EpiNexus 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 16) with the ATAC-seq peaks of the stem-cell dataset (Chapter 18).

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 lay within 1 kb of a gene start: 22 % for H3K27ac and 17 % for ATAC-seq (Table 11.1, Figure 11.1). Most lay in introns or between genes, at a median distance of about 10 kb from the nearest TSS. Many of these peaks are likely to be enhancers. For them, the nearest gene is only a first guess at the target (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 terms were “focal adhesion”, “actin filament organization” and “contractile muscle fiber”. These terms describe heart muscle. They therefore 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, the top terms rested on one to four genes. Their gene tests were not significant. This pattern is what GREAT calls “gene-specific enrichment”.
  • In the ATAC-seq set, the top term passed both tests (gene FDR 0.03), but all 25 of its genes were 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. A cluster of related genes can therefore pass both tests.

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

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.

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, check how many genes support it, and whether the gene test agrees. A term carried by a few genes, or by one gene cluster, describes those genes, not a pathway.

WarningPitfall: the nearest gene as the target

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

Key points

  • Annotation assigns each region to a genomic feature with an order of priority, because features overlap; by default, a promoter spans 3 kb on each side of a TSS.
  • Assigning each region to its nearest gene favours genes flanked by large intergenic regions. GREAT instead gives each gene a regulatory domain, and a region is assigned to every gene whose domain contains it.
  • GREAT’s region test and gene test answer different questions; a term that passes only the region test often comes from many regions near a few genes.
  • The background decides the question: one sample’s peaks against the genome describe the cell type, whereas changed regions against all tested regions describe the experiment.
  • In both case studies, most peaks lay in introns or between genes, so the nearest gene is only a first guess at their target.
  • Before you report a term, check how many genes support it, whether the gene test agrees and whether its genes form one cluster, such as the Cyp genes.

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.