# Chapter 9: How Do We Locate Disease-Causing Mutations?

### (Coursera Week 1)

Yes, the reference human genome is a mosaic of various genomes that does not match the genome of any individual human. Since various human genomes differ by only 0.1%, however, the amalgamation does not cause significant problems.

`"CAG"`affect the severity of Huntington's disease?

Huntington's disease is a rare genetic disease in that it is attributable to a single gene, called *Huntingtin*. This gene includes a trinucleotide repeat `"...CAGCAGCAG..."` that varies in length. Individuals with fewer than 26 copies of `"CAG"` in their *Huntingtin* gene are classified as unaffected by Huntington's disease, whereas individuals with more than 35 copies carry a large risk of the disease, and individuals with more than 40 copies will be afflicted. Moreover, an unaffected person can pass the disease to a child if the normal gene mutates and increases the repeat length. The reason why many repeated copies of `"CAG"` in *Huntingtin* leads to disease is that this gene produces a protein with many copies of glutamine (`"CAG"` codes for glutamine), which increases the decay rate of neurons.

Perhaps in theory, but in practice, biologists still use one reference genome, since comparison against thousands of reference genomes would be time-consuming.

`"panamabananas$"`?

The suffix tree for `"panamabananas$"` reproduced below contains 17 edges with the following labels (note that different edges may have the same labels):

```
$
a
bananas$
mabananas$
na
mabananas$
nanas$
s$
s$
bananas$
mabananas$
na
mabananas$
nas$
s$
panamabananas$
s$
```

*SuffixTree*(

*Text*) require memory on the order of 20·|

*Text*| if the number of nodes in the suffix tree does not exceed 2·|

*Text*|?

In addition to storing the nodes and edges of the suffix tree, we also need to store the information at the edge labels. Storing this information takes most of the memory allocated for the suffix tree.

Suffix trees were introduced by Weiner, 1973. However, the original linear-time algorithm for building the suffix tree was extremely complex. Although the Weiner algorithm was greatly simplified by Esko Ukkonen in 1995, it is still non-trivial. Check out this excellent StackOverflow post by Johannes Goller if you are interested in seeing a full explanation.

### (Coursera Week 2)

Our naive approach to constructing BWT(*Text*) requires constructing the matrix M(*Text*) of all cyclic rotations, which requires O(|*Text*|^{2}) time and space. However, there exist algorithms constructing BWT(*Text*) in linear time. One such algorithm first constructs the suffix array of *Text* in linear time and then uses this suffix array to construct BWT(*Text*).

In short, the last column is the only invertible column of the Burrows-Wheeler matrix. In other words, it is the only column from which we are always able to reconstruct the original string *Text*.

In practice, it is possible to compute the Last-to-First mapping of a given position of BWT(*Text*) with very low runtime and memory using the array holding the first occurrence of each symbol in the sorted string. Unfortunately, the analysis is beyond the scope of this class. For details, please see Ferragina and Manzini, 2000 (click here for full text).

*FirstColumn*appears among arguments in

**BWMatching**if it is never used in the

**BWMatching**pseudocode?

We indeed do not use *FirstColumn* in **BWMatching**. Although it seemingly does not make sense, we prefer this because we use *FirstColumn* in a modification of of **BWMatching** in a later section.

**BetterBWMatching**guaranteed to terminate?

The condition "*top* ≤ *bottom*" is a **loop invariant**, or a property that holds before and after each iteration of the loop. In this case, if pattern matches have been found, the number of matches is equal to *bottom* - *top* + 1. If pattern matches are not found, then at some point in the loop, *bottom* becomes equal to *top* - 1, in which case *top* ≤ *bottom* and the loop terminates.

**BetterBWMatching**work properly if

*Pattern*contains symbols that do not appear in

*Text*?

No; however, you can easily modify **BetterBWMatching** by first checking whether *Pattern* contains symbols not present in *Text* and immediately returning 0 in this case.

### (Coursera Week 3)

**BetterBWMatching**are needed to make it work with checkpoint arrays instead of count arrays?

To explain how to modify **BetterBWMatching** for working with checkpoint arrays, we explain how to quickly compute each value in the count array given the checkpoint arrays and *LastColumn*.

To compute *Count*_{symbol}(*i*, *LastColumn*), we represent *i* as *t*·*K* + *j*, where *j* < *K*. We can then compute *Count*_{symbol}(*i*, *LastColumn*) as *Count*_{symbol}(*t*·*K*, *LastColumn*) (contained in the checkpoint arrays) plus the number of occurrences of *symbol* in positions *t*·*K* + 1 to *i* in *LastColumn*.

Biologists usually set a small threshold for the maximum number of mismatches, since otherwise read mapping becomes too slow.

For example, does *Pattern* = `"TT ACTG"` match

*Text*=

`"`with

**ACTG**CTGCTG"*d*= 2 mismatches? Not according to the statement of the Multiple Approximate Pattern Matching Problem, since there is no

*starting position*in

*Text*where

*Pattern*

*appears as a substring with at most*

*d*mismatches.

BLAST does construct an alignment in a narrow band starting from each end of the seed. However, since the band is narrow, the algorithm for constructing this alignment is fast.

*Text*?

The algorithm illustrated in the epilogue would fail to find an approximate match of `"nad"` because the final symbol of `"nad"` does not appear in `"panamabananas$"`. To address this complication, we can modify the algorithm for finding a pattern of length *m* with up to *k* mismatches as follows.

We first run the algorithm described in the main text to find all approximate instances of a *Pattern* of length *k* against *Text*. However, this algorithm does not actually find all approximate matches of *Pattern* – since we do not allow mismatched strings in the early stages of **BetterBWMatching**, we miss those matches where the last letter of *Pattern* does not match *Text*. To fix this shortcoming, we can simply find all locations in *Text* where the prefix of *Pattern* of length *k* - 1 has *d* - 1 mismatches. Yet this algorithm fails to find matches where the last two letters of *Pattern* do not match *Text*. Thus, we need to run the algorithm again, finding all locations in *Text* where the prefix of *Pattern* of length *k* - 2 has *d * - 2 mismatches. We then find all locations in *Text* where the prefix of *Pattern *of length *k* - 3 occurs with *d* - 3 mismatches, and so on, finally finding all locations in *Text* where the prefix of *Pattern* of length *k* - *d* occurs exactly.

Yes, this strategy would fail to match a read with an error at the first position. However, as noted in the main text, if we start considering mismatches at the first position, the running time will significantly increase. As is, the running time explodes with the increase in the maximum number of errors. If one wants to alow mismatches at the first position, a more sensible strategy would be to trim the first position of the read.