Skip to content

Commit

Permalink
added PAM solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
domonik committed Feb 26, 2024
1 parent f1171c4 commit d7a3bf2
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 6 deletions.
70 changes: 64 additions & 6 deletions exercise-sheet-8.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,51 @@ s_{x,y} & \text{otherwise (match/mismatch)}

##### Hide

##### Hint: Possible Answers
##### Hint: Matrices

::::{#img1-p .extra-m}
::: {#img3 .tutorial-img}
```{r, echo=FALSE, out.width="100%", fig.align='center', include=knitr::is_html_output()}
knitr::include_graphics("figures/sheet-8/sheet8-exercise1-D-result.svg")
:::: {.flex-container}

::: {#half .half}

```{r, results="asis", include=knitr::is_html_output(), echo=FALSE}
tij <- read.csv("tables/sheet8_1d.csv", check.names=FALSE, sep=";")
tij_ft <- flextable(tij)
tij_ft <- custom_theme(tij_ft)
index_replace(tij_ft)
```

:::


::: {#half .half}


```{r, results="asis", include=knitr::is_html_output(), echo=FALSE}
tij <- read.csv("tables/sheet8_1d2.csv", check.names=FALSE, sep=";")
tij_ft <- flextable(tij)
tij_ft <- custom_theme(tij_ft)
index_replace(tij_ft)
```

:::
::::

##### Solution

B
general scoring:

```
ACC
ATT
```

PAM scoring:

```
ACC--
A--TT
```


#### {-}

Expand Down Expand Up @@ -295,12 +327,38 @@ Determine $PAM_2$. (round to integer)

##### Hide



##### Hint: Formulae

\[
PAM(m)_{xy} = 10 \log_{10} \left(\frac{p'_{xy}}{r_y}\right) \text{ with } p'_{xy} \in (P')^m
\]

##### Hint: P2

\[
(P')^2 = \begin{bmatrix}
0.9910 & 0.0015 & 0.0045 & 0.003 \\
0.0030 & 0.9910 & 0.0030 & 0.003 \\
0.0045 & 0.0015 & 0.9910 & 0.003 \\
0.0060 & 0.0030 & 0.0060 & 0.985 \\
\end{bmatrix} \times
\begin{bmatrix}
0.9910 & 0.0015 & 0.0045 & 0.003 \\
0.0030 & 0.9910 & 0.0030 & 0.003 \\
0.0045 & 0.0015 & 0.9910 & 0.003 \\
0.0060 & 0.0030 & 0.0060 & 0.985 \\
\end{bmatrix}
=
\begin{bmatrix}
0.98212375 & 0.00298875 & 0.0089415 & 0.005946 \\
0.0059775 & 0.982099 & 0.0059775 & 0.005946 \\
0.0089415 & 0.00298875 & 0.98212375 & 0.005946 \\
0.011892 & 0.005946 & 0.011892 & 0.97027 \\
\end{bmatrix}
\]

##### Solution

```{r, include=FALSE}
Expand Down
5 changes: 5 additions & 0 deletions tables/sheet8_1d.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"S^{g}_{i,j}";"-";"A1";"T1";"T2"
"-";0;-2;-4;-6
"A";-2;5;3;1
"C";-4;3;3;1
"C";-6;1;1;1
5 changes: 5 additions & 0 deletions tables/sheet8_1d2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"S^{PAM}_{i,j}";"-";"A1";"T1";"T2"
"-";0;-2;-4;-6
"A";-2;3;1;-1
"C";-4;1;-1;-3
"C";-6;-1;-3;-5

0 comments on commit d7a3bf2

Please sign in to comment.