- Read filtering is an important step in bioinformatics that removes or separates sequencing reads that do not meet predefined quality, length, or other technical requirements. Sequencing technologies generate reads with varying lengths, quality scores, nucleotide composition, and error profiles. Some reads may be too short to provide reliable biological information, while others may contain excessive sequencing errors, adapter contamination, ambiguous bases, or unwanted sequences. Read filtering helps improve the reliability of downstream analyses, including sequence alignment, genome assembly, variant detection, transcriptome analysis, metagenomics, and phylogenetic studies. However, filtering must be performed carefully because overly strict thresholds can remove useful biological information and introduce biases into the dataset.
- Read filtering and read trimming are related but different processes. Read filtering removes entire reads that fail specified criteria, whereas trimming removes unwanted bases from the ends or internal regions of reads while retaining the remaining sequence. For example, a read may be removed if its total length is below 50 bases, while a longer read may be retained after low-quality terminal bases have been trimmed. In some workflows, trimming is performed first and filtering is applied afterward. This approach allows researchers to remove technical sequences and poor-quality regions before evaluating the final length and quality of each read.
- Length thresholds are among the most commonly used filtering criteria. A minimum read-length threshold specifies the shortest sequence that will be retained. Reads shorter than this value are discarded because they may provide insufficient information for reliable alignment, assembly, or identification. The appropriate minimum length depends on the sequencing platform, organism, reference genome, read type, and downstream application. A minimum length of 50 bases may be suitable for some short-read workflows, while long-read sequencing often requires thresholds of hundreds or thousands of bases. These values are examples rather than universal standards.
- A maximum read-length threshold can also be applied in some analyses. It removes reads that exceed a specified length, although this is less common than minimum-length filtering. Maximum-length filtering may be useful when extremely long reads are suspected to be chimeric, represent technical artifacts, or are incompatible with a particular downstream tool. However, unusually long reads are not necessarily poor quality. They may span repetitive regions, structural variants, or entire transcripts and can be especially valuable for genome assembly and haplotype phasing. Therefore, maximum-length filtering should only be applied when there is a clear technical or analytical reason.
- Read length is commonly summarized using several statistical measures. Mean read length represents the average number of bases per read, while median read length describes the middle value after all reads have been ordered by length. The N50 read length is the length at which reads of that size or longer account for at least half of the total sequenced bases. These statistics help researchers understand the distribution of read lengths and evaluate the effect of filtering. A dataset with a high mean read length may still contain many short reads if a small number of extremely long reads increase the average. Therefore, the median, N50, and complete length distribution should also be considered.
- Minimum length thresholds have different implications for short-read and long-read sequencing. In Illumina sequencing, reads are usually generated at relatively uniform lengths, often around 50–300 bases depending on the experiment. Filtering very short reads can improve alignment specificity and reduce the influence of fragments that contain insufficient sequence information. However, aggressive length filtering may remove valid reads from small RNA, amplicon, or degraded RNA samples. For Oxford Nanopore and PacBio sequencing, read lengths are more variable. Filtering thresholds must account for the expected molecule size, library preparation, and intended analysis. A threshold appropriate for long-read genome assembly may be unsuitable for full-length transcript analysis or small microbial genomes.
- Quality-based filtering is another important method. It uses Phred quality scores to estimate the probability that a nucleotide has been incorrectly identified. The Phred score is calculated as:
[
Q = -10\log_{10}(P)
]
- where (Q) represents the quality score and (P) is the estimated probability of an incorrect base call. A higher score indicates a lower estimated error probability. For example, Q20 corresponds to an estimated error probability of 1%, while Q30 corresponds to 0.1%. Quality-based filtering may remove reads with a low average quality score or with too many bases below a specified quality threshold. These criteria are commonly used in short-read sequencing and can also be applied to long-read data, although quality-score calibration and error characteristics differ between sequencing platforms.
- Average read quality is calculated from the quality scores of all bases in a read. A read may be retained if its average quality is equal to or greater than a selected threshold. Another approach is to calculate the proportion of bases below a minimum quality score. For example, a filtering rule may remove reads if more than 20% of their bases have quality scores below Q20. These approaches provide different ways of identifying low-quality reads. Average quality can hide poor-quality regions within an otherwise reliable read, whereas a per-base threshold can be sensitive to localized low-quality positions. The filtering method should therefore reflect the expected error profile and the requirements of the downstream analysis.
- Ambiguous nucleotide content is another possible filtering criterion. In DNA and RNA sequencing, the letter N represents an unknown or undetermined nucleotide. Reads containing many ambiguous bases may be difficult to align accurately or may provide limited information for sequence classification. A filtering rule can specify the maximum number or percentage of ambiguous bases allowed in each read. However, a small number of ambiguous bases does not necessarily make a read unusable. Some sequencing technologies and biological samples naturally produce reads with uncertain positions, so the threshold should be selected according to the experiment.
- Adapter contamination, primer sequences, and other technical sequences should generally be removed before final read-length filtering. Sequencing adapters may remain in reads when the original DNA or RNA fragment is shorter than the sequencing read length or when adapter detection is incomplete. PCR primers may also remain in amplicon sequencing data. If these sequences are not removed, they can affect alignment, read classification, and sequence assembly. Tools such as Cutadapt, fastp, Trimmomatic, and BBDuk can remove adapters and primers before reads are evaluated against minimum-length and quality thresholds. The sequence length after trimming should be used when determining whether a read meets the final minimum-length requirement.
- Filtering criteria can be combined to create a more comprehensive read-selection strategy. For example, a workflow may retain only reads that meet a minimum length, have an average quality score above a specified value, and contain fewer than a defined percentage of ambiguous bases. Such combined filtering can improve data quality, but each additional criterion may reduce the number of retained reads. Researchers should therefore examine the contribution of each filtering step and report how many reads and bases are removed at every stage.
- Paired-end sequencing requires additional consideration. In paired-end sequencing, two reads originate from opposite ends of the same DNA fragment. If one read fails quality or length filtering, the workflow must decide whether to discard both reads or retain the surviving read as an unpaired sequence. Keeping only one mate can preserve useful sequence information, but it removes the paired-end relationship that helps with alignment and structural interpretation. Some alignment and variant-calling workflows can use orphan reads, while others expect properly paired reads. Tools such as fastp and Trimmomatic can produce paired and unpaired output files, allowing researchers to decide how to handle surviving mates.
- Read filtering in RNA sequencing requires special attention because transcript abundance and expression estimates can be affected by selective read removal. Reads from degraded RNA samples may be shorter than expected, and some transcripts may be represented by naturally short fragments. Filtering too aggressively may disproportionately remove reads from particular transcript regions or low-abundance transcripts. In small RNA sequencing, short sequences are biologically expected, so applying a minimum-length threshold designed for conventional mRNA sequencing would remove many valid molecules. Similarly, ribosomal RNA depletion, poly(A) selection, and other library preparation strategies influence the expected read characteristics. Filtering thresholds should be selected according to the RNA-seq protocol and the biological question.
- In amplicon sequencing, read length is often expected to fall within a relatively narrow range determined by the amplified target and primer design. Reads that are much shorter or longer than expected may indicate incomplete amplification, nonspecific products, primer contamination, or technical artifacts. Length filtering can therefore help retain reads corresponding to the intended target. However, biological insertions, deletions, or genuine length variation may also produce sequences outside the expected range. Researchers should avoid discarding unusual reads without considering the biological purpose of the experiment.
- Metagenomic sequencing requires particular care because a sample may contain organisms with different genome sizes, nucleotide compositions, and DNA fragment distributions. Some microbial sequences may be represented by shorter fragments than others, and filtering can affect the relative representation of organisms in the final dataset. Removing short reads may improve taxonomic classification in some cases, but it may also reduce the detection of low-abundance organisms. In amplicon-based microbiome studies, expected sequence length depends on the marker region, such as the 16S rRNA gene or fungal ITS region. Length filtering can help identify likely nonspecific amplification products, but it should be combined with quality assessment and suitable reference databases.
- Long-read sequencing requires filtering strategies that reflect the characteristics of the sequencing platform. Oxford Nanopore reads can vary substantially in length and quality, while PacBio HiFi reads generally have high consensus accuracy and platform-specific length distributions. For long-read genome assembly, retaining longer reads may improve repeat resolution and assembly contiguity, but sufficient total coverage and accuracy are also necessary. For transcriptome analysis, shorter reads may represent partial transcripts or degraded molecules, while full-length transcript studies require attention to transcript completeness. Tools such as NanoFilt, Filtlong, and platform-specific PacBio utilities can support long-read filtering. Filtering should be guided by the purpose of the experiment rather than by a single universal read-length threshold.
- Several bioinformatics tools are commonly used for read filtering. Cutadapt can remove adapters and primers, apply quality trimming, and discard reads below a specified minimum length. fastp provides adapter detection, quality filtering, length filtering, and detailed reports for short-read data. Trimmomatic supports paired-end and single-end filtering through operations such as sliding-window quality trimming and minimum-length selection. BBDuk provides k-mer-based filtering and trimming, including adapter removal and contaminant screening. SeqKit offers commands for sequence statistics, filtering, and manipulation of FASTA and FASTQ files. For long-read data, NanoFilt and Filtlong provide filtering options based on read quality, length, and other supported metrics. Researchers should check the documentation of each tool to confirm its compatibility with the sequencing platform and input format.
- The following command illustrates minimum-length filtering with Cutadapt for single-end FASTQ data:
cutadapt -m 50 \
-o filtered_reads.fastq.gz \
reads.fastq.gz
- In this example, reads shorter than 50 bases are discarded. The threshold is illustrative and should be adjusted according to the sequencing experiment and downstream analysis. If adapter trimming is also required, the appropriate adapter sequence can be supplied using the relevant Cutadapt option.
- For paired-end sequencing, Cutadapt can filter both mates while preserving the relationship between paired reads:
cutadapt -m 50 \
-o filtered_R1.fastq.gz \
-p filtered_R2.fastq.gz \
reads_R1.fastq.gz \
reads_R2.fastq.gz
- The paired output contains reads that meet the minimum-length requirement according to the tool’s paired-end handling. Researchers should inspect the tool report and decide how to handle pairs in which one mate fails filtering.
- The fastp program can combine quality filtering and minimum-length filtering in a single command:
fastp \
-i reads_R1.fastq.gz \
-I reads_R2.fastq.gz \
-o filtered_R1.fastq.gz \
-O filtered_R2.fastq.gz \
-q 20 \
-l 50 \
-h fastp_report.html \
-j fastp_report.json
- Here, -q 20 specifies a quality threshold and -l 50 sets the minimum retained read length. The exact interpretation of quality filtering depends on the fastp options and version. The HTML and JSON reports provide information about read counts, filtering, and quality before and after processing.
- Trimmomatic can also be used for paired-end filtering:
trimmomatic PE \
-phred33 \
reads_R1.fastq.gz \
reads_R2.fastq.gz \
filtered_R1_paired.fastq.gz \
filtered_R1_unpaired.fastq.gz \
filtered_R2_paired.fastq.gz \
filtered_R2_unpaired.fastq.gz \
SLIDINGWINDOW:4:20 \
MINLEN:50
- The SLIDINGWINDOW:4:20 operation evaluates a four-base window and trims when the average quality falls below Q20. The MINLEN:50 operation removes reads shorter than 50 bases after trimming. Paired and unpaired reads are written separately, allowing researchers to preserve surviving individual reads when one mate fails.
- For long-read data, NanoFilt can be used to apply minimum-length and quality thresholds to Oxford Nanopore FASTQ files:
gunzip -c reads.fastq.gz | \
NanoFilt -q 10 -l 1000 | \
gzip > filtered_reads.fastq.gz
- This example retains reads meeting the specified minimum average quality and length criteria. The values are illustrative and should not be applied automatically to every ONT dataset. Researchers should inspect the original quality and length distributions before selecting thresholds.
- Filtlong can also select long reads according to length and quality-related criteria:
filtlong –min_length 1000 \
–min_mean_q 10 \
reads.fastq.gz \
| gzip > filtered_reads.fastq.gz
- This example illustrates minimum-length and minimum-mean-quality filtering. Filtlong also supports other selection strategies, including retaining a specified amount of data. The appropriate options depend on the intended analysis and should be selected using the software documentation.
- After filtering, the resulting FASTQ files should undergo another round of quality assessment. The number of reads, total bases, mean and median read lengths, N50, quality-score distribution, and percentage of retained data should be compared with the original dataset. FastQC and MultiQC are commonly used for short-read quality assessment, while NanoPlot and NanoStat are suitable options for summarizing many long-read datasets. The reports help determine whether filtering improved the dataset or removed too much useful information.
- Read filtering can introduce selection bias when certain sequence types are more likely to be removed than others. For example, short transcripts, low-abundance microbial sequences, GC-rich regions, or sequences containing repetitive elements may be disproportionately affected by particular filtering rules. In variant analysis, excessive filtering can remove reads supporting genuine insertions, deletions, or low-frequency variants. In metagenomics, it can alter the relative representation of organisms. Researchers should therefore evaluate filtering effects in relation to the biological question and, where possible, compare results using alternative thresholds.
- Read filtering should also be distinguished from duplicate removal and contaminant removal. Duplicate removal identifies repeated sequencing observations that may arise from PCR amplification or optical artifacts, while contaminant removal targets sequences originating from unwanted organisms or technical sources. These processes may be included in the same preprocessing pipeline, but they address different problems. Removing duplicates or contaminants without understanding the library preparation and biological context can lead to the loss of genuine biological information.
- For reproducible analysis, researchers should record all filtering criteria, including minimum and maximum read lengths, quality thresholds, ambiguous-base limits, adapter sequences, and the software versions used. They should preserve the original sequencing files and retain filtering reports. The number of reads and bases removed at each stage should be documented so that the effects of preprocessing can be evaluated later. Workflow management systems such as Snakemake and Nextflow can help automate filtering steps and maintain consistent processing across multiple samples.
- Read filtering and length thresholds are essential components of sequencing data preprocessing. They help remove unsuitable reads, improve the reliability of downstream analyses, and make sequencing datasets more manageable. However, no single threshold is appropriate for every sequencing technology or biological application. Short-read, long-read, RNA-seq, amplicon, metagenomic, and single-cell datasets have different characteristics and require different filtering strategies. By selecting thresholds based on read-length distributions, quality scores, experimental design, and analytical objectives, researchers can improve data quality while minimizing the loss of valuable biological information.