Lec06 570
Lec06 570
Fall 2011
.
Alexander Dekhtyar
.
Biological meaning. In a permutation , each component i represents a block of genes that persisted through a variety of genomes. Biologists construct such maps for dierent organisms - each can be represented by some permutation. The key study question here is, what is the sequence of reversals that leads from one genome to another. Genome reversal problem. Given two permutations and of n numbers, nd a series of reversals 1 , . . . , t , such that: 1. rho1 . . . t = ; 2. t is minimized. t is called the reversal distance between and . 1
Note. Without loss of generality, we assume that = 1, 2, 3, . . . , n. The problem of genome reversal to the identity permutation is sometimes called the sorting by reversal problem.
Function FindPosition(). FindPosition nds a position j in the permutation (array) , such that j = i. Without preprocessing, it can be done in O(n) for each call. To speed up FindPosition() we can create an array P [1..n], such that P [i] is such that P [i] = i, i.e., the position in , which contains number i. If an up-to-date version of P is available prior to calling FindPosition, then, FindPosition() works in O(1). Function Reversal(). Reversal(, i, j ) performs the reversal operation (i, j ) on permutation . This can be done in O(n) time, with the use of a supplemental variable which would be used for value exchange. Because a reversal changes the locations of various values in the permutations, a new array P needs to be computed. This computation, however, can be done in a straightforward manner - each time a new assignment to a position in
is made, the appropriate update of the array P is performed. This doubles the number of operations, but the running time of this algorithm will remain O(n). Analysis. Straightforward implementation of SimpleReversalSort() takes O(n2 ) time: the outer loop repeats O(n) times, and each loop repeat involves, in worst case, an O(n) operation. SimpleReversalSort is NOT optimal. Consider the following permutation = 7, 6, 1, 2, 3, 4, 5. SimpleReveralSort with as input will produce the following output: 7 1 1 1 1 1 6 6 2 2 2 2 1 7 7 3 3 3 2 2 6 6 4 4 3 3 3 7 7 5 4 4 4 4 6 6 5 5 5 5 5 7 Reversal(1,3) Reversal(2,4) Reversal(3,5) Reversal(4,6) Reversal(5,7)
That is, SimpleReversalSort sorts the permutation using ve reversals. Yet, the following shows that there is a sequence of reversals that takes fewer steps: 7 6 1 2 3 4 5 7 6 5 4 3 2 1 1 2 3 4 5 6 7 Reversal(3,7) Reversal(1,7)
Theorem. If a permutation has a decreasing strip, then there exists a reversal that decreases the number of breakpoints in : b( ) < b( ). Proof. Consider a decreasing strip i , . . . , j in , such that j = k is the smallest number terminating a decreasing strip. The number k 1 must therefore terminate an increasing strip : (k is the smallest terminus of a decreasing strip, it is NOT followed by k 1, hence k 1 either is surrounded by two breakpoints somewhere, or is the end of an increasing strip of length 2. Let s be the position of k in . Let = (s + 1, j ) (or (j + 1, s) - depending on which number if greater). will eliminate put k and k 1 on the same strip. Example. Consider = 0, 4, 3, 7, 6, 2, 1, 5, 8. Here, the decreasing strip with the smallest terminus is 2, 1, and k 1 = 0, at position 0. The total number of breakpoints is 5((0, 4), (3, 7), (6, 2), (1, 5), (5, 8). We use the reversal (1, 6). (1, 6) = 0, 1, 2, 6, 7, 3, 4, 5, 8. Here, the number of breakpoints is 3 : (2, 6), (7, 3) and (5, 8). Example. Consider = 0, 5, 4, 6, 7, 1, 2, 3, 8. This permutation has 4 breakpoints ((0, 5), (4, 6), (7, 1), (3, 8) and only one decreasing strip, 5, 4. We apply the trasformation (3, 7): (1, 7) = 0, 5, 4, 3, 2, 1, 7, 6, 8. Here, the number of breakpoints is 3 : (0, 5), (1, 7) and (6, 8). What if there is no decreasing strip? If has no decreasing strip, then we pick any increasing strip and reverse it. This will create a decreasing strip in and we can apply our theorem. Lemma. If has no decreasing strips, then reversing any increasing strip does not change the total number of breakpoints. Example. Recall our permutation = 0, 4, 3, 7, 6, 2, 1, 5. We applied a reversal (1, 6) to it to get (1, 6) = 0, 1, 2, 6, 7, 3, 4, 5, 8. This permutation has no decreasing strips. We pick an increasing strip 6, 7 and reverse it using (3, 4): (1, 6) (3, 4) = 0, 1, 2, 7, 6, 3, 4, 5, 8. There is now a decreasing strip and we can proceed with reversing it: (1, 6) (3, 4) (5, 7) = 0, 1, 2, 7, 6, 5, 4, 3, 8 (1, 6) (3, 4) (5, 7) (3, 7) = 0, 1, 2, 3, 4, 5, 6, 7, 8 Algorithm. The outline of the algorithm is: 1. If has decreasing strips, nd the decreasing strip with the smallest terminus k , and merge it with k 1. 2. If has no decreasing strips, reverse any increasing strip. 4
References
[1] John Kececioglu, David Sanko, Exact and Approximation Algorithms for Sorting by Reversals with Applications to Genome Rearrangement, Algorithmica, Vo. 1/2: pp. 180-210 (1995).