A cyclic rotation moves the first character to the end without changing the cyclic order of the remaining characters. Starting with the specified terminator-first row and repeatedly rotating left gives the following matrix; its row order is only a construction order, not a sorting order:Under lexicographic order, compare characters from left to right, using . The sorted cyclic rotation matrix is thereforeThe Burrows-Wheeler transform is the last column, read downwards, so the transformed string is
To invert the Burrows-Wheeler transform, begin with six empty rows. At every iteration prepend the supplied last-column characters in their fixed row order, then sort the resulting rows in lexicographic order. After iterations the rows contain the length- prefixes of the sorted cyclic rotations. For example, the first two iterations giveEach iteration works because sorting the preceding character together with the already reconstructed prefix restores the ordering of the next-longer prefixes. Six iterations give the completed matrixThe original linear string is the unique row ending in the terminator, henceAs a check, the reconstructed matrix's final column is precisely the supplied Burrows-Wheeler transform.
Use one-based row numbers, and write and for the first and last columns. The last-to-first mapping matches the th occurrence of a character in to its th occurrence in : equal characters retain the ordering of their following suffixes. This lets us extend an interval of matching suffixes one character to the left without reconstructing the full strings.
Start with the last query character. Rows of contain C, so the interval of suffixes beginning with C is . Within those rows, the A entries of are at rows and . They are respectively the first and second A entries in all of , and therefore map to rows and of . These are exactly the suffixes beginning with AC. Reading their supplied positions gives matches starting at positions 11 and 3, or positions 3 and 11 in increasing genomic order.
The same calculation can be written as backward search. Let count characters strictly smaller than , and let count occurrences of in , with . Prepending changes an inclusive interval toHere , and , giving .
Build an FM-index: store the Burrows-Wheeler transform, cumulative character counts , and a structure supporting fast rank queries for . Then each step of backward search uses two rank queries instead of rescanning the last column. A wavelet tree or suitably checkpointed counts can supply these queries while keeping memory manageable. The counting cost is proportional to query length times the rank query cost, rather than repeatedly scanning the whole genome.[ref]
Opportunistic Data Structures with Applications by Paolo Ferragina and others. §2, LF-mapping; §§3.1–3.2, counting and locating occurrences
To recover genomic positions, store a sampled suffix array and follow the last-to-first mapping to a sampled position, adding the number of steps taken. More samples trade storage for faster position recovery. Index character counts and sample positions, rather than storing the quadratic-size full cyclic rotation matrix.
Articles by others on the same topic
There are currently no matching articles.