- Quality assessment before and after sequencing data preprocessing is an essential part of bioinformatics because it helps researchers evaluate the reliability of raw sequencing data and determine whether preprocessing has improved its suitability for downstream analysis. Sequencing preprocessing commonly includes adapter removal, quality trimming, read filtering, contaminant screening, and the removal of technical artifacts. These operations can improve data quality, but they may also reduce the number of reads, change read-length distributions, and introduce biases if applied too aggressively. Comparing quality metrics before and after preprocessing provides a systematic way to evaluate these effects and determine whether the processed dataset is appropriate for further analysis.
- Quality assessment before preprocessing establishes the initial condition of the sequencing data. Raw FASTQ files may contain low-quality bases, adapter sequences, ambiguous nucleotides, short reads, duplicated reads, and other technical artifacts. The purpose of initial quality control is to identify these problems before selecting preprocessing methods. Researchers should not automatically remove every read or sequence flagged by a quality-control program. Some unusual patterns may reflect genuine biological characteristics, such as high GC content in particular microbial genomes, variable transcript lengths in RNA sequencing, or short sequences in small RNA experiments. Initial quality metrics must therefore be interpreted in the context of the sequencing technology, library preparation, sample type, and biological objective.
- After preprocessing, the same or equivalent metrics should be calculated again to evaluate the effects of trimming and filtering. A successful preprocessing workflow may reduce adapter contamination, improve the distribution of base quality scores, remove unsuitable short reads, and reduce the proportion of ambiguous or contaminating sequences. However, the total number of reads and bases will often decrease because some sequences or low-quality regions have been removed. This reduction is not necessarily a problem. The important question is whether the improvement in data suitability justifies the amount of information lost during preprocessing.
- One of the most important metrics is the total number of reads. It represents the number of sequencing sequences available for analysis and is commonly reported before and after filtering. A reduction in read count after preprocessing is expected when adapters, low-quality reads, and other unsuitable sequences are removed. Researchers should calculate the percentage of reads retained to understand how much of the original dataset remains. The percentage of reads retained can be calculated as:
[
\text{Reads retained (%)} =
\frac{\text{Number of reads after preprocessing}}
{\text{Number of reads before preprocessing}}
\times 100
]
- For example, if a sequencing dataset contains 10 million reads before preprocessing and 8.5 million reads afterward, the percentage of reads retained is 85%. This indicates that 15% of the original reads were removed. The retained percentage should be interpreted alongside the reasons for read removal and the quality improvement achieved.
- Total sequence yield is another important metric. It represents the total number of nucleotide bases contained in the sequencing dataset. Read filtering and trimming may reduce the total yield because complete reads or individual bases are removed. The number of bases retained can be calculated by comparing the total sequence length before and after preprocessing. This is especially important in whole-genome sequencing, metagenomics, and transcriptomics, where sequencing depth and data quantity influence analytical sensitivity. A dataset may retain a high percentage of reads but lose a substantial number of bases if long reads are heavily trimmed. Therefore, both read count and total base yield should be reported.
- Read-length distribution is particularly important when evaluating preprocessing. Before processing, the dataset may contain a broad range of read lengths because of incomplete library preparation, degradation, sequencing characteristics, or technical artifacts. Adapter trimming and quality trimming can shorten reads, while minimum-length filtering removes reads below a selected threshold. After preprocessing, the distribution may become more consistent with the expected library characteristics. Important statistics include minimum, maximum, mean, median, and N50 read length. The N50 read length is the length at which reads of that length or longer account for at least half of the total sequenced bases. These metrics are particularly useful for long-read sequencing, although they can also be calculated for short-read datasets.
- Base quality distribution is another major quality metric. Sequencing quality is commonly expressed using Phred quality scores, which estimate the probability of an incorrect nucleotide call. The relationship is:
[
Q = -10\log_{10}(P)
]
- where (Q) is the Phred quality score and (P) is the estimated probability of an incorrect base call. A Q20 score corresponds to an estimated error probability of 1%, while Q30 corresponds to 0.1%. Before preprocessing, some reads may contain low-quality regions, particularly near the ends of sequencing reads. After quality trimming, the proportion of low-quality bases may decrease. Researchers can compare average quality scores, per-base quality distributions, and the proportion of bases meeting selected quality thresholds.
- The percentage of bases with a quality score of at least Q20 or Q30 is commonly used as a summary metric. Q20 and Q30 percentages help describe the overall quality of a sequencing dataset, but they do not provide a complete assessment of read reliability. They should be interpreted together with read length, coverage, error profiles, and other quality indicators. Furthermore, quality scores are estimates produced by basecalling systems, and their calibration may differ between sequencing platforms and software models.
- GC content is another useful metric for comparing sequencing data before and after preprocessing. It represents the percentage of guanine and cytosine bases in a DNA sequence. A change in GC distribution after filtering may indicate that certain types of reads were preferentially removed. For example, if low-quality filtering disproportionately removes GC-rich or AT-rich sequences, the resulting dataset may have a different nucleotide composition from the original sample. Such changes can reflect technical bias or genuine biological variation. GC content should therefore be assessed at both the individual-read and dataset levels where appropriate. In metagenomic sequencing, a broad or multimodal GC distribution may be expected because the sample contains organisms with different genomic compositions.
- Adapter contamination is a metric that should generally decrease after successful adapter trimming. Adapters are technical sequences introduced during library preparation, and they may appear in reads when the original DNA or RNA fragments are shorter than the sequencing read length or when adapter sequences are not completely removed. Adapter contamination can interfere with alignment, assembly, and sequence classification. Before preprocessing, quality-control reports may identify adapter sequences or overrepresented technical sequences. After preprocessing, the frequency of these sequences should be reduced. However, adapter removal should use the correct sequences for the library preparation method, and biological sequences should not be removed accidentally.
- The proportion of ambiguous bases, represented by N in nucleotide sequence data, can also be compared before and after preprocessing. Reads containing many ambiguous bases may be difficult to align or classify. Quality filtering may remove reads with excessive ambiguous content, while base trimming may remove uncertain terminal regions. A decrease in ambiguous-base content can indicate improved sequence usability. However, a small number of ambiguous bases may be acceptable, and the appropriate threshold depends on the sequencing technology and downstream application.
- Sequence duplication is another metric commonly examined during quality assessment. High duplication levels may result from PCR amplification, optical duplicates, high sequencing depth, or biological factors. In RNA sequencing, highly expressed transcripts may naturally generate many reads from the same genomic or transcriptomic regions. In targeted sequencing, repeated reads may be expected because the experiment concentrates on specific genomic regions. Therefore, a high duplication rate is not automatically evidence of poor-quality data. Preprocessing does not necessarily remove duplicates, and duplicate marking or removal is a separate operation that should be performed according to the analysis objective. Researchers should compare duplication metrics before and after processing but should not assume that lower duplication always indicates better data.
- Overrepresented sequences can provide information about technical contamination or biological enrichment. These sequences may include adapters, primers, ribosomal RNA, highly expressed transcripts, or genuine sequences that are abundant in the sample. Before preprocessing, overrepresented sequence analysis can help identify possible sources of contamination. After adapter and contaminant removal, technical overrepresentation may decrease. However, biologically abundant sequences may remain and should not automatically be removed. Their interpretation requires knowledge of the experiment and library preparation.
- Read quality metrics are also affected by the sequencing technology. For Illumina short-read sequencing, important metrics include per-base sequence quality, per-sequence quality, GC distribution, sequence duplication, adapter content, and read length. For Oxford Nanopore sequencing, read-length distribution, read quality, total yield, basecalling performance, and read N50 are particularly relevant. PacBio sequencing requires attention to polymerase reads, subreads, circular consensus sequences, HiFi read yield, read length, and predicted accuracy. The same quality-control criteria should not be applied identically to all platforms because their sequencing principles and error profiles differ.
- For long-read sequencing, the number of reads retained and the total number of bases retained are especially important because read length contributes to genome assembly, repeat resolution, structural variant detection, and haplotype phasing. Quality filtering may remove short or low-quality reads, but excessive filtering can reduce coverage and eliminate reads that span important genomic regions. The read-length distribution and N50 should therefore be compared before and after processing. For Oxford Nanopore datasets, tools such as NanoPlot and NanoStat can summarize read characteristics, while NanoFilt and Filtlong can support filtering. For PacBio data, SMRT Link and related PacBio tools provide platform-specific quality metrics, particularly for CCS and HiFi processing.
- Coverage is another important metric to examine after preprocessing. Coverage describes how many times a particular position or region is represented by sequencing reads. Average sequencing depth can be estimated by dividing the total number of sequenced bases by the genome size:
[
\text{Average coverage} =
\frac{\text{Total sequenced bases}}
{\text{Genome size}}
]
- For example, if 24 gigabases of usable sequence data are available for a genome of 3 gigabases, the theoretical average coverage is approximately 8-fold. This is a simplified estimate because it assumes that the reads represent the genome uniformly. In practice, coverage may vary because of GC bias, repetitive regions, library preparation, mapping limitations, and other factors. Preprocessing can reduce the total number of bases and therefore reduce average coverage. Researchers should check whether sufficient coverage remains for the intended analysis.
- For paired-end sequencing, quality assessment should include the relationship between forward and reverse reads. The number of read pairs retained, the number of pairs in which both mates pass filtering, and the number of orphan reads should be recorded. If one mate fails filtering, some workflows retain the surviving mate as an unpaired read. The proportion of properly paired reads after alignment can also provide useful information about the effects of preprocessing. Excessive trimming or filtering may reduce the ability to identify expected paired-end relationships.
- In RNA sequencing, quality metrics before and after preprocessing should include read count, read length, base quality, adapter content, GC distribution, ribosomal RNA contamination, and alignment or transcript-assignment rates. Preprocessing may remove adapters and low-quality bases, but it should not introduce unnecessary sequence loss that affects transcript representation. After alignment or quantification, researchers should also examine mapping rates, the proportion of reads assigned to genes, strandedness, and duplication. These downstream metrics provide additional information about whether the processed reads are suitable for gene-expression analysis.
- In metagenomic sequencing, quality assessment should consider read count, sequence yield, length distribution, quality scores, host contamination, taxonomic classification, and the representation of microbial sequences. Host depletion and contaminant removal may substantially reduce the total read count, particularly in host-associated samples. However, the percentage of reads classified as microbial may increase after host removal. Researchers should compare both absolute microbial read counts and relative proportions because an increase in relative abundance does not necessarily indicate an increase in the absolute number of microbial reads.
- Several bioinformatics tools support quality assessment before and after preprocessing. FastQC provides quality reports for individual short-read FASTQ files and examines metrics such as per-base quality, per-sequence quality, GC content, sequence duplication, adapter content, and overrepresented sequences. MultiQC aggregates reports from multiple samples and tools into a single report, making it useful for batch comparisons. fastp performs adapter trimming and quality filtering while generating HTML and JSON reports. Cutadapt and Trimmomatic provide additional trimming and filtering functions. For long-read data, NanoPlot and NanoStat provide read-length and quality summaries, while platform-specific tools can assess PacBio and Oxford Nanopore sequencing metrics.
- The following command illustrates quality assessment of raw short-read data using FastQC:
fastqc raw_R1.fastq.gz raw_R2.fastq.gz -o qc_before/
After preprocessing, FastQC can be run again on the processed reads:
fastqc processed_R1.fastq.gz processed_R2.fastq.gz -o qc_after/
MultiQC can then combine the reports for easier comparison:
multiqc qc_before/ -o multiqc_before/
multiqc qc_after/ -o multiqc_after/
- The fastp tool can generate preprocessing and quality-control reports in a single workflow:
fastp \
-i raw_R1.fastq.gz \
-I raw_R2.fastq.gz \
-o processed_R1.fastq.gz \
-O processed_R2.fastq.gz \
-q 20 \
-l 50 \
-h fastp_report.html \
-j fastp_report.json
- In this example, fastp applies quality filtering and a minimum read-length threshold. The HTML and JSON reports summarize the input data, processing operations, and output data. The thresholds are illustrative and should be selected according to the experiment.
- The following Python example demonstrates how to calculate basic FASTQ metrics using Biopython. It reports the number of reads, total bases, mean read length, mean per-read quality, and the percentage of bases with quality scores of at least Q30.
from Bio import SeqIO
from statistics import mean
def calculate_metrics(fastq_file):
read_count = 0
total_bases = 0
read_lengths = []
quality_scores = []
q30_bases = 0
for record in SeqIO.parse(fastq_file, “fastq”):
read_count += 1
length = len(record.seq)
total_bases += length
read_lengths.append(length)
qualities = record.letter_annotations[“phred_quality”]
quality_scores.extend(qualities)
q30_bases += sum(q >= 30 for q in qualities)
if read_count == 0 or total_bases == 0:
print(“No reads found.”)
return
print(“File:”, fastq_file)
print(“Number of reads:”, read_count)
print(“Total bases:”, total_bases)
print(“Mean read length:”, mean(read_lengths))
print(“Mean base quality:”, mean(quality_scores))
print(“Q30 bases (%):”, q30_bases / total_bases * 100)
calculate_metrics(“raw_reads.fastq”)
calculate_metrics(“processed_reads.fastq”)
- This example provides basic statistics for comparing raw and processed files. It calculates the mean of all per-base quality scores, but this average should not be confused with a single Phred score representing the combined error probability of the entire dataset. For large sequencing files, specialized tools may be more efficient and provide additional metrics such as per-base quality distributions, read N50, adapter content, and duplication levels.
- A useful comparison table can summarize the principal metrics before and after preprocessing. The following values are illustrative and do not represent a universal quality standard.
| Quality metric | Before preprocessing | After preprocessing |
| Total reads | 10,000,000 | 8,500,000 |
| Total bases | 1,500 Mb | 1,220 Mb |
| Mean read length | 150 bp | 144 bp |
| Bases at Q30 or higher | 72% | 89% |
| Adapter content | 8% | 1% |
| Reads below minimum length | 6% | 0% |
| Ambiguous bases | 0.8% | 0.2% |
- In this illustrative example, preprocessing removes 15% of the reads and reduces total sequence yield. At the same time, the proportion of high-quality bases increases, adapter contamination decreases, and reads below the selected minimum length are removed. The results suggest an improvement in several quality indicators, but the final decision should also consider whether sufficient sequence coverage remains for the intended analysis.
- Quality metrics should be interpreted collectively rather than individually. An increase in Q30 percentage may indicate better base quality, but it does not necessarily mean that the dataset contains enough reads for reliable variant detection. A decrease in adapter content is desirable, but it does not establish that all contamination has been removed. Similarly, an increase in mean read length after filtering may occur because shorter reads have been discarded, even though the total number of bases has decreased. Researchers should therefore examine the complete set of metrics and consider the biological and technical context.
- A particularly important consideration is that preprocessing may change the composition of the dataset. If certain sequences are more likely to fail filtering than others, the processed data may no longer represent the original sample proportionally. This can affect gene-expression estimates, microbial abundance measurements, variant allele frequencies, and other downstream results. Researchers should investigate unexpected changes in GC content, sequence composition, read-length distribution, and taxonomic representation. When necessary, they should compare results obtained using alternative filtering thresholds to determine whether conclusions are sensitive to preprocessing choices.
- Quality control should also extend beyond FASTQ files. After alignment, researchers can evaluate mapping rate, properly paired reads, mismatch rate, insertion and deletion patterns, coverage uniformity, and the percentage of reads mapping to expected genomic regions. For genome assembly, useful metrics include assembly size, contiguity, N50, completeness, and contamination. For RNA sequencing, mapping rates, transcript assignment, gene-body coverage, and ribosomal RNA content can provide additional evidence about data quality. These downstream metrics complement raw-read QC and help determine whether preprocessing has improved the usefulness of the data.
- For reproducible bioinformatics analysis, researchers should preserve raw sequencing files and document all preprocessing operations. The software name and version, command-line parameters, adapter sequences, quality thresholds, minimum and maximum read lengths, and contaminant reference databases should be recorded. Reports generated before and after preprocessing should be retained, and the number of reads and bases removed at each step should be documented. Workflow management tools such as Snakemake and Nextflow can help automate these procedures and ensure that the same processing rules are applied consistently across samples.
- Quality metrics before and after preprocessing provide an objective way to evaluate sequencing data quality and the effects of computational processing. Important indicators include read count, total bases, read-length distribution, Phred quality scores, GC content, adapter contamination, ambiguous bases, duplication, and sequencing coverage. Their interpretation must reflect the sequencing technology and biological application. By comparing these metrics systematically, researchers can identify technical problems, assess filtering effectiveness, avoid unnecessary data loss, and prepare more reliable datasets for downstream bioinformatics analyses.