-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtengeler.Rmd
213 lines (165 loc) · 3.65 KB
/
tengeler.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
---
title: "Examples with published dataset: Tengeler"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Examples with published dataset: Tengeler}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
This tutorial explore a phyloseq version of the dataset from Tengeler et al. (2020) available in the `mia` package.
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE,
fig.width = 10
)
```
# Load library
```{r}
library("MicrobiotaProcess")
library("MiscMetabar")
library("ggplot2")
library("patchwork")
library("iNEXT")
```
```{r, eval=FALSE}
?Tengeler2020
```
# Import dataset in phyloseq format
```{r}
data(Tengeler2020_pq)
ten <- Tengeler2020_pq
summary_plot_pq(ten)
```
# Alpha-diversity analysis
```{r}
hill_pq(ten, "patient_status", one_plot = TRUE)
```
```{r}
res_inext <-
iNEXT_pq(ten,
datatype = "abundance",
merge_sample_by = "patient_status_vs_cohort",
nboot = 5
)
ggiNEXT(res_inext)
```
```{r}
accu_plot(
ten,
fact = "sample_name",
add_nb_seq = TRUE,
by.fact = TRUE,
step = 100
) + theme(legend.position = c(.8, .6))
```
# Explore taxonomy
```{r}
# library(metacoder)
# heat_tree_pq(
# ten,
# node_size = n_obs,
# node_color = nb_sequences,
# node_label = taxon_names,
# tree_label = taxon_names,
# node_size_trans = "log10 area"
# )
```
```{r}
treemap_pq(ten, lvl1 = "Order", lvl2 = "Family")
```
# Beta-diversity analysis : effect of patient status and cohort
```{r}
circle_pq(ten, "patient_status")
```
```{r}
upset_pq(ten, "patient_status_vs_cohort")
```
```{r}
ggvenn_pq(clean_pq(ten, force_taxa_as_columns = TRUE),
"cohort",
rarefy_before_merging = TRUE
) +
theme(legend.position = "none")
```
```{r}
ten_control <- clean_pq(subset_samples(ten, patient_status == "Control"))
# p_control <- heat_tree_pq(
# ten_control,
# node_size = n_obs,
# node_color = nb_sequences,
# node_label = taxon_names,
# tree_label = taxon_names,
# node_size_trans = "log10 area"
# )
ten_ADHD <- clean_pq(subset_samples(ten, patient_status == "ADHD"))
# p_ADHD <- heat_tree_pq(
# ten_ADHD,
# node_size = n_obs,
# node_color = nb_sequences,
# node_label = taxon_names,
# tree_label = taxon_names,
# node_size_trans = "log10 area"
# )
#
# p_control + ggtitle("Control") + p_ADHD + ggtitle("ADHD")
```
```{r}
knitr::kable(track_wkflow(list(
"All samples" = ten,
"Control samples" = ten_control,
"ADHD samples" = ten_ADHD
)))
```
```{r}
adonis_pq(ten, "cohort + patient_status")
```
```{r}
ten@tax_table <- phyloseq::tax_table(cbind(
ten@tax_table,
"Species" = taxa_names(ten)
))
biplot_pq(subset_taxa_pq(ten, taxa_sums(ten) > 3000),
merge_sample_by = "patient_status",
fact = "patient_status",
nudge_y = 0.4
)
```
```{r}
multitax_bar_pq(ten, "Phylum", "Class", "Order", "patient_status")
```
```{r}
multitax_bar_pq(ten, "Phylum", "Class", "Order", "patient_status",
nb_seq = FALSE, log10trans = FALSE
)
```
# Differential abundance analysis
```{r}
plot_deseq2_pq(ten,
contrast = c("patient_status", "ADHD", "Control"),
taxolev = "Genus"
)
```
```{r}
LEfSe <- diff_analysis(
ten,
classgroup = "patient_status",
mlfun = "lda",
ldascore = 2,
p.adjust.methods = "bh"
)
library(ggplot2)
ggeffectsize(LEfSe) +
scale_color_manual(values = c(
"#00AED7",
"#FD9347"
)) +
theme_bw()
```
# Session information
```{r}
sessionInfo()
```
# References
Tengeler, A.C., Dam, S.A., Wiesmann, M. et al. Gut microbiota from persons with attention-deficit/hyperactivity disorder affects the brain in mice. Microbiome 8, 44 (2020). https://microbiomejournal.biomedcentral.com/articles/10.1186/s40168-020-00816-x