5  From reads to alignments

Read processing turns the raw reads from the sequencer into clean alignments on the genome. The sequencer gives you millions of short reads. Before you can find peaks, each read must be cleaned, placed on the genome, and checked. This chapter explains each step, why it is needed, and which settings EpiNexus uses.

NoteIn this chapter you will learn
  • why reads are trimmed, and how Bowtie2 aligns them to the genome;
  • what the mapping quality of a read means, and why reads with a low mapping quality are removed;
  • when to remove duplicates, and why CUT&Tag and CUT&RUN target samples keep them;
  • which other reads are removed, and why ATAC-seq reads are shifted;
  • how many reads were usable after processing in the GSE155100 example.

5.1 The question

Which reads can you trust, and where do they come from? Some reads contain adapter sequence. Some fit equally well in several places in the genome. Some are copies of the same molecule. Some come from regions that give a false signal in every experiment. Each of these problems must be handled before the reads are counted.

5.2 The steps

Table 5.1: The read-processing steps.
Step Why Tool in EpiNexus
1. Trim Remove adapters and poor-quality bases Trim Galore (Cutadapt)
2. Align Find where each read comes from Bowtie2
3. Filter by mapping quality Remove reads that could come from several places SAMtools
4. Handle duplicates Remove copies made by PCR Picard
5. Remove blacklisted regions Remove reads from problem regions BEDTools
6. Keep intact pairs Keep only fragments with both ends SAMtools
7. ATAC-seq only Remove organelle reads, shift read ends SAMtools, deepTools

The table follows the order of this chapter. However, EpiNexus runs the filters in a slightly different order. It removes duplicates first, then reads with a low mapping quality, then (for ATAC-seq) organelle reads, and then reads in blacklisted regions. It then keeps only intact pairs. The ATAC-seq shift comes last.

1. Trimming

Trimming removes adapter sequence and poor-quality bases from the ends of reads. DNA fragments are sometimes shorter than the reads. In that case, the sequencer reads past the end of the fragment, into the adapter. These adapter bases do not exist in the genome, and therefore the read may fail to align. In addition, the end of a read tends to have a lower quality than the rest of the read.

Cutadapt is the standard tool for trimming (Martin 2011). Trim Galore runs Cutadapt and detects the adapter type by itself (Krueger et al. 2023).

NoteIn EpiNexus 1.4

EpiNexus runs Trim Galore on every sample. It trims bases with quality below 20 and removes reads shorter than 20 bases after trimming. For paired-end data, both files are trimmed together. For reduced-representation bisulfite sequencing (RRBS) data, it adds the option --rrbs, which removes the extra bases that RRBS library preparation adds.

2. Alignment

Alignment finds the place in the genome where each read fits best. EpiNexus uses Bowtie2 (Langmead and Salzberg 2012), a fast aligner for short reads.

For paired-end reads, both ends come from the same fragment. They must therefore align close to each other, facing each other. The aligner can require this. It can also set a maximum fragment length, which removes fragments that are too long to be real.

NoteIn EpiNexus 1.4

EpiNexus uses Bowtie2 settings that depend on the assay.

Table 5.2: Bowtie2 settings for paired-end reads.
Assay Paired-end settings
ChIP-seq fragments up to 1,000 bp; both ends must align as a proper pair
ATAC-seq fragments up to 2,000 bp; both ends must align as a proper pair
CUT&RUN, CUT&Tag --end-to-end --very-sensitive --no-mixed --no-discordant --phred33 -I 10 -X 700

The CUT&Tag settings are those of the CUT&Tag analysis tutorial, written by the authors of the method (Zheng et al. 2020). Single-end reads use Bowtie2’s defaults, except for CUT&RUN and CUT&Tag, which use the same sensitive mode as for paired-end reads. EpiNexus also uses --reorder, so that the output is the same every time the run is repeated.

3. Mapping quality

The mapping quality (MAPQ) of a read is the aligner’s confidence in the read’s position. Some parts of the genome repeat, and a read from a repeat can fit equally well in several places. The aligner then picks one place, but it cannot be sure of it. The Sequence Alignment/Map (SAM) format defines the mapping quality as “−10 log10 Pr{mapping position is wrong}” (SAM/BAM Format Specification Working Group 2025). Therefore:

  • MAPQ 10 means a 1 in 10 chance that the position is wrong;
  • MAPQ 20 means a 1 in 100 chance;
  • MAPQ 30 means a 1 in 1,000 chance.

Reads with a low mapping quality are removed. The ENCODE ChIP-seq pipeline removes reads below MAPQ 30 by default (ENCODE Data Coordination Center 2024), and EpiNexus does the same.

TipBest practice

Remove reads with a mapping quality below 30 (ENCODE Data Coordination Center 2024). This filter removes most reads from repeats. As a result, some repeated regions have no reads at all. This is a limitation of short reads, not a lack of signal.

4. Duplicates

Duplicates are reads from copies of the same DNA molecule. PCR makes these copies before sequencing, and the reads from them all start at the same position. Duplicates do not add information, and they can create false peaks where one molecule was copied many times. Picard MarkDuplicates finds them (Broad Institute 2023).

Whether to remove duplicates depends on the assay:

  • ChIP-seq and ATAC-seq: remove them. The ENCODE pipeline removes duplicates with Picard by default (ENCODE Data Coordination Center 2024).
  • CUT&Tag and CUT&RUN, target samples: keep them. The enzyme cuts the same accessible sites in many cells; identical fragments are therefore expected. The CUT&Tag tutorial says: “even the apparent ‘duplicate’ fragments are likely to be true fragments. Thus, we do not recommend removing the duplicates” (Zheng et al. 2020). A benchmark found that the peak caller SEACR works better when duplicates are kept than when they are removed (Murray et al. 2026).
  • CUT&Tag and CUT&RUN, IgG controls: remove them. Their reads come from cuts that are not targeted. Therefore, “it is appropriate to remove the duplicates from the IgG datasets” (Zheng et al. 2020).
NoteIn EpiNexus 1.4

EpiNexus removes duplicates for ChIP-seq, ATAC-seq and all controls. It keeps them for CUT&Tag and CUT&RUN target samples, but still measures the duplicate rate. You can also remove them from target samples: in the run wizard, tick Remove duplicate reads from target samples.

5. Blacklisted regions

Blacklisted regions are regions that give a strong signal in almost every experiment (Chapter 3). Reads in these regions should be removed “before application of any threshold, normalization, or peak calling” (Amemiya et al. 2019).

NoteIn EpiNexus 1.4

EpiNexus removes reads in blacklisted regions with BEDTools, for the seven genomes that have a blacklist (Chapter 3). After peak calling, it also removes peaks that overlap the blacklist, and peaks on unplaced or extra sequences.

6. Intact pairs

After filtering, one end of a fragment may be removed while the other end remains. A single end cannot give the fragment’s length. Therefore, for paired-end data, EpiNexus keeps only fragments whose two ends both passed every filter.

7. ATAC-seq: organelles and the Tn5 shift

Organelle reads. Mitochondria contain many copies of their own DNA, which is open and easy for the Tn5 transposase to cut. ATAC-seq libraries can therefore contain many mitochondrial reads. In plants, chloroplasts cause the same problem. These reads are removed before peak calling. Their share of all reads is a quality metric (Chapter 6).

The Tn5 shift. Tn5 cuts DNA as a pair of enzymes and leaves a gap of 9 bases between the two adapters. The true centre of the cut is therefore not at the start of the read. Buenrostro and colleagues corrected for this: “all reads aligning to the + strand were offset by +4 bps, and all reads aligning to the – strand were offset −5 bps” (Buenrostro et al. 2013). EpiNexus applies this shift with deepTools before it calls peaks and makes tracks (Ramírez et al. 2016).

5.3 Reading the result: GSE155100

This section shows how many reads were left after processing in the four H3K27ac libraries of our example.

Table 5.3: Reads before and after processing for the four H3K27ac libraries of GSE155100 (EpiNexus run 93a23cb5). “Usable” reads passed every filter: mapping quality 30 or more, not a duplicate, not in a blacklisted region.
Library Reads Mapped (%) Duplicates (%) Usable reads Usable (%)
ChIP Ctrl 1 15,381,085 97.8 9.0 11,972,753 77.8
ChIP Ctrl 2 17,471,098 94.7 9.5 13,244,804 75.8
ChIP cKO 1 16,262,965 97.9 9.2 12,610,392 77.5
ChIP cKO 2 16,553,728 94.3 8.2 12,576,563 76.0

About three quarters of the reads were usable, between 75.8 and 77.8 % per library (Table 5.3). The rest did not align, had a low mapping quality, were duplicates, or fell in blacklisted regions. Duplicates alone accounted for 8–10 % of the reads.

5.4 Pitfalls

WarningPitfall: removing duplicates from CUT&Tag targets

In CUT&Tag and CUT&RUN, identical fragments are often real. Removing them lowers the signal and can change which peaks SEACR finds (Murray et al. 2026; Zheng et al. 2020).

WarningPitfall: a low mapping rate

If fewer than about 80 % of reads align, look for the cause before you continue. Common causes are the wrong reference genome, contamination, adapters that were not trimmed, or a large spike-in.

WarningPitfall: forgetting the reads that were removed

Regions that contain repeats lose their reads at the mapping-quality filter. An empty region may therefore simply be unmappable. Check this in a genome browser before you conclude that a mark is absent.

Key points

  • Read processing trims the reads, aligns them to the genome with Bowtie2, and removes the reads that cannot be trusted.
  • The mapping quality says how sure the aligner is of a read’s position; EpiNexus, like the ENCODE pipeline, removes reads below MAPQ 30.
  • EpiNexus removes duplicates for ChIP-seq, ATAC-seq and all controls, but keeps them for CUT&Tag and CUT&RUN target samples, where identical fragments are expected.
  • Reads in blacklisted regions are removed, paired-end data keep only intact pairs, and ATAC-seq data also lose their organelle reads and have their read ends shifted.
  • In the GSE155100 example, about three quarters of the reads were usable after processing.
  • An empty region may be unmappable; check it in a genome browser before you conclude that a mark is absent.

5.5 Further reading

  • Langmead and Salzberg (2012): Bowtie2.
  • SAM/BAM Format Specification Working Group (2025): the SAM/BAM format, including mapping quality.
  • Zheng et al. (2020): the CUT&Tag analysis tutorial, including duplicates and alignment settings.
  • Buenrostro et al. (2013): ATAC-seq and the Tn5 shift.
  • Amemiya et al. (2019): the ENCODE Blacklist.