bioRxiv Science⌕ Search

bioRxiv · 10.1101/2025.07.22.666196

Efficient Grammar Compression via RLZ-based RePair

Abstract

Among grammar-based compression techniques, RePair is a notable offline encoding scheme known for its simplicity and powerful combinatorial properties, producing compact grammars by repeatedly replacing the most frequent adjacent pairs of symbols, known as bigrams. However, RePairs memory usage scales poorly with input size, as it loads the entire text into memory. In contrast, Relative Lempel-Ziv (RLZ) parsing offers a scalable and lightweight online encoding scheme that losslessly represents a text in terms of phrases that refer to a reference string, but it often fails to expose deeper structural patterns. We introduce an algorithm that produces a RePair grammar from the RLZ parse of the input, leveraging the strengths of both methods. Our method, RLZ-RePair, performs bigram replacements systematically, preserving the integrity of the RLZ phrases throughout the RePair iterations. When the reference is well chosen, our method achieves the same grammar as standard RePair while significantly reducing both memory usage and the number of bigram replacements. In particular, we show that RLZ-RePair can reduce memory usage by more than 80% while incurring only a modest runtime increase compared to RePair. To our knowledge, RLZ-RePair is one of the first scalable methods that constructs exact RePair grammars, resulting in a grammar-based compressor that is both practical for large datasets and faithful to the theoretical elegance of RePair.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Varki, R., Gagie, T., Boucher, C.. 2025-07-26. Efficient Grammar Compression via RLZ-based RePair. https://doi.org/10.1101/2025.07.22.666196

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related preprints

Chromosome-level, haplotype-resolved genome assembly of the tanniferous forage legume big trefoil (Lotus pedunculatus Cav.) using CiFi

Big trefoil (Lotus pedunculatus Cav.) is a perennial forage legume that thrives on acidic, low-fertility soils and produces condensed tannins that reduce enteric methanogenesis in ruminants. Despite this agronomic potential, genomic resources for the species remain scarce, and the existing haploid assembly does not resolve the two haplotypes of this outcrossing diploid species. Here we present a haplotype-resolved, chromosome-level reference genome for L. pedunculatus genotype Lusitano29 -- the first plant genome assembled using CiFi, a long-read chromosome conformation capture method. We combined PacBio HiFi long reads with CiFi concatemers produced from DpnII and HindIII libraries; in silico digestion and combinatorial pairing of the resulting monomers yielded 790.3 M and 10.3 M pseudo-paired contacts, respectively, enabling scaffolding and manual curation to chromosome level. The 991.1 Mb assembly resolves two phased haplotypes of 500 and 491 Mb, with 96.6% of the sequence anchored in twelve pseudo-chromosomes (six per haplotype). Telomeric repeats were detected at 19 of 24 pseudo-chromosome ends, and no structural errors were detected (scaffold N50 73.8 Mb; consensus QV 64.7; k-mer completeness 99.4%; genome-mode BUSCO completeness 97.0%; CRAQ S-AQI 100.0). Annotation supported by PacBio Iso-Seq full-length transcripts predicted 38,069 and 36,484 protein-coding genes in haplotypes 1 and 2, respectively (protein-mode BUSCO completeness 96.5%), indicating a high completeness of annotated genes. This genome assembly provides a foundation for allele-aware trait dissection of proanthocyanidin biosynthesis, comparative genomics in Lotus, and population genomics and genomics-assisted breeding in L. pedunculatus.

genomics↗

Bramble: projection of spliced genomic alignments into transcriptomic space for improved transcript quantification

Accurate transcript abundance estimation is central to many transcriptomic studies. Many current quantification methods rely on reads mapped directly to the transcriptome, but transcriptome alignment can misassign reads from unannotated transcripts to annotated isoforms, leading to biased abundance estimates. We introduce Bramble, a method that projects spliced genomic alignments into transcriptomic coordinates to produce alignments compatible with downstream transcript quantification tools. Across simulated short- and long-read RNA-seq datasets and multiple levels of reference annotation completeness, incorporating Bramble into quantification pipelines consistently improved accuracy and reduced error. These results suggest that genome-derived transcriptomic alignments can improve transcript quantification by preserving compatible alignments to annotated transcripts while filtering alignments likely originating from unannotated transcripts.

genomics↗

PRDM9-mediated meiotic hotspot specification is constrained in humans despite extensive sequence diversity

PRDM9 specifies meiotic recombination hotspots through a rapidly evolving C2H2 zinc-finger (ZNF) coding minisatellite that determines DNA-binding specificity. Although this minisatellite harbors extraordinary allelic diversity in humans, the functional consequences of most naturally occurring variants remain unknown. Here we functionally characterize 80 human PRDM9 alleles using genome-wide chromatin profiling. Despite extensive sequence diversity within the ZNF array, most alleles function indistinguishably from common A and C hotspot-specifying alleles, revealing that human PRDM9 function is more constrained than its sequence diversity predicts. In contrast, rare and infertility-associated variants occupy two functional extremes: either abundant and novel DNA binding specificity or minimal DNA binding, suggesting that both gain- and loss-of-function alleles may disrupt symmetric hotspot specification during meiosis, thus representing a plausible contributor to human infertility. Together, our findings define the functional landscape of human PRDM9 variation and provide a framework for interpreting the impact of newly discovered PRDM9 alleles.

genomics↗