runCCA | R Documentation |
These functions perform Canonical Correspondence Analysis on data stored
in a SummarizedExperiment
.
calculateCCA(x, ...)
runCCA(x, ...)
calculateRDA(x, ...)
runRDA(x, ...)
## S4 method for signature 'ANY'
calculateCCA(x, ...)
## S4 method for signature 'SummarizedExperiment'
calculateCCA(
x,
formula,
variables,
test.signif = TRUE,
assay.type = assay_name,
assay_name = exprs_values,
exprs_values = "counts",
scores = "wa",
...
)
## S4 method for signature 'SingleCellExperiment'
runCCA(x, formula, variables, altexp = NULL, name = "CCA", ...)
## S4 method for signature 'ANY'
calculateRDA(x, ...)
## S4 method for signature 'SummarizedExperiment'
calculateRDA(
x,
formula,
variables,
test.signif = TRUE,
assay.type = assay_name,
assay_name = exprs_values,
exprs_values = "counts",
scores = "wa",
...
)
## S4 method for signature 'SingleCellExperiment'
runRDA(x, formula, variables, altexp = NULL, name = "RDA", ...)
x |
For For |
... |
additional arguments passed to vegan::cca or vegan::dbrda and other internal functions.
|
formula |
If
|
variables |
When When All variables are used. Please subset, if you want to consider only some of them.
|
test.signif |
a logical scalar, should the PERMANOVA and analysis of
multivariate homogeneity of group dispersions be performed.
(By default: |
assay.type |
a single |
assay_name |
a single |
exprs_values |
a single |
scores |
A string specifying scores to be returned. Must be
'wa' (site scores found as weighted averages (cca) or weighted sums (rda) of
v with weights Xbar, but the multiplying effect of eigenvalues removed) or
'u' ((weighted) orthonormal site scores). (By default: |
altexp |
String or integer scalar specifying an alternative experiment containing the input data. |
name |
String specifying the name to be used to store the result in the reducedDims of the output. |
*CCA functions utilize vegan:cca
and *RDA functions vegan:dbRDA
.
By default dbRDA is done with euclidean distances which equals 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 calculateCCA
a matrix with samples as rows and CCA dimensions as
columns. Attributes include calculated cca
/rda
object and
significance analysis results.
For runCCA
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(scater)
data(GlobalPatterns)
GlobalPatterns <- runCCA(GlobalPatterns, data ~ SampleType)
plotReducedDim(GlobalPatterns,"CCA", colour_by = "SampleType")
# Fetch significance results
attr(reducedDim(GlobalPatterns, "CCA"), "significance")
GlobalPatterns <- runRDA(GlobalPatterns, data ~ SampleType)
plotReducedDim(GlobalPatterns,"CCA", colour_by = "SampleType")
# Specify dissimilarity measure
GlobalPatterns <- transformAssay(GlobalPatterns, method = "relabundance")
GlobalPatterns <- runRDA(
GlobalPatterns, data ~ SampleType, assay.type = "relabundance", method = "bray")
# To scale values when using *RDA functions, use transformAssay(MARGIN = "features", ...)
tse <- GlobalPatterns
tse <- transformAssay(tse, MARGIN = "features", method = "z")
# 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, "z") ) ) == 0, ]
# Calculate RDA
tse <- runRDA(tse, formula = data ~ SampleType,
assay.type = "z", name = "rda_scaled", na.action = na.omit)
# Plot
plotReducedDim(tse,"rda_scaled", colour_by = "SampleType")
# A common choice along with PERMANOVA is ANOVA when statistical significance
# of homogeneity of groups is analysed. Moreover, full signficance test results
# can be returned.
tse <- runRDA(tse, data ~ SampleType, homogeneity.test = "anova", full = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.