-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.qmd
518 lines (424 loc) · 12.7 KB
/
app.qmd
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
---
title: "doubletroubledb"
format:
dashboard:
logo: images/doubletroubledb_logo.png
favicon: images/doubletroubledb_logo.png
include-in-header:
- text: |
<link rel = "shortcut icon" href = "images/doubletroubledb_logo.png" />
---
```{r}
#| context: setup
#| message: false
#| warning: false
library(ggplot2)
library(tidyverse)
library(ggtree)
# Load data
load(here::here("data", "metadata_all.rda"))
load(here::here("data", "trees.rda"))
load(here::here("data", "dup_counts.rda"))
load(here::here("data", "urls.rda"))
# Load functions
source(here::here("R", "visualization.R"))
```
# Explore
Here, you can explore the relative contribution of each duplication mode
to the duplicated gene repertoire of all species in instances of
Ensembl (release 110) and Ensembl Genomes (release 57).
Duplication modes
include segmental (**SD**), tandem (**TD**), proximal (**PD**),
retrotransposed (**rTRD**), transposed (**TRD**), and dispersed (**DD**)
duplications.
## Row {.tabset}
### Plants
```{r}
#| width: 30%
# Plot tree - Plants
tree_plants <- plot_tree(
tree = trees$Plants,
metadata = metadata_all$Plants,
taxon = "order"
) +
ggtree::theme_tree2() +
theme(
axis.ticks = element_blank(),
axis.line.x = element_blank(),
axis.text.x = element_text(color = "white"),
legend.position = "none",
plot.margin = margin(0, 0, 0, 0, "cm")
)
tp <- plotly::ggplotly(tree_plants, tooltip = "label")
for(t in seq_along(tp$x$data)) {
tp$x$data[[t]]$text <- gsub("tooltip: ", "", tp$x$data[[t]]$text)
}
tp
```
```{r}
#| width: 70%
# Plot barplot - Plants
bar_plants <- dup_counts$Plants |>
dplyr::mutate(
species = factor(species, levels = rev(get_taxa_name(tree_plants)))
) |>
group_by(species) |>
mutate(
perc = n / sum(n),
perc = round(perc * 100, 2)
) |>
ungroup() |>
mutate(
text = paste0(
"Species: ", species, "\n",
"Type: ", type, "\n",
"N: ", n, "\n",
"%: ", perc
)
) |>
plot_duplicate_freqs(plot_type = "stack_percent") +
theme(
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
plot.margin = margin(0, 0, 0, 0, "cm")
) +
coord_cartesian(expand = FALSE) +
labs(y = NULL)
bp <- plotly::ggplotly(bar_plants, tooltip = "text")
for(t in seq_along(bp$x$data)) {
bp$x$data[[t]]$text <- gsub("text: ", "", bp$x$data[[t]]$text)
}
bp
```
### Vertebrates
```{r}
#| width: 30%
# Plot tree - Vertebrates
tree_vert <- plot_tree(
tree = trees$Vertebrates,
metadata = metadata_all$Vertebrates,
taxon = "class"
) +
ggtree::theme_tree2() +
theme(
axis.ticks = element_blank(),
axis.line.x = element_blank(),
axis.text.x = element_text(color = "white"),
legend.position = "none",
plot.margin = margin(0, 0, 0, 0, "cm")
)
tv <- plotly::ggplotly(tree_vert, tooltip = "label")
for(t in seq_along(tv$x$data)) {
tv$x$data[[t]]$text <- gsub("tooltip: ", "", tv$x$data[[t]]$text)
}
tv
```
```{r}
#| width: 70%
bar_vert <- dup_counts$Vertebrates |>
dplyr::mutate(
species = factor(species, levels = rev(get_taxa_name(tree_vert)))
) |>
group_by(species) |>
mutate(
perc = n / sum(n),
perc = round(perc * 100, 2)
) |>
ungroup() |>
mutate(
text = paste0(
"Species: ", species, "\n",
"Type: ", type, "\n",
"N: ", n, "\n",
"%: ", perc
)
) |>
plot_duplicate_freqs(plot_type = "stack_percent") +
theme(
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
plot.margin = margin(0, 0, 0, 0, "cm")
) +
coord_cartesian(expand = FALSE) +
labs(y = NULL)
bv <- plotly::ggplotly(bar_vert, tooltip = "text")
for(t in seq_along(bv$x$data)) {
bv$x$data[[t]]$text <- gsub("text: ", "", bv$x$data[[t]]$text)
}
bv
```
### Metazoa
```{r}
#| width: 30%
# Plot tree - Vertebrates
tree_mz <- plot_tree(
tree = trees$Metazoa,
metadata = metadata_all$Metazoa,
taxon = "phylum"
) +
ggtree::theme_tree2() +
theme(
axis.ticks = element_blank(),
axis.line.x = element_blank(),
axis.text.x = element_text(color = "white"),
legend.position = "none",
plot.margin = margin(0, 0, 0, 0, "cm")
)
tm <- plotly::ggplotly(tree_mz, tooltip = "label")
for(t in seq_along(tm$x$data)) {
tm$x$data[[t]]$text <- gsub("tooltip: ", "", tm$x$data[[t]]$text)
}
tm
```
```{r}
#| width: 70%
# Create barplot
bar_mz <- dup_counts$Metazoa |>
dplyr::mutate(
species = factor(species, levels = rev(get_taxa_name(tree_mz)))
) |>
group_by(species) |>
mutate(
perc = n / sum(n),
perc = round(perc * 100, 2)
) |>
ungroup() |>
mutate(
text = paste0(
"Species: ", species, "\n",
"Type: ", type, "\n",
"N: ", n, "\n",
"%: ", perc
)
) |>
plot_duplicate_freqs(plot_type = "stack_percent") +
theme(
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
plot.margin = margin(0, 0, 0, 0, "cm")
) +
coord_cartesian(expand = FALSE) +
labs(y = NULL)
bmz <- plotly::ggplotly(bar_mz, tooltip = "text")
for(t in seq_along(bmz$x$data)) {
bmz$x$data[[t]]$text <- gsub("text: ", "", bmz$x$data[[t]]$text)
}
bmz
```
### Fungi
```{r}
#| width: 30%
# Plot tree - Fungi
tree_f <- plot_tree(
tree = trees$Fungi,
metadata = metadata_all$Fungi,
taxon = "phylum"
) +
ggtree::theme_tree2() +
theme(
axis.ticks = element_blank(),
axis.line.x = element_blank(),
axis.text.x = element_text(color = "white"),
legend.position = "none",
plot.margin = margin(0, 0, 0, 0, "cm")
)
tf <- plotly::ggplotly(tree_f, tooltip = "label")
for(t in seq_along(tf$x$data)) {
tf$x$data[[t]]$text <- gsub("tooltip: ", "", tf$x$data[[t]]$text)
}
tf
```
```{r}
#| width: 70%
# Create barplot
bar_f <- dup_counts$Fungi |>
dplyr::mutate(
species = factor(species, levels = rev(get_taxa_name(tree_f)))
) |>
group_by(species) |>
mutate(
perc = n / sum(n),
perc = round(perc * 100, 2)
) |>
ungroup() |>
mutate(
text = paste0(
"Species: ", species, "\n",
"Type: ", type, "\n",
"N: ", n, "\n",
"%: ", perc
)
) |>
plot_duplicate_freqs(plot_type = "stack_percent") +
theme(
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
plot.margin = margin(0, 0, 0, 0, "cm")
) +
coord_cartesian(expand = FALSE) +
labs(y = NULL)
bf <- plotly::ggplotly(bar_f, tooltip = "text")
for(t in seq_along(bf$x$data)) {
bf$x$data[[t]]$text <- gsub("text: ", "", bf$x$data[[t]]$text)
}
bf
```
### Protists
```{r}
#| width: 30%
# Plot tree - Fungi
tree_p <- plot_tree(
tree = trees$Protists,
metadata = metadata_all$Protists,
taxon = "phylum"
) +
ggtree::theme_tree2() +
theme(
axis.ticks = element_blank(),
axis.line.x = element_blank(),
axis.text.x = element_text(color = "white"),
legend.position = "none",
plot.margin = margin(0, 0, 0, 0, "cm")
)
tp <- plotly::ggplotly(tree_p, tooltip = "label")
for(t in seq_along(tp$x$data)) {
tp$x$data[[t]]$text <- gsub("tooltip: ", "", tp$x$data[[t]]$text)
}
tp
```
```{r}
#| width: 70%
# Create barplot
bar_p <- dup_counts$Protists |>
dplyr::mutate(
species = factor(species, levels = rev(get_taxa_name(tree_p)))
) |>
group_by(species) |>
mutate(
perc = n / sum(n),
perc = round(perc * 100, 2)
) |>
ungroup() |>
mutate(
text = paste0(
"Species: ", species, "\n",
"Type: ", type, "\n",
"N: ", n, "\n",
"%: ", perc
)
) |>
plot_duplicate_freqs(plot_type = "stack_percent") +
theme(
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
plot.margin = margin(0, 0, 0, 0, "cm")
) +
coord_cartesian(expand = FALSE) +
labs(y = NULL)
bp <- plotly::ggplotly(bar_p, tooltip = "text")
for(t in seq_along(bp$x$data)) {
bp$x$data[[t]]$text <- gsub("text: ", "", bp$x$data[[t]]$text)
}
bp
```
# Download
Use the column filters and search bar to find your species of interest. Then,
click the species name to download a list of all duplicate pairs
and duplicated genes.
```{r}
# Reduce list of data frames to a single data frame
dmetadata <- dplyr::bind_rows(metadata_all, .id = "Ensembl") |>
inner_join(urls, by = "species") |>
mutate(
species_name = paste0(
"<a href='", url, "' target='_blank'>", ncbi_species, "</a>"
)
)
# Keep only useful columns
cols <- c(
Species = "species_name", TaxID = "taxonomy_id",
Assembly = "assembly", Accession = "assembly_accession",
Family = "family", Order = "order", Class = "class",
Phylum = "phylum"
)
final_table <- dmetadata[, cols]
names(final_table) <- names(cols)
final_table$TaxID <- as.character(final_table$TaxID)
# Create DataTable
dt <- DT::datatable(
final_table,
selection = 'single',
rownames = FALSE,
filter = 'top',
escape = FALSE,
options = list(
lengthMenu = c(5, 10, 25, 50, 100),
pageLength = 10
)
)
dt
```
# FAQ
::: {.callout-note icon="false"}
## 1) How do I cite this resource?
To cite `doubletroubledb` in publications, use:
> Almeida-Silva, F., & de Peer, Y. V. (2024). doubletrouble: an R/Bioconductor package for the identification, classification, and analysis of gene and genome duplications. BioRxiv. https://doi.org/10.1101/2024.02.27.582236
A BibTeX entry for LaTeX users is:
```
@article{Almeida-Silva2024.02.27.582236,
author = {Fabricio Almeida-Silva and Yves Van de Peer},
title = {doubletrouble: an R/Bioconductor package for the identification, classification, and analysis of gene and genome duplications},
year = {2024},
doi = {10.1101/2024.02.27.582236},
publisher = {Cold Spring Harbor Laboratory},
URL = {https://www.biorxiv.org/content/early/2024/02/29/2024.02.27.582236},
journal = {bioRxiv}
}
```
:::
---
::: {.callout-note icon="false"}
## 2) How do I report an issue or suggest a feature?
You can open an issue in the [GitHub repository](https://github.com/almeidasilvaf/doubletroubledb)
where the source code for this app is.
:::
---
::: {.callout-note icon="false"}
## 3) Where can I find the code used to create the data in this resource?
All data in this resource (duplicate pairs, duplicated genes,
and .collinearity files) were generated for a benchmark in
[the paper associated with this app](https://doi.org/10.1101/2024.02.27.582236).
All code used in this paper are available in the pages below:
1. GitHub repository: <https://github.com/almeidasilvaf/doubletrouble_paper>.
2. Quarto book: <https://almeidasilvaf.github.io/doubletrouble_paper/>.
:::
---
::: {.callout-note icon="false"}
## 4) The tree topology is not 100% accurate in a specific species tree. Why is that?
Since Ensembl doesn't provide species trees for all its instances, we
inferred a species tree using a standard approach in phylogenomics.
The following fragment was extracted from the manuscript associated
with this publication:
> BUSCO scores (Manni et al. 2021) for each species were obtained and
visualized using the Bioconductor package
cogeqc (Almeida‐Silva and Van de Peer 2023). BUSCO genes shared by >90% of
the species were aligned with MAFFT (Katoh and Standley 2013), and
multiple sequence alignments were concatenated and trimmed to remove
alignment columns with >50% gaps. Filtered supermatrices were used for
phylogeny inference with IQ-TREE2 (Minh et al. 2020). Oomycetes, red algae,
*Giardia lamblia*, *Mnemiopsis leidyi*, and
*Saccharomyces cerevisiae* were used as outgroups for Ensembl Fungi, Ensembl
Plants, Ensembl Protists, Ensembl Metazoa, and Ensembl, respectively.
Although inferring trees from BUSCO genes is common practice, this method
has limitations and can lead to wrong topologies. Our goal here was not
test hypotheses on the phylogeny of each Ensembl instance (with more
sophisticated methods such as partition models, microsynteny-based phylogenies,
and gene tree-species tree reconciliation methods, for instance). Instead,
we simply wanted to have species trees that could be used as a phylogenetic
context to explore major patterns in the frequency of duplicated genes
by mode.
If you have a curated species tree that includes all species in one (or more)
of the Ensembl instances used here, we'd be happy to update the tree in this
app. You can contribute data by opening an issue in
[this GitHub repo](https://github.com/almeidasilvaf/doubletroubledb).
:::