LSMA

LONDON SCHOOL OF MULTIOMICS & AI

LSMA

LONDON SCHOOL OF MULTIOMICS & AI

Free course

Free course

0 of 79 lessons

Protein–DNA binding with ChIP-seq: peaks and motifs

Protein–DNA binding with ChIP-seq: peaks and motifs

Protein–DNA binding with ChIP-seq: peaks and motifs

ChIP-seq maps where a protein binds the genome. Follow it from reads to peaks, check whether the experiment worked, and link the peaks to nearby genes and to the DNA pattern the protein recognises.

Cancer genomes: somatic mutations, signatures and copy number looked at changes to the DNA sequence itself. Many changes in a cell's behaviour come instead from which proteins sit on the DNA, and where. This lesson turns to that question with ChIP-seq, the assay that maps where a protein binds the genome, and follows it from reads to peaks, from peaks to genes, and from peaks to the short DNA patterns the protein recognises.

How ChIP-seq works

ChIP-seq stands for chromatin immunoprecipitation followed by sequencing. Chromatin is DNA together with the proteins packed around it. The method has four steps.

  1. Crosslink. Cells are treated with formaldehyde, which glues proteins to the DNA they are touching at that moment.
  2. Fragment. The chromatin is broken into pieces of a few hundred bases, usually by sound waves (sonication).
  3. Immunoprecipitate. An antibody that binds the protein of interest pulls it out of the mixture, together with the DNA fragments glued to it.
  4. Sequence. The crosslinks are reversed, the DNA is purified and sequenced like any other library.

The result is a set of reads enriched for the places where the protein was bound. The target can be a transcription factor, a protein that binds a specific DNA pattern and switches genes on or off, or a histone modification, a chemical mark on the proteins that DNA is wrapped around. The two give very different shapes. A transcription factor binds a short site, so its signal is a sharp peak a few hundred bases wide. A histone mark such as H3K27me3, which silences genes, can cover tens of thousands of bases, giving broad domains.

The input control

Reads do not pile up only where the protein binds. Open chromatin breaks more easily, some regions are copied more than once in the genome, and some sequences are simply easier to map. A control library corrects for this. The most common control, called input, is chromatin from the same cells taken through every step except the antibody. A region counts as bound only if the ChIP sample has clearly more reads there than the input. Without a control, a peak caller mistakes these background bumps for binding.

Why the reads sit beside the site

Each sequenced read covers only one end of its fragment. Fragments around a binding site start on both sides of it, so reads on the forward strand pile up just before the site and reads on the reverse strand just after it. The two piles are separated by roughly the fragment length. Peak callers estimate that distance from the data and shift each read towards the middle of its fragment, so the signal is centred on the binding site itself. With paired-end reads the whole fragment is known, and no estimate is needed.

Protein–DNA binding with ChIP-seq: peaks and motifs · LSMA free course On the left, forward-strand reads pile up just before a protein binding site and reverse-strand reads just after it. On the right, after each read is shifted by half the fragment length, the two piles merge into one peak centred on the site. 1 · READS AS SEQUENCED2 · AFTER SHIFTING navy: forward strand · vermilion: reverse peach: binding site one peak, centred on the site summit = highest point
Each read marks one end of a fragment, so the two strands pile up on either side of the bound protein. Shifting reads by about half the fragment length merges them into one peak whose summit marks the site. Schematic, not to scale.

From reads to peaks

The first steps are those of any DNA assay. Reads are checked and trimmed as in Quality control and Trimming and filtering, then aligned with a DNA aligner such as Bowtie2, as described in Beyond RNA-seq: other assays and pipelines; ChIP reads come from DNA, so no splice-aware aligner is needed. Duplicates are then marked, because a ChIP library starts from little DNA and PCR copies of one fragment would otherwise look like several independent reads supporting a peak.

A peak caller then scans the genome for regions with more reads than the control. The standard tool is MACS (Model-based Analysis of ChIP-Seq), now in its third version.

Terminal
conda create -n chip -c conda-forge -c bioconda bowtie2 samtools macs3 bedtools meme
conda activate chip

samtools markdup -r aligned/chip.fixmate.sorted.bam aligned/chip.dedup.bam
samtools markdup -r aligned/input.fixmate.sorted.bam aligned/input.dedup.bam

macs3 callpeak -t aligned/chip.dedup.bam -c aligned/input.dedup.bam \
    -f BAMPE -g hs -q 0.01 -n ctcf --outdir peaks

What this does

  • samtools markdup -r finds duplicate pairs and, with -r, removes them. It needs a BAM file that was sorted by name, given mate information with samtools fixmate -m, and then sorted by position; the file names here assume those steps were done.
  • macs3 callpeak compares the treatment file (-t) with the control (-c). -f BAMPE says the reads are paired, so MACS uses the real fragments instead of estimating their length.
  • -g hs gives the size of the genome that reads can map to; hs is the built-in value for human. For other genomes, give the number of bases instead.
  • -q 0.01 keeps peaks whose false discovery rate is below 1%, the same idea of controlling false positives among many tests that you met in Pathways and enrichment analysis.
  • -n ctcf is the prefix for the output files. Here the target is CTCF, a protein that binds a well-known DNA pattern and helps fold the genome into loops.

MACS writes several files into peaks/. The main one, ctcf_peaks.narrowPeak, is a BED-like table with one row per peak. Its first three columns are the chromosome, start and end, as in any BED file from Working with genomic intervals: BED files, overlaps and coverage. Column 7 is the fold enrichment over the control, columns 8 and 9 are the −log10 p-value and q-value, and column 10 is the summit: the distance from the peak's start to its highest point. The file ctcf_summits.bed holds the summits on their own.

For broad histone marks, add --broad. MACS then joins nearby enriched stretches into broad regions and writes a broadPeak file. Calling a broad mark in narrow mode splits each domain into many small peaks, which inflates the count and makes the domains hard to see.

Is the experiment any good?

The quality of a ChIP-seq experiment depends above all on the antibody. A poor antibody gives a library that is mostly background, and a peak caller will still find "peaks" in it. Three checks catch most problems.

  • FRiP, the fraction of reads in peaks: the share of all mapped reads that fall inside called peaks. A strong transcription factor experiment might have several per cent of its reads in peaks; a failed one has almost none. ENCODE's guidelines use a low threshold, around 1%, as a minimum for transcription factors.
  • Replicates. Real binding sites should appear in independent replicates. The IDR (irreproducible discovery rate) method ranks peaks in two replicates and keeps those whose ranks agree, and ENCODE uses it to define its final peak sets.
  • The blacklist. Some regions of the genome give a high signal in almost every experiment, whatever the antibody: repeats near centromeres, for example. The ENCODE blacklist lists them for the main genome builds, and peaks inside them are removed.
Terminal
total=$(samtools view -c -F 4 aligned/chip.dedup.bam)
inpeaks=$(bedtools intersect -u -a aligned/chip.dedup.bam -b peaks/ctcf_peaks.narrowPeak | samtools view -c -)
echo "FRiP: $inpeaks / $total"

bedtools intersect -v -a peaks/ctcf_peaks.narrowPeak -b ref/blacklist.bed > peaks/ctcf.clean.narrowPeak

What this does

  • samtools view -c -F 4 counts reads that are mapped: -F 4 excludes reads with flag 4, "unmapped".
  • bedtools intersect -u keeps each read that overlaps at least one peak, once, and passes it as BAM to samtools view -c -, which counts it. The - means "read from the pipe".
  • The last line uses -v, the opposite of -u: it keeps only the peaks that do not overlap the blacklist. Download the blacklist file for your genome build from the ENCODE blacklist repository.

Divide the two numbers to get FRiP. For a well-behaved CTCF experiment you would expect a clearly higher value than for a typical transcription factor, because CTCF binds tens of thousands of strong sites.

Worked example · reading FRiP and fold enrichment

suppose 30,000,000 mapped reads, of which 2,400,000 fall in peaks → FRiP = 8%
a peak with 120 ChIP reads where the scaled input predicts 8 → fold enrichment = 15

Step by step. FRiP is reads in peaks divided by all mapped reads: 2,400,000 ÷ 30,000,000 = 0.08, or 8%. Fold enrichment compares the ChIP reads in a peak with the number the control predicts there, after the control has been scaled to the same total depth: 120 ÷ 8 = 15.

What the answer means. Eight per cent of reads in peaks is a healthy signal for a transcription factor, comfortably above the minimum. A fold enrichment of 15 is a strong peak. Peaks with an enrichment of 2 or 3 are more numerous and more likely to include false ones, so sorting peaks by enrichment or q-value and looking at the top ones first is a good habit. These numbers are invented for the arithmetic; real values vary a great deal between proteins and antibodies.

From peaks to genes and motifs

A list of peaks becomes biology when you ask two questions: which genes are nearby, and what DNA pattern sits under the peaks.

Nearest genes

The simplest link between a peak and a gene is distance to the gene's transcription start site (TSS), where transcription begins. The commands below make a BED file of start sites from the annotation and find the closest one to every peak, using the sorting and interval tools from Working with genomic intervals: BED files, overlaps and coverage.

Terminal
awk -F'\t' 'BEGIN{OFS="\t"} $3=="gene" {
    if ($7=="+") s=$4-1; else s=$5-1
    match($9, /gene_id "[^"]+"/); id=substr($9, RSTART+9, RLENGTH-10)
    print $1, s, s+1, id, ".", $7 }' ref/genes.gtf | sort -k1,1 -k2,2n > ref/tss.bed

sort -k1,1 -k2,2n peaks/ctcf.clean.narrowPeak > peaks/ctcf.sorted.bed
bedtools closest -a peaks/ctcf.sorted.bed -b ref/tss.bed -d > peaks/ctcf.nearest.txt

What this does

  • The awk program reads only lines whose feature type (column 3) is gene. A gene on the forward strand starts at its start coordinate; one on the reverse strand starts at its end. GTF counts from 1 and BED from 0, so 1 is subtracted, and the result is a one-base interval.
  • match finds the text gene_id "…" in column 9, and substr keeps only the ID between the quotes.
  • bedtools closest needs both files sorted the same way, by chromosome and then by start. -d adds a last column with the distance in bases, 0 when the peak covers the start site.

Nearest is a starting point, not an answer. Many binding sites sit in enhancers, stretches of DNA that control a gene from tens or hundreds of thousands of bases away, often skipping the closest gene. The way the genome folds in three dimensions brings such enhancers next to their targets, the subject of Open chromatin with ATAC-seq, and the 3D genome.

Motifs

A transcription factor recognises a short DNA pattern, its motif. Motifs are written as a position weight matrix: for each position in the pattern, how likely each of A, C, G and T is. If ChIP-seq worked, the protein's known motif should be strongly enriched near the peak summits. Finding it is the best single check that the peaks are real, and finding an unexpected second motif can reveal a partner protein.

Terminal
awk 'BEGIN{OFS="\t"} {s=$2+$10; print $1, s-50, s+50, $4}' peaks/ctcf.clean.narrowPeak > peaks/summits100.bed
bedtools getfasta -fi ref/genome.fa -bed peaks/summits100.bed -fo peaks/summits100.fa
meme-chip -oc motifs -meme-nmotifs 3 -db ref/jaspar_vertebrates.meme peaks/summits100.fa

What this does

  • The awk line adds the summit offset (column 10) to the peak start, then takes 50 bases either side. A narrow window keeps the motif in view and leaves out the surrounding background. A peak within 50 bases of a chromosome end would give a negative start, so check for that on real data.
  • bedtools getfasta extracts the DNA of each window from the genome into a FASTA file.
  • meme-chip, from the MEME suite, looks for motifs that are over-represented in these sequences without being told what to look for, then compares each one with a database of known motifs. The database here is a file from JASPAR, the open collection of transcription factor motifs, downloaded in MEME format.

The report is an HTML page in motifs/ listing each motif found, how enriched and how centred on the summits it is, and its best matches in JASPAR. For CTCF the top motif should match CTCF's own entry. HOMER, with its findMotifsGenome.pl script, is a popular alternative that does a similar search directly from peak coordinates.

Go deeper: CUT&RUN and CUT&Tag

Newer methods map protein binding without crosslinking or sonication. In CUT&RUN, an antibody binds the target inside intact nuclei and guides a DNA-cutting enzyme to it; only the DNA next to the protein is cut free and sequenced. CUT&Tag uses an enzyme that cuts and adds sequencing adapters in one step.

Because so little background DNA is released, both need far fewer cells and reads than ChIP-seq, and they often run without an input control. The analysis is similar: align, call peaks, check FRiP and replicates. Some peak callers designed for this low background, such as SEACR, are tuned for it, although MACS is also widely used.

Genome-wide ChIP-seq was first described by Johnson, Mortazavi, Myers and Wold (2007, Science). MACS was introduced by Zhang et al. (2008, Genome Biology). The ENCODE consortium's quality guidelines, including FRiP and replicate checks, are set out by Landt et al. (2012, Genome Research); the IDR method is Li, Brown, Huang and Bickel (2011, Annals of Applied Statistics), and the blacklist is described by Amemiya, Kundaje and Boyle (2019, Scientific Reports). CUT&RUN is Skene and Henikoff (2017, eLife). Report the antibody (supplier and catalogue number), the control, the peak caller with its version and thresholds, and the blacklist used.

Common mistakes

  • Calling peaks without an input control, so background bumps become "binding sites".
  • Using narrow mode for a broad histone mark, or broad mode for a transcription factor.
  • Reporting a peak count without FRiP, replicates or blacklist filtering.
  • Assuming the nearest gene is the gene a binding site controls.

Key point

A peak is a statistical claim that reads are enriched over a control. Trust a peak set when the control is good, the replicates agree, the blacklist is removed and the expected motif sits at the summits.

Further reading · Module 5The ENCODE portal: thousands of public ChIP-seq experiments with their peaks and quality metrics. · JASPAR: the open database of transcription factor motifs. · All reading for this course

Check your understanding

1. What is the input control in a ChIP-seq experiment?

2. What does FRiP measure?

3. Why is the nearest gene not always the gene a binding site controls?

Ask LSMA