# 伯罗斯-惠勒变换

伯罗斯-惠勒变换（Burrows–Wheeler transform，BWT）是字符串字符的一种可逆置换，其做法是将字符串的所有循环旋转按字典序排序，再按该顺序取每个旋转的最后一个字符。<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC3424560/)</sup> 该变换本身并不压缩数据；它重新排列文本，使上下文相似的字符彼此相邻，从而让输出易于用移到前端编码、游程编码等简单方法压缩。它由[迈克尔·伯罗斯](https://www.edgepedia.org/zh/michael-burrows-computer-scientist)（Michael Burrows）与大卫·J·惠勒（David J. Wheeler）于1994年作为块排序无损数据压缩算法发表，后来成为贯穿生物信息学的压缩文本索引的基础。<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup><sup> • </sup><sup>[2](https://www.sciencedirect.com/science/article/pii/S089054012400018X)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 按文本各后缀的字典序排名对其符号进行的一种可逆置换；等价地说，是字典序排序后的循环旋转矩阵的最后一列<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup><sup> • </sup><sup>[3](https://www.sciencedirect.com/science/article/pii/S0890540123000913)</sup> |
| 起源 | 由惠勒于1983年在AT&T贝尔实验室（AT&T Bell Laboratories）发现；由伯罗斯与惠勒以SRC研究报告124号发表，数字设备公司（Digital Equipment Corporation），1994年5月10日<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup> |
| 可逆性 | 其本身不是单射，因为一个字符串的所有旋转共享同一输出；反演需要原字符串的索引（或一个字符串结束符号）<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup><sup> • </sup><sup>[4](https://drops.dagstuhl.de/storage/01oasics/oasics-vol131-manzinis-festschrift/html/OASIcs.Manzini.2/OASIcs.Manzini.2.html)</sup> |
| 压缩中的作用 | bzip2的核心，将块排序变换与移到前端编码和霍夫曼编码结合；压缩效果明显优于基于LZ77/LZ78的压缩器，并接近PPM统计压缩器<sup>[5](https://sourceware.org/bzip2/manual/manual.html)</sup> |
| 索引中的作用 | BWT是FM索引与r索引的主要成分，也是Bowtie、BWA等比对器的引擎<sup>[6](https://pmc.ncbi.nlm.nih.gov/articles/PMC5425171/)</sup><sup> • </sup><sup>[7](https://journals.sagepub.com/doi/10.1089/cmb.2019.0316)</sup> |
| 索引大小 | 基于BWT-FM的比对器索引一个人基因组只需约2 GB内存（GEM需要3–6 GB）<sup>[8](https://pmc.ncbi.nlm.nih.gov/articles/PMC3868316/)</sup> |
| 重复文本 | 当文本具有重复性时，BWT中游程的数目r远小于文本长度n，从而可实现O(r)空间的索引<sup>[9](https://doi.org/10.1016/j.isci.2024.111464)</sup> |

## 变换的工作原理

正向变换将一段文本作为单个单元处理。对于长度为N个字符的字符串S，它构造S的N个循环旋转，按字典序排序，并提取每个旋转的最后一个字符组成字符串L；连同原字符串在排序列表中的索引I，输出即为二元组(L, I)。<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup> 1994年的原始报告以字符串“abracadabra”演示该方法：对旋转矩阵排序后，在报告所用的六字符示例中最后一列读作“caraab”，索引为1；而英特尔IPP文档给出的完整十一字符结果为“rdarcaaaabb”，索引为2。<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup><sup> • </sup><sup>[10](https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-12/burrows-wheeler-transform.html)</sup>

**为何能压缩。** 排序将以相同字符开头的旋转聚在一起。由于一个旋转的起始字符紧邻其末尾字符，L中连续的位置对应原字符串中相似的上下文。如果某字符的上下文能预测该字符，L便由长段的相同符号组成，易于用移到前端编码结合霍夫曼或算术编码等快速局部自适应算法压缩。<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup> 该变换常被描述为按字符之后的上下文对字符排序，类似于后缀树按共享前缀对后缀分组的方式。<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC3424560/)</sup>

**反演。** 该变换可利用末列到首列（last-to-first，LF）映射在线性时间内反演，该映射将排序旋转矩阵最后一列L中的字符映射到第一列F中对应的出现位置。LF映射是后向搜索背后的基本操作，也正是它使BWT得以反演。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC11090108/)</sup> 由于一个字符串的所有旋转产生相同输出，单纯的变换不是单射；恢复原串要么需要一个log n位的整数来指明哪个旋转是原字符串，要么需要一个比所有字母表字符都小的显式字符串结束符号。即便有了这些额外信息，该变换也不是满射：某些字符串——经典例子是“banana”——根本不是BWT的像。<sup>[4](https://drops.dagstuhl.de/storage/01oasics/oasics-vol131-manzinis-festschrift/html/OASIcs.Manzini.2/OASIcs.Manzini.2.html)</sup>

## 压缩

1994年的报告将该方法定位于当时两大主流技术家族之间：只要输入块足够大（约几千字节量级），它就能达到与最佳统计建模技术相差约百分之一以内的压缩率，而速度可与基于Lempel–Ziv的算法相比。<sup>[1](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)</sup> 在Calgary语料库基准上，伯罗斯-惠勒方案于1995年达到每字符2.29比特，而gzip（1987年）为2.71，PPM（1994年）为2.34。<sup>[13](https://www.cs.princeton.edu/courses/archive/fall19/cos226/lectures/55DataCompression.pdf)</sup>

**bzip2**是最著名的实现。它用伯罗斯-惠勒块排序算法和[霍夫曼编码](https://www.edgepedia.org/zh/huffman-coding)压缩文件，其压缩效果通常明显优于传统的基于LZ77/LZ78的压缩器，同时接近PPM系列统计压缩器。<sup>[5](https://sourceware.org/bzip2/manual/manual.html)</sup> 该变换按块操作，块大小通常为512 kB至2 MB，<sup>[10](https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-12/burrows-wheeler-transform.html)</sup> 而bzip2手册指出，大部分压缩收益来自前两三百kB的块大小。<sup>[14](https://dyn.manpages.debian.org/trixie/bzip2/bzip2.1.en.html)</sup>

## 文本索引与读段比对

该变换更大的科学影响来自压缩全文索引。由保罗·费拉吉纳（Paolo Ferragina）与乔瓦尼·曼齐尼（Giovanni Manzini）提出的FM索引，在空间高效的BWT上增加额外数据结构，支持非常快速的精确字符串匹配，使BWT可充当类后缀数组的索引。<sup>[6](https://pmc.ncbi.nlm.nih.gov/articles/PMC5425171/)</sup> FM索引由BWT连同后缀数组、计数数组C以及支持BWT上秩查询的辅助结构构建而成。<sup>[15](https://pmc.ncbi.nlm.nih.gov/articles/PMC8719400/)</sup>

**短读段比对。** 当高通量测序开始每次实验产生数亿条短DNA读段时，BWT-FM索引成为主流方法。Bowtie、Bowtie 2、BWA和BWA-SW都建立在FM索引之上，<sup>[6](https://pmc.ncbi.nlm.nih.gov/articles/PMC5425171/)</sup> 而基于BWT-FM的工具模仿后缀树遍历，同时比显式后缀树占用更小的内存。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC8390189/)</sup> 一项对107个读段比对器的调查发现，基于后缀树的索引——几乎全部通过BWT和FM索引使用——是最流行的方法之一。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC8390189/)</sup> 代价是灵敏度：随着测序错误率上升或被测基因组与参考序列差异增大，BWT-FM比对器的性能会下降。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC8390189/)</sup> 在主流NGS比对器中，除STAR（采用后缀数组设计）外，全部使用BWT索引，包括Bowtie、Bowtie2、BWA、TopHat2和HISAT2。<sup>[17](https://academic.oup.com/bib/article/24/5/bbad320/7259568)</sup>

**重复集合与r索引。** 单个FM索引难以扩展到数千个基因组的数据库，因为其空间与未压缩文本长度成线性关系。然而对于重复性集合，BWT中游程的数目r远小于文本长度n。<sup>[9](https://doi.org/10.1016/j.isci.2024.111464)</sup> 由加吉（Gagie）、纳瓦罗（Navarro）与普雷扎（Prezza）于2018年定义的r索引，以O(r)个字的空间存储游程编码的BWT及后缀数组采样，并支持在O(p · log log_w(σ + n/r))时间内对长度为p的模式计数，以及以额外的O(occ · log log_w(n/r))时间定位所有occ次出现。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC11090108/)</sup> 基于无前缀解析的构建算法使r索引变得实用，而加入阈值结构则使其能够找到查询读段与索引之间的极大精确匹配。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC11090108/)</sup>

## 变体与构建

若干变体对该变换进行了推广或细化。曼塔奇（Mantaci）及其同事提出的扩展BWT（eBWT）将定义扩展到字符串集合，按ω序而非普通字典序排列共轭串，因此结果与字符串出现的顺序无关。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC11090108/)</sup> 双射BWT（BBWT）最早由大卫·艾伦·斯科特（David Allen Scott）于2007年12月在Usenet的一个讨论串中公布，它利用林登词分解使变换成为双射，从而无需外部索引或哨兵符号。<sup>[4](https://drops.dagstuhl.de/storage/01oasics/oasics-vol131-manzinis-festschrift/html/OASIcs.Manzini.2/OASIcs.Manzini.2.html)</sup> 游程编码BWT（RLBWT）将每段相同字符的游程只存储一次；其大小r与文本自重复程度密切相关，并可与Lempel–Ziv分解大小z相互转换。<sup>[18](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CPM.2017.17)</sup>

构建本身对于海量输入仍是一个活跃问题。轻量级算法假定输入和输出能装入主内存，且额外工作空间为次线性；当连这一点也无法满足时，则使用外存和半外存算法；对于高度重复的集合，将诱导后缀排序与游程压缩、文法压缩相结合的方法可在线性期望时间内构建BWT。<sup>[19](https://pmc.ncbi.nlm.nih.gov/articles/PMC6408864/)</sup><sup> • </sup><sup>[3](https://www.sciencedirect.com/science/article/pii/S0890540123000913)</sup> 长度为n、字母表大小为σ的字符串的BWT可在确定性O(n)时间和O(n log σ)空间内构建。<sup>[20](https://arxiv.org/abs/1401.0936)</sup>

## 基因组规模

基于BWT的索引改变了基因组数据的经济学。Bowtie、BWA、BWA-SW、SOAP2和GEM等基于BWT的比对器索引一个人基因组只需约2 GB内存，取代了占用内存多得多的基于q-gram的方法。<sup>[8](https://pmc.ncbi.nlm.nih.gov/articles/PMC3868316/)</sup> 在压缩方面，基于BWT的技术可将45倍覆盖度的人基因组读段集无损压缩至每碱基0.5比特以下，将135.3 Gbp的序列装入8.2 GB，大小不到bzip2在相同未修剪读段上的结果的四分之一，同时还能在该集合上构建FM索引。<sup>[21](https://arxiv.org/abs/1205.0192)</sup>

## References

1. [M. Burrows and D.J. Wheeler (1994). A Block-sorting Lossless Data Compression Algorithm. SRC Research Report 124, Digital Equipment Corporation.](https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf)
2. [Constructing and indexing the bijective and extended Burrows–Wheeler transform. Information and Computation (2024).](https://www.sciencedirect.com/science/article/pii/S089054012400018X)
3. [Efficient construction of the BWT for repetitive text using string compression. Information and Computation 294 (2023).](https://www.sciencedirect.com/science/article/pii/S0890540123000913)
4. [A Survey of the Bijective Burrows-Wheeler Transform. OASIcs, Manzini Festschrift.](https://drops.dagstuhl.de/storage/01oasics/oasics-vol131-manzinis-festschrift/html/OASIcs.Manzini.2/OASIcs.Manzini.2.html)
5. [bzip2 and libbzip2, version 1.0.8 manual.](https://sourceware.org/bzip2/manual/manual.html)
6. [Short Read Mapping: An Algorithmic Tour. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC5425171/)
7. [Mun, Kuhnle, Boucher, Gagie, Langmead, Manzini (2020). Matching Reads to Many Genomes with the r-Index. Journal of Computational Biology 27(4).](https://journals.sagepub.com/doi/10.1089/cmb.2019.0316)
8. [Data compression for sequencing data. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC3868316/)
9. [Movi: A fast and cache-efficient full-text pangenome index. iScience (2024).](https://doi.org/10.1016/j.isci.2024.111464)
10. [Burrows-Wheeler Transform, Intel IPP Developer Guide (2021).](https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-12/burrows-wheeler-transform.html)
11. [Prospects and limitations of full-text index structures in genome analysis. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC3424560/)
12. [r-indexing the eBWT. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC11090108/)
13. [Data Compression lecture notes, Princeton COS 226 (2019).](https://www.cs.princeton.edu/courses/archive/fall19/cos226/lectures/55DataCompression.pdf)
14. [bzip2(1) man page, Debian trixie.](https://dyn.manpages.debian.org/trixie/bzip2/bzip2.1.en.html)
15. [An optimized FM-index library for nucleotide and amino acid search. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC8719400/)
16. [Technology dictates algorithms: recent developments in read alignment. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC8390189/)
17. [Sequence Alignment/Map format: a comprehensive review. Briefings in Bioinformatics (2023).](https://academic.oup.com/bib/article/24/5/bbad320/7259568)
18. [Policriti and Prezza (2017). From LZ77 to the Run-Length Encoded Burrows-Wheeler Transform, and Back. CPM 2017, LIPIcs 78.](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CPM.2017.17)
19. [External memory BWT and LCP computation for sequence collections with applications. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC6408864/)
20. [Linear time construction of compressed text indices in compact space. arXiv:1401.0936.](https://arxiv.org/abs/1401.0936)
21. [Large-scale compression of genomic sequence databases with the Burrows-Wheeler transform. arXiv:1205.0192.](https://arxiv.org/abs/1205.0192)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Data formats and serialization › Text, encodings, and archives

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/burrows-wheeler-transform

English original: https://www.edgepedia.org/burrows-wheeler-transform
