5  From reads to alignments

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.

5.1 The question

Which reads can I trust, and where do they come from? Some reads contain adapter sequence. Some fit equally well in several places of the genome. Some are copies of the same molecule. Some come from regions that give false signal in every experiment. Each of these 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. EpiNexus runs the filters in a slightly different order: it removes duplicates first, then reads with low mapping quality, then (for ATAC-seq) organelle reads, then reads in blacklisted regions. Then it keeps intact pairs. The ATAC-seq shift comes last.

1. Trimming

DNA fragments are sometimes shorter than the reads. Then the sequencer reads past the end of the fragment, into the adapter. These adapter bases do not exist in the genome, so the read may fail to align. The end of a read also tends to have lower quality.

Trimming removes adapter sequence and poor-quality bases from the ends of reads. Cutadapt is the standard tool for this (Martin 2011). Trim Galore runs Cutadapt and finds the adapter type by itself (Krueger 2023).

NoteIn EpiNexus 1.2

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 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. So they must align close to each other, facing each other. The aligner can enforce this. It can also limit the fragment length, which removes fragments that are too long to be real.

NoteIn EpiNexus 1.2

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 the ones in the CUT&Tag analysis tutorial by its authors (Zheng et al. 2020). Single-end reads use Bowtie2’s defaults, except for CUT&RUN and CUT&Tag, which use the same sensitive mode. EpiNexus also uses --reorder, so the output is the same every time the run is repeated.

3. Mapping quality

Some parts of the genome repeat. A read from a repeat can fit equally well in several places. The aligner then picks one place, but it is not sure. It reports its confidence as the mapping quality (MAPQ). The SAM format defines it as “−10 log10 Pr{mapping position is wrong}” (SAM/BAM Format Specification Working Group 2026). So:

  • 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 low mapping quality are removed. The ENCODE ChIP-seq pipeline removes reads below MAPQ 30 by default (ENCODE Data Coordination Center 2026). EpiNexus does the same.

TipBest practice

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

4. Duplicates

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

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 2026).
  • CUT&Tag and CUT&RUN, target samples: keep them. The enzyme cuts the same accessible sites in many cells, so identical fragments are 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 (Murray et al. 2026).
  • CUT&Tag and CUT&RUN, IgG controls: remove them. Their reads come from cuts that are not targeted, so “it is appropriate to remove the duplicates from the IgG datasets” (Zheng et al. 2020).
NoteIn EpiNexus 1.2

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 remove them for target samples too: in the run wizard, tick Remove duplicate reads from target samples.

5. Blacklisted regions

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

NoteIn EpiNexus 1.2

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 stays. A single end cannot give the fragment’s length. So, for paired-end data, EpiNexus keeps only fragments where both ends 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 Tn5 to cut. So ATAC-seq libraries can contain many mitochondrial reads. In plants, chloroplasts cause the same problem. These reads are removed before peak calling. Their share is a quality metric (Chapter 6).

The Tn5 shift. Tn5 cuts DNA as a pair of enzymes. It leaves a gap of 9 bases between the two adapters. So the true centre of the cut is not at the start of the read. Buenrostro and colleagues correct 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

Table 5.3 shows how many reads were left after processing, for 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 are usable. The rest did not align, had a low mapping quality, were duplicates, or fell in blacklisted regions. Duplicates alone account 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 going on. 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 simply be unmappable. Check this 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 (2026): 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.