FastqZip: An Improved Reference-Based Genome Sequence Lossy Compression Framework

Yuanjian Liu, Huihao Luo, Zhijun Han, Yao Hu, Yehui Yang, Kyle Chard, Sheng Di, Ian T. Foster, Jiesheng WuarXiv 2024 · DOI

Abstract

Next-Generation Sequencing (NGS) technologies generate massive volumes of data, creating significant storage and transmission challenges. We present FastqZip, a novel reference-based compression framework designed to improve upon current state-of-the-art tools. FastqZip introduces an advanced sequence matching algorithm that utilizes edit distance to handle insertions and deletions (indels), alongside optional lossy quality score quantization. Our evaluation on real-world human genome datasets shows that FastqZip achieves a ~10% higher compression ratio than Genozip in lossless mode and up to a 2x improvement in lossy mode, providing a scalable solution for modern genomic data management.

Introduction

The proliferation of NGS platforms has made genomic data storage a major bottleneck, with FASTQ files often reaching hundreds of gigabytes. While general-purpose compressors like gzip are commonly used, they fail to exploit the inherent redundancy in genomic sequences—where humans share over 99% of their DNA—and struggle with the high entropy of quality scores.

Existing reference-based tools often rely on Hamming distance for read mapping, which only accounts for base substitutions. This limitation causes reads containing indels to be stored inefficiently as unmatched raw data. FastqZip addresses this by incorporating local alignment algorithms to calculate edit distance, allowing for more comprehensive reference mapping.

Figure 1: Comparison of reference mapping capabilities. Standard tools like Genozip fail to match reads containing indels (e.g., Read 3), whereas FastqZip is designed to capture these variations through edit distance.

Methods

FastqZip employs a multi-stage parallelized pipeline to optimize the compression of FASTQ components: sequence identifiers, nucleotide reads, and quality scores.

Advanced Reference Mapping

The core innovation of FastqZip is its hybrid matching strategy. It first attempts forward and backward matching using Hamming distance. If the Hamming distance exceeds a predefined threshold, the framework performs local alignment using the WFA-2 algorithm to calculate the edit distance. This "indel-aware" approach ensures that a higher percentage of reads are compressed against the reference genome rather than stored as raw sequences.

Figure 5: The FastqZip matching logic flowchart. The process attempts rapid Hamming distance matching before falling back to computationally intensive local alignment to resolve indels.

Seed-Based Indexing and Read Reordering

To facilitate efficient mapping, FastqZip builds a specialized index of the reference genome using short sequence "seeds." Selection rules (e.g., seeds must start with 'G' and the second base cannot be 'G') are applied to minimize redundancy in repetitive regions. Additionally, the framework reorders reads to group similar sequences together, which significantly improves the performance of the final general-purpose compression stage (using backends like BSC or ZPAQ).

Quality Score Quantization

Recognizing that quality scores account for over 80% of compressed file size, FastqZip offers an optional lossy mode. This mode uses "bin-quantization" to group similar quality scores into a smaller number of bins (e.g., 8 bins), reducing entropy and increasing patterns for the final compression backend.

Results

FastqZip was benchmarked against five human genome datasets (NA12878) from DNBSEQ and BGISEQ platforms.

  • Compression Efficiency: In lossless mode, FastqZip consistently outperformed Genozip by approximately 10%. In lossy mode (8-bin quantization), the compression ratio improved by nearly 2x compared to lossless mode, with negligible impact on typical downstream genomic analyses.
  • Scalability: The framework demonstrated excellent multi-threading capabilities, scaling effectively up to 20 CPU cores. Performance eventually plateaued due to I/O bottlenecks related to reading the initial gzipped input files.

Discussion and Conclusion

FastqZip provides a powerful framework for genomic data compression by effectively handling indels and optimizing quality score storage. While the use of edit distance introduces a slight computational overhead compared to Hamming-only methods, the resulting storage savings are substantial. Future developments will explore hardware acceleration via GPUs or FPGAs to mitigate processing time and further refinements to the lossless backend for specialized bit-patterns.

Summary updated

BibTeX
@misc{liu2024fastqzip,
  author = {Yuanjian Liu and Huihao Luo and Zhijun Han and Yao Hu and Yehui Yang and Kyle Chard and Sheng Di and Ian T. Foster and Jiesheng Wu},
  title = {{FastqZip: An Improved Reference-Based Genome Sequence Lossy Compression Framework}},
  year = {2024},
  eprint = {2404.02163},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.02163},
}
Figure