-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.Rmd
executable file
·388 lines (341 loc) · 13.6 KB
/
report.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
---
title: "WDV MSA"
author: "Maciej Motyka"
date: "4/8/2020"
output:
html_document:
toc: true
toc_float: true
toc_depth: 3
code_folding: "hide"
# theme: darkly
#css: styles.css
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE)
```
# Comparing ClustalW, ClustalO and Muscle alignments
## aBayesQR ml.dist -> NJ trees {.tabset}
Theres a perfect topological agreement between the Muscle, ClustalO, and ClustalW aligned dist.ml distance NJ trees. There are minor branch length differences, mostly in the distance of between WDV-B and WDV-W. ClustalO shows bigger distance than ClustalW and Muscle which show similar distance.
Tree on the left shows true edge lengths. s05 represents WDV-B and is very distant from other sequences which are all WDV-W. Among the WDV-W only s09 forms its own clade which makes sense, as it is the only sample which comes solely from one plant. This clade is the most dissimilar among the WDV-W clades, it includes s09-h3 which is the most distinct haplotype among WDV-W.
Tree on the right doesn't show true distances, but presents the topology much better. s14 and s15 almost form separate clades, in spite of having multiple haplotypes.
### densiTree true distances
```{r fig.height=15, fig.width=12}
drake::loadd("nj_mlDist_ClustO_abqr_001",
"nj_mlDist_ClustW_abqr_001",
"nj_mlDist_Muscle_abqr_001")
trees <- c(nj_mlDist_ClustO_abqr_001,
nj_mlDist_ClustW_abqr_001,
nj_mlDist_Muscle_abqr_001)
rooted_trees <- lapply(X = trees,
FUN = ape::root.phylo,
outgroup = "s05_h1_57",
resolve.root = T)
class(rooted_trees) <- "multiPhylo"
# Shows true distances between sequences, but makes hard to assess the similarity of topologies
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = F,
# jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = T,
scale.bar = F
)
title("True distances")
```
### densiTree scaled distances
```{r fig.height=20}
# Shows well how similar the topologies are, doesn't show true distances between sequences
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = T,
jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = F,
label.offset = 0.01,
scale.bar = F
)
title("Scaled distances")
```
## CliqueSNV t10 tf01 ml.dist -> NJ trees {.tabset}
```{r load and root csnv t10 tf01 trees}
drake::loadd("nj_mlDist_ClustO_csnv_t10_tf01",
"nj_mlDist_ClustW_csnv_t10_tf01",
"nj_mlDist_Muscle_csnv_t10_tf01")
trees <- c(nj_mlDist_ClustO_csnv_t10_tf01,
nj_mlDist_ClustW_csnv_t10_tf01,
nj_mlDist_Muscle_csnv_t10_tf01)
rooted_trees <- lapply(X = trees,
FUN = ape::root.phylo,
outgroup = trees[[1]]$tip.label %>% grep("s05_h1", ., value = T),
resolve.root = T)
class(rooted_trees) <- "multiPhylo"
```
### Side by side
```{r fig.height=20, fig.width=15}
par(mfrow = c(1,3))
ape::plot.phylo(rooted_trees[[1]],
main = "ClustalO -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
ape::plot.phylo(rooted_trees[[2]],
main = "ClustalW -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
ape::plot.phylo(rooted_trees[[3]],
main = "Muscle -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
```
### Pairwise ClustO vs ClustW
```{r fig.height=20, fig.keep='all', fig.show='hold'}
treespace::plotTreeDiff(tr1 = rooted_trees[[1]],
tr2 = rooted_trees[[2]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized treesD
```
### Pairwise ClustO vs Muscle
```{r fig.height=20}
treespace::plotTreeDiff(tr1 = rooted_trees[[1]],
tr2 = rooted_trees[[3]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized trees
```
### Pairwise ClustW vs Muscle
```{r fig.height=20}
treespace::plotTreeDiff(tr1 = rooted_trees[[2]],
tr2 = rooted_trees[[3]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized trees
```
### densiTree true distances
```{r fig.height=20, fig.width=12}
# Shows true distances between sequences, but makes hard to assess the similarity of topologies
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = F,
# jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = T,
scale.bar = F
)
title("True distances")
```
### densiTree scaled distances
```{r fig.height=20}
# Shows well how similar the topologies are, doesn't show true distances between sequences
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = T,
jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = F,
label.offset = 0.01,
scale.bar = F
)
title("Scaled? distances")
```
## CliqueSNV t5 tf01 ml.dist -> NJ trees {.tabset}
```{r load and root csnv t5 tf01 trees}
drake::loadd("nj_mlDist_ClustO_csnv_t5_tf01",
"nj_mlDist_ClustW_csnv_t5_tf01",
"nj_mlDist_Muscle_csnv_t5_tf01")
trees <- c(nj_mlDist_ClustO_csnv_t5_tf01,
nj_mlDist_ClustW_csnv_t5_tf01,
nj_mlDist_Muscle_csnv_t5_tf01)
rooted_trees <- lapply(X = trees,
FUN = ape::root.phylo,
outgroup = trees[[1]]$tip.label %>% grep("s05_h1", ., value = T),
resolve.root = T)
class(rooted_trees) <- "multiPhylo"
```
### Side by side
```{r fig.height=20, fig.width=15}
par(mfrow = c(1,3))
ape::plot.phylo(rooted_trees[[1]],
main = "ClustalO -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
ape::plot.phylo(rooted_trees[[2]],
main = "ClustalW -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
ape::plot.phylo(rooted_trees[[3]],
main = "Muscle -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
```
### Pairwise ClustO vs ClustW
```{r fig.height=20, fig.keep='all', fig.show='hold'}
treespace::plotTreeDiff(tr1 = rooted_trees[[1]],
tr2 = rooted_trees[[2]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized treesD
```
### Pairwise ClustO vs Muscle
```{r fig.height=20}
treespace::plotTreeDiff(tr1 = rooted_trees[[1]],
tr2 = rooted_trees[[3]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized trees
```
### Pairwise ClustW vs Muscle
```{r fig.height=20}
treespace::plotTreeDiff(tr1 = rooted_trees[[2]],
tr2 = rooted_trees[[3]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized trees
```
### densiTree true dist
```{r fig.height=20, fig.width=12}
# Shows true distances between sequences, but makes hard to assess the similarity of topologies
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = F,
# jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = T,
scale.bar = F
)
title("True distances")
```
### densiTree scaled
```{r fig.height=20}
# Shows well how similar the topologies are, doesn't show true distances between sequences
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = T,
jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = F,
label.offset = 0.01,
scale.bar = F
)
title("Scaled? distances")
```
## CliqueSNV t5 tf001 ml.dist -> NJ trees {.tabset}
```{r load and root csnv t5 tf001 trees}
drake::loadd("nj_mlDist_ClustO_csnv_t5_tf001",
"nj_mlDist_ClustW_csnv_t5_tf001",
"nj_mlDist_Muscle_csnv_t5_tf001")
trees <- c(nj_mlDist_ClustO_csnv_t5_tf001,
nj_mlDist_ClustW_csnv_t5_tf001,
nj_mlDist_Muscle_csnv_t5_tf001)
rooted_trees <- lapply(X = trees,
FUN = ape::root.phylo,
outgroup = trees[[1]]$tip.label %>% grep("s05_h1", ., value = T),
resolve.root = T)
class(rooted_trees) <- "multiPhylo"
```
### Side by side
```{r fig.height=20, fig.width=15}
par(mfrow = c(1,3))
ape::plot.phylo(rooted_trees[[1]],
main = "ClustalO -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
ape::plot.phylo(rooted_trees[[2]],
main = "ClustalW -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
ape::plot.phylo(rooted_trees[[3]],
main = "Muscle -> dist.ml -> NJ",
use.edge.length = F,
cex = 1.3,
label.offset = 0.5)
```
### Pairwise ClustO vs ClustW
```{r fig.height=20, fig.keep='all', fig.show='hold'}
treespace::plotTreeDiff(tr1 = rooted_trees[[1]],
tr2 = rooted_trees[[2]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized treesD
```
### Pairwise ClustO vs Muscle
```{r fig.height=20}
treespace::plotTreeDiff(tr1 = rooted_trees[[1]],
tr2 = rooted_trees[[3]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized trees
```
### Pairwise ClustW vs Muscle
```{r fig.height=20}
treespace::plotTreeDiff(tr1 = rooted_trees[[2]],
tr2 = rooted_trees[[3]],
use.edge.length = FALSE,
treesFacing = TRUE,
colourMethod = "palette",
palette = adegenet::funky,
tipMatch = FALSE) # defaults to TRUE; disable when using ladderized trees
```
### densiTree true dist
```{r fig.height=20, fig.width=12}
# Shows true distances between sequences, but makes hard to assess the similarity of topologies
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = F,
# jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = T,
scale.bar = F
)
title("True distances")
```
### densiTree scaled
```{r fig.height=20}
# Shows well how similar the topologies are, doesn't show true distances between sequences
phangorn::densiTree(rooted_trees,
type = "p",
scaleX = T,
jitter = list(amount = 0.05, random = FALSE),
alpha = 0.5,
col = c("red", "green", "blue"),
use.edge.length = F,
label.offset = 0.01,
scale.bar = F
)
title("Scaled? distances")
```
## Session info
```{r session_info, include=TRUE, echo=TRUE, results='markup'}
sessioninfo::session_info()
```