Papers
Topics
Authors
Recent
Search
2000 character limit reached

r-index: Compressed Self-Index for Genomic Data

Updated 7 July 2026
  • The r-index is a run-length BWT-based self-index that compresses the text representation by storing only run boundaries, making it ideal for highly repetitive data.
  • It supports efficient pattern-matching operations, including count and locate, with theoretical guarantees and practical implementations tailored for genomic databases.
  • Software workflows like ri-buildfasta and ri-align illustrate its space-time advantages and scalable performance on large pan-genomic and repetitive text collections.

Searching arXiv for the cited "r-index" papers and related variants to ground the article. In contemporary string indexing and computational pangenomics, the r-index denotes a run-length Burrows–Wheeler Transform-based self-index whose space is proportional to the number of runs in the Burrows–Wheeler Transform, rather than to the full text length. It was introduced for highly repetitive text collections, especially genomic databases and pan-genomes, where it supports exact pattern matching while remaining substantially smaller than classical FM-index and suffix-array representations on repetitive data. The same term, with different capitalization and in unrelated literatures, also appears as a peer-review contribution metric and as a family of graph-theoretic topological indices (Mun et al., 2019, Malekzadeh, 2024).

1. Formal definition and core representation

Let T[1..n]T[1..n] be a text over an alphabet Σ\Sigma, terminated by a unique end-marker $\$$that is lexicographically smaller than any other character. The Burrows–Wheeler TransformBWT(T)\mathrm{BWT}(T)is the length-nnarray obtained from the suffix array ofTT. A **run** inBWT(T)\mathrm{BWT}(T)is a maximal contiguous interval of equal letters, andrrdenotes the total number of such runs. The r-index is built around the observation that, for highly repetitive texts,rrcan be much smaller thannn (Giuliani et al., 2022).

The data structure stores the BWT in run-length form, usually as run heads and run lengths, together with a small number of suffix-array samples per run and a structure for identifying the run containing a queried BWT position. Representative formulations include arrays such as Σ\Sigma0 and Σ\Sigma1 for the run-length encoding, a bitvector marking run starts, and suffix-array samples at run starts, run ends, or both boundaries, depending on the implementation. The basic space bound is Σ\Sigma2 machine words, equivalently Σ\Sigma3 bits, plus lower-order overhead (Mun et al., 2019).

This representation is best understood as an FM-index specialized to repetitive texts. Instead of storing per-character structures proportional to Σ\Sigma4, it compresses the BWT by runs and replaces conventional dense suffix-array sampling with one or a constant number of samples per run. In the formulation of Gagie, Navarro, and Prezza, this is the key mechanism by which the r-index retains count and locate functionality while scaling with repetitiveness rather than raw text size (Cobas et al., 2021).

2. Search operations and theoretical guarantees

The r-index supports the classical pattern-matching operations count and locate. Counting uses backward search on the run-length BWT: given a pattern Σ\Sigma5, the search maintains the suffix-array interval Σ\Sigma6 corresponding to suffixes prefixed by Σ\Sigma7. Each backward-search step combines LF-mapping with rank/select or predecessor logic on run boundaries (Bannai et al., 2018).

The precise asymptotic bounds depend on the implementation of the rank/select and predecessor primitives. One formulation gives counting in

Σ\Sigma8

and locating in

Σ\Sigma9

where $\$0 is the number of reported occurrences. Other formulations state counting in $\$1 and locating in $\$2, where $\$3 is the time for rank/select on the run bitvector, or $\$4 and $\$5 when more advanced predecessor structures are used (Cobas et al., 2021, Mun et al., 2019, Bannai et al., 2018).

A central technical device is the Toehold Lemma. In its strengthened form, storing suffix-array samples only at run starts suffices to maintain and return $\$6 for the current interval $\$7 during backward search. This yields one occurrence of the pattern directly from the search process and provides the starting point for recovering the remaining suffix-array values in the interval (Bannai et al., 2018).

The locate phase then proceeds by exploiting the structure induced by run-boundary sampling. Different papers present this through predecessor formulas, LF-steps to the next sampled run boundary, or $\$8-style transitions, but the common invariant is that the sparse samples at run boundaries are enough to recover all occurrences without reverting to an $\$9-space suffix array (Nishimoto et al., 28 Apr 2025).

3. Construction and software workflow

A concrete implementation is described through the programs ri-buildfasta and ri-align. The builder takes as input a possibly gzipped multi-FASTA file, concatenates the component sequences with distinct separators, computes the BWT, run-length encodes it, builds the run-start bitvector and suffix-array samples, and writes the resulting index files. Two construction methods are exposed: bigbwt, the default, which uses prefix-free parsing for large and repetitive inputs, and SAIS, a classic linear-time suffix-array constructor that is faster on small or nonrepetitive inputs (Mun et al., 2019).

The query program ri-align provides two principal modes. In count mode it reports, for each read, the length thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform0 of the longest suffix of the read that occurs in the index, together with the number of occurrences of that suffix. In locate mode it reports exact-match positions in SAM format, with options such as --max-hits <k> and --max-range <k> to cap extremely frequent outputs. Because the implementation currently performs only exact matches, MAPQ and mate-pair fields are placeholders (Mun et al., 2019).

The reported performance illustrates the intended operating regime. For a dengue collection of 2042 genomes totaling 22 MB uncompressed, ri-buildfasta produced a 2.4 MB index from a 2.7 MB gzipped FASTA; build times were about 3 seconds with bigbwt and about 10 seconds with SAIS. On a much larger collection, human chr19 thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform1 totaling 110 GB, bigbwt built the index in about 5 hours using 41 GB RAM, and the index size was 665 MB. On the dengue queries, counting 1000 reads of length 100 took about 0.06 seconds total and locating one hit per read about 0.1 seconds total (Mun et al., 2019).

These software-level details are significant because they show that the r-index was not presented only as an asymptotic compression scheme. It was also specified as an end-to-end workflow for constructing pan-genomic indexes and querying them directly with sequencing reads (Mun et al., 2019).

Several later papers refine the basic design by changing the sampling policy, adding auxiliary arrays, or translating the same principles into related compressed-index frameworks.

Variant Main idea Reported effect
sr-index Subsample the thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform2 run-boundary samples using a parameter thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform3 Locate structures use thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform4 words; time per occurrence is multiplied by thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform5
MUM-augmented r-index Add thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform6 LCP samples at run boundaries Supports computation of second-best matches and candidate MUMs while preserving the stated space and time bounds
Threshold-augmented r-index Store thresholds between consecutive runs of the same character Supports matching statistics and MEMs in thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform7 time, assuming thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform8-time random access to thatislexicographicallysmallerthananyothercharacter.TheBurrows–WheelerTransformthat is lexicographically smaller than any other character. The Burrows–Wheeler Transform9
Metagenomic extensions Combine the r-index with grammar-compressed document arrays or RLE-ILCP Solve document-listing-with-frequencies for pseudoalignment-style queries
Dynamic r-index Replace static components with dynamic RLBWT and dynamic sampled SA structures Supports insertions and deletions while retaining isthelength−is the length-0 words

The subsampled r-index or sr-index is the most prominent space-reduction variant. It removes selected run samples so that only isthelength−is the length-1 survive for a user-selected parameter isthelength−is the length-2. The resulting search bound becomes

isthelength−is the length-3

while interpolating smoothly between the original r-index and more aggressively subsampled locating structures. The same paper also introduces the r-csa and sr-csa, which apply analogous ideas in a isthelength−is the length-4-based compressed suffix array framework and report advantages on larger alphabets and some DNA texts (Cobas et al., 2021, Cobas et al., 2024).

For exact-match extensions beyond basic locate, one line of work augments the r-index for matching statistics and maximal exact matches (MEMs) by storing thresholds between consecutive runs of the same character. Under isthelength−is the length-5-time random access to isthelength−is the length-6, all matching statistics can then be computed in isthelength−is the length-7 time, and MEMs can be extracted in linear additional time. A second line augments the streaming MEM framework with additional isthelength−is the length-8 LCP samples so that the second-longest match of each pattern suffix can be determined, enabling the computation of maximal unique matches (MUMs) on top of the r-index (Bannai et al., 2018, Giuliani et al., 2022).

For metagenomic pseudoalignment and document listing, the r-index has been combined with three document-listing-with-frequencies structures: a grammar-compressed document array with precomputed lists, a grammar-compressed array enhanced with bitvectors, and a run-length encoded interleaved LCP array. The reported query bounds are isthelength−is the length-9, arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of0, and arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of1, respectively, with space overheads described as comparable with the size of the underlying r-index on highly repetitive data (Cobas et al., 2020).

Dynamic updates have also been studied in two senses. One refinement showed how to maintain the r-index under prepending characters to arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of2, yielding a dynamic construction and an online LZ77 parser in arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of3 total time and arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of4 space. A later dynamic r-index formalized support for insertions and deletions in

arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of5

worst-case time and

arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of6

average time, while answering locate queries in arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of7 using arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of8 words (Bannai et al., 2018, Nishimoto et al., 28 Apr 2025).

5. Applications, empirical behavior, and operating regimes

The principal application domain is indexing highly repetitive texts, especially genomic databases and pan-genomes. The original practical exposition emphasizes exact matching of reads to many genomes, either to align reads that perfectly match some part of a genome or to find seeds for reads that do not. Subsequent work extends the same indexing regime to MEMs, MUMs, pseudoalignment, and dynamic updates (Mun et al., 2019).

The suitability of the r-index depends strongly on repetitiveness. The literature consistently states that the space is advantageous when arrayobtainedfromthesuffixarrayofarray obtained from the suffix array of9, and several papers make the caveat explicit that performance and competitiveness deteriorate as repetitiveness drops. For the sr-index, one recommendation is that the regime .A∗∗run∗∗in. A **run** in0–.A∗∗run∗∗in. A **run** in1 gives the best space–time tradeoff; for extremely low repetitiveness, such as .A∗∗run∗∗in. A **run** in2, a classic CSA may be preferable. Similarly, for MUM computation, if one has only one or two genomes and unlimited RAM, classical suffix-tree or FM-index-based MUM finders remain faster (Cobas et al., 2021, Giuliani et al., 2022).

The empirical results reinforce this regime distinction. For streaming MUM computation, mum-phinder was reported to use at most 11.5 GB RAM on 512 human chr19 haplotypes and at most 4 GB on 300 000 SARS-CoV-2 genomes, whereas MUMmer3 and MUMmer4 ran out of memory beyond much smaller collections. On nonrepetitive data, however, the method was reported as 9–19 times slower than MUMmer while using 7–8 times less memory; on highly repetitive pangenomes, the slowdown shrank to about .A∗∗run∗∗in. A **run** in3 and the memory advantage grew to as much as .A∗∗run∗∗in. A **run** in4 (Giuliani et al., 2022).

For metagenomic document listing, all three proposed variants were reported to be fast on highly repetitive data, and the size overhead introduced by the extra structures was described as comparable with the size of the underlying r-index. In the experimental summary, the precomputed-lists solution was the fastest at about .A∗∗run∗∗in. A **run** in5s per query on small-.A∗∗run∗∗in. A **run** in6 data, while the ILCP-based variant was nearly as fast but typically about .A∗∗run∗∗in. A **run** in7 larger (Cobas et al., 2020).

The subsampled family was evaluated both in its original form and in a later extended version. One study reports that the sr-index uses 1.5–4 times less space than the r-index on all but the most extremely repetitive inputs while remaining within a small constant factor in query time; another reports that, on Chr19, the sr-index with .A∗∗run∗∗in. A **run** in8 used 0.032 bits per symbol versus 0.076 for the r-index and was slightly faster in locating, while on Salmonella it reduced space from 1.89 to 0.45 bits per symbol at roughly the same speed (Cobas et al., 2021, Cobas et al., 2024).

Dynamic-update experiments show the usual trade-off between flexibility and constants. On large repetitive corpora such as enwiki and chr19.1000, the dynamic r-index was much slower than the static r-index for one-shot query throughput, but vastly more practical than rebuilding after each update. Reported single-character insertions took about 3.4 seconds on enwiki and about 4.6 seconds on chr19, whereas rebuilding the static index was about .A∗∗run∗∗in. A **run** in9 seconds. Working memory was about 3 GiB for the dynamic r-index, compared with about 255 GiB for the compared dynamic FM-index (Nishimoto et al., 28 Apr 2025).

6. Other uses of the term

Outside repetitive-text indexing, the same label is used for at least two unrelated constructions.

In scholarly communication, R-Index refers to a metric for assessing researcher contributions to peer review. It is defined from a publication set isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and0, per-paper review counts isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and1, co-author counts isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and2, and the number isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and3 of reviews completed in the same period. The total review responsibility is

isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and4

and the index is

isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and5

A positive value means that the researcher has given back more reviews than their publications demanded; a negative value indicates more demand than supply; zero indicates balance. The proposal recommends using the same time window for publications and completed reviews, suggests a two-year lag to avoid penalizing newcomers, and limits the scope to manuscript peer review unless extended weighting schemes are introduced (Malekzadeh, 2024).

In graph theory and QSPR/QSAR-oriented topological-index literature, Ediz defines the R-degree of a vertex isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and6 in a simple connected graph by

isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and7

where

isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and8

From these local quantities, three global R-indices are defined:

isamaximalcontiguousintervalofequalletters,andis a maximal contiguous interval of equal letters, and9

Closed-form expressions are given for paths, cycles, stars, and complete graphs (Ediz, 2017).

These homonymous usages belong to distinct literatures and should not be conflated with the BWT-based compressed self-index used for repetitive text collections.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to r-index.