# load dataset and store it into tse
data("Tengeler2020", package = "mia")
<- Tengeler2020 tse
distance-based Redundance Analysis (dbRDA)
Overview
To get started, we import Tengeler2020 from the mia package and store it into a variable.
First off, we transform the counts assay to relative abundances and store the new assay back in the TreeSE.
<- transformAssay(tse, method = "relabundance") tse
Ordination
RDA with Bray-Curtis index
<- runRDA(tse,
tse formula = assay ~ patient_status + cohort,
FUN = vegan::vegdist,
method = "bray",
assay.type = "relabundance")
<- plotReducedDim(tse, "RDA",
p colour_by = "patient_status",
shape_by = "cohort")
RDA with Aitchison distance
# perform clr transformation
<- transformAssay(tse,
tse assay.type = "relabundance",
method = "clr",
pseudocount = 1)
# run RDA
<- runRDA(tse,
tse formula = assay ~ patient_status + cohort,
FUN = vegan::vegdist,
method = "euclidean",
assay.type = "clr",
name = "Aitchison")
# plot RDA
<- plotReducedDim(tse, "Aitchison",
p colour_by = "patient_status",
shape_by = "cohort")
p
Significance testing
PERMANOVA analysis
<- attr(reducedDim(tse, "RDA"), "obj")
rda
set.seed(123)
<- anova.cca(rda,
terms_permanova permutations = 99)
set.seed(123)
<- anova.cca(rda,
margin_permanova by = "margin",
permutations = 99)
Df | SumOfSqs | F | Pr(>F) | Total variance | Explained variance | |
---|---|---|---|---|---|---|
Model | 3 | 0.6823806 | 1.0731820 | 0.39 | 5.557215 | 0.1227918 |
patient_status | 1 | 0.3789554 | 1.7879527 | 0.13 | 5.557215 | 0.0681916 |
cohort | 2 | 0.3212246 | 0.7577863 | 0.67 | 5.557215 | 0.0578032 |
Residual | 23 | 4.8748344 | NA | NA | 5.557215 | 0.8772082 |
Test homogeneity assumption
<- anova(betadisper(vegdist(t(assay(tse, "relabundance"))), tse$patient_status))
homo1 <- anova(betadisper(vegdist(t(assay(tse, "relabundance"))), tse$cohort)) homo2
Df | Sum Sq | Mean Sq | F value | Pr(>F) | |
---|---|---|---|---|---|
patient_status | 1 | 0.0012087 | 0.0012087 | 0.0891227 | 0.7677628 |
cohort | 2 | 0.0017934 | 0.0008967 | 0.0726010 | 0.9301753 |