-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise-sheet-4.Rmd
132 lines (73 loc) · 2.75 KB
/
exercise-sheet-4.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
title: "Exercise sheet 4: McCaskill"
---
---------------------------------
# Exercise 1
<!--- --------------------------------- -->
::: {.question data-latex=""}
You are given the following matrix $C$ for sequence $S$ = `AUCCAU`:
```{r, include=knitr::is_html_output(), echo=FALSE, fig.align='center', out.width='35%'}
knitr::include_graphics("assets/figures/exercise-sheet-4/e1-1.svg")
```
It was calculated using the following recursion:
$$
C_{i,j} = \textbf{1}(i,j) \cdot C_{i+1,j-1} \cdot 1 + \sum_{i\leq k < j} C_{i,k} \cdot C_{k+1,j}, \text{ with } \textbf{1}(i,j) = \begin{cases} 1 & \text{if } S_{i} S_{j} \text{ compl.} \\ 0 & \text{else} \end{cases}
$$
We assume a **minimum loop length of 0**.
:::
<!--- --------------------------------- -->
### 1.1
::: {.question data-latex=""}
Calculate the value of $C_{1,6}$. What does it represent?
:::
#### {.tabset}
##### Hide
##### Solution
::: {.answer data-latex=""}
$C_{1,6}$ is the number of possible secondary structures for the sequence $S$.
```{r, include=knitr::is_html_output(), echo=FALSE, fig.align='center', out.width='35%'}
knitr::include_graphics("assets/figures/exercise-sheet-4/e1-1_sol.svg")
```
:::
<!--- --------------------------------- -->
### 1.2
::: {.question data-latex=""}
Does this result make sense? Justify your answer!
:::
#### {.tabset}
##### Hide
##### Solution
::: {.answer data-latex=""}
No, this result does not make sense. The number of possible secondary structures for the sequence $S$ is much lower than 83.
Several structures are counted multiple times.
:::
<!--- --------------------------------- -->
### 1.3
::: {.question data-latex=""}
Recalculate the matrix $C$ using the following recursion:
$$
C_{i,j} = C_{i,j-1} + \sum\limits_{\substack{i \leq k < j \\ S_{k}, S_{j} \text{ compl.}}} C_{i,k-1} \cdot C_{k+1,j-1}
$$
```{r, include=knitr::is_html_output(), echo=FALSE, fig.align='center', out.width='35%'}
knitr::include_graphics("assets/figures/exercise-sheet-4/e1-2.svg")
```
:::
#### {.tabset}
##### Hide
##### Solution
::: {.answer data-latex=""}
```{r, include=knitr::is_html_output(), echo=FALSE, fig.align='center', out.width='35%'}
knitr::include_graphics("assets/figures/exercise-sheet-4/e1-2_sol.svg")
```
:::
<!--- --------------------------------- -->
### 1.4
::: {.question data-latex=""}
Why does the result of this recursion differ from the result of the first recursion?
:::
#### {.tabset}
##### Hide
##### Solution
::: {.answer data-latex=""}
There is no ambiguity, the first part of the recursion only counts cases where $j$ is unpaired and the second part only counts cases where $j$ is paired. Both parts of the recursion are disjoint. Whereas the recursion from exercise 1.1 is ambiguous in the second part of the recursion.
:::