Question: hi how to do this in python? Exercise 2 - Applied, Advanced Pancake Flipping Perhaps the most common type of genome rearrangement is an inversion,

 hi how to do this in python? Exercise 2 - Applied,

hi how to do this in python?

Exercise 2 - Applied, Advanced Pancake Flipping Perhaps the most common type of genome rearrangement is an inversion, which flips an entire interval of DNA found on the same chromosome. Often, we would like to determine the minimum number of inversions that have occurred on the evolutionary path between two chromosomes. Occasionally, inversions in DNA are the cause for divergence between species. DNA is read in one direction by the proteins in your body which transcribe DNA; as such, you can probably guess how the reversal or inversion of an entire section of DNA may cause notable changes to an organism. One other way of computing the difference between two genetic strings is the Hamming distance; the number of positions in the pair of strings which are different. This is a simple, and easy to implement distance metric, however it does not always provide the insight we may be looking for. For example, consider the following two DNA strings: ACGTTCGAGCCCA CTTGCCGAGACCA We note a Hamming distance of 6 (bold illustrates differences). However, we can also see that these strings are only 2 inversions away from each other (bold indicates an inversion): CTTGCCGAGACCA CTTGCAGAGCCCA > ACGTTCGAGCCCA Clearly, the problem here is different, and noticeably more complex. Here, we want to know how to go from the start to the end of the sequence of DNA with the minimum number of inversions or reversals. This motivates our more advanced version of pancake sorting: sorting by reversals. The computational problem of sorting by reversals asks that we provide a minimum list of reversals which transform one permutation into another. A reversal of a permutation creates a new permutation by inverting some interval within the permutation. As an example; [5,2,3,1,4],[5,3,4,1,2], and [4,1,2,3,5] are reversals of [5,3,2,1,4]. This is notably more complex than the problem posed in the prior exercise wherein we always flipped at 0 and i. When sorting by reversals, we may flip between any two indices i and j instead. The reversal distance between two permutations A and B, written dreversal(A,B), is the minimum number of reversals required to transform A into B (this assumes that A and B have the same length). Implement a sort by reversal, and make sure your function returns the reversals performed (with both indices i and j ) by outputting the indices at which these reversals were performed. If multiple collections of minimal reversals exist, return any such one. Example: Input: [1,8,9,3,2,7,6,5,4,10] Output: [2,5],[4,9]] We have performed 2 flips (bold indicates it has been reversed); Start: [1,8,9,3,2,7,6,5,4,10] 1st flip (2,5):[1,2,3,9,8,7,6,5,4,10] 2nd flip (4,9):[1,2,3,4,5,6,7,8,9,10]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!