runCCA | R Documentation |
These functions perform Canonical Correspondence Analysis on data stored
in a SummarizedExperiment
.
getCCA(x, ...)
addCCA(x, ...)
getRDA(x, ...)
addRDA(x, ...)
## S4 method for signature 'ANY'
getCCA(x, ...)
## S4 method for signature 'SummarizedExperiment'
getCCA(
x,
formula,
variables,
test.signif = TRUE,
assay.type = assay_name,
assay_name = exprs_values,
exprs_values = "counts",
scores = "wa",
...
)
calculateCCA(x, ...)
## S4 method for signature 'SingleCellExperiment'
addCCA(x, formula, variables, altexp = NULL, name = "CCA", ...)
runCCA(x, ...)
## S4 method for signature 'ANY'
getRDA(x, ...)
## S4 method for signature 'SummarizedExperiment'
getRDA(
x,
formula,
variables,
test.signif = TRUE,
assay.type = assay_name,
assay_name = exprs_values,
exprs_values = "counts",
scores = "wa",
...
)
calculateRDA(x, ...)
## S4 method for signature 'SingleCellExperiment'
addRDA(x, formula, variables, altexp = NULL, name = "RDA", ...)
runRDA(x, ...)
x |
|
... |
additional arguments passed to vegan::cca or vegan::dbrda and other internal functions.
|
formula |
If
|
variables |
When All variables are used. Please subset, if you want to consider only some of them.
|
test.signif |
|
assay.type |
|
assay_name |
Deprecated. Use |
exprs_values |
Deprecated. Use |
scores |
|
altexp |
|
name |
|
For run*
a
SingleCellExperiment
or a derived object.
*CCA functions utilize vegan:cca
and *RDA functions vegan:dbRDA
.
By default, dbRDA is done with euclidean distances, which is equivalent to
RDA.
Significance tests are done with vegan:anova.cca
(PERMANOVA). Group
dispersion, i.e., homogeneity within groups is analyzed with
vegan:betadisper
(multivariate homogeneity of groups dispersions (variances))
and statistical significance of homogeneity is tested with a test
specified by homogeneity.test
parameter.
For getCCA
a matrix with samples as rows and CCA dimensions as
columns. Attributes include calculated cca
/rda
object and
significance analysis results.
For addCCA
a modified x
with the results stored in
reducedDim
as the given name
.
For more details on the actual implementation see cca
and dbrda
library(miaViz)
data("enterotype", package = "mia")
tse <- enterotype
# Perform CCA and exclude any sample with missing ClinicalStatus
tse <- addCCA(tse,
formula = data ~ ClinicalStatus,
na.action = na.exclude)
# Plot CCA
plotCCA(tse, "CCA",
colour_by = "ClinicalStatus")
# Fetch significance results
attr(reducedDim(tse, "CCA"), "significance")
tse <- transformAssay(tse, method = "relabundance")
# Specify dissimilarity measure
tse <- addRDA(tse,
formula = data ~ ClinicalStatus,
assay.type = "relabundance",
method = "bray",
name = "RDA_bray")
# To scale values when using *RDA functions, use
# transformAssay(MARGIN = "features", ...)
tse <- transformAssay(tse,
method = "standardize",
MARGIN = "features")
# Data might include taxa that do not vary. Remove those because after
# z-transform their value is NA
tse <- tse[rowSums(is.na(assay(tse, "standardize"))) == 0, ]
# Calculate RDA
tse <- addRDA(tse,
formula = data ~ ClinicalStatus,
assay.type = "standardize",
name = "rda_scaled",
na.action = na.omit)
# Plot RDA
plotRDA(tse, "rda_scaled",
colour_by = "ClinicalStatus")
# A common choice along with PERMANOVA is ANOVA when statistical significance
# of homogeneity of groups is analysed. Moreover, full significance test
# results can be returned.
tse <- addRDA(tse,
formula = data ~ ClinicalStatus,
homogeneity.test = "anova",
full = TRUE)
# Example showing how to pass extra parameters, such as 'permutations',
# to anova.cca
tse <- addRDA(tse,
formula = data ~ ClinicalStatus,
permutations = 500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.