runCCA {mia} | R Documentation

## Canonical Correspondance Analysis

### Description

These functions perform Canonical Correspondance Analysis on data stored in a `SummarizedExperiment`.

### Usage

    calculateCCA(x, ...)

    runCCA(x, ...)

    calculateRDA(x, ...)

    runRDA(x, ...)

    ## S4 method for signature 'ANY'
    calculateCCA(x, formula, variables, scale = TRUE)

    ## S4 method for signature 'SummarizedExperiment'
    calculateCCA(
      x,
      formula,
      ...,
      abund_values = exprs_values,
      exprs_values = "counts"
    )

    ## S4 method for signature 'SingleCellExperiment'
    runCCA(x, ..., altexp = NULL, name = "CCA")

    ## S4 method for signature 'ANY'
    calculateRDA(x, formula, variables, scale = TRUE)

    ## S4 method for signature 'SummarizedExperiment'
    calculateRDA(
      x,
      formula,
      ...,
      abund_values = exprs_values,
      exprs_values = "counts"
    )

    ## S4 method for signature 'SingleCellExperiment'
    runRDA(x, ..., altexp = NULL, name = "RDA")

### Arguments

`x` | For `calculateCCA` a numeric matrix with columns as samples or a `SummarizedExperiment`. For `runCCA` a `SingleCellExperiment` or a derived object.
`...` | additional arguments not used.
`formula` | If `x` is a `SummarizedExperiment` a formula can be supplied. Based on the right-hand side of the given formula `colData` is subset to `variables`.
`variables` | a `data.frame` or an object coercible to one containing the variables to use. Can be missing, which turns the CCA analysis into a CA analysis. All variables are used. Please subset, if you want to consider only some of them.
`scale` | Logical scalar, should the expression values be standardized?
`abund_values` | a single `character` value for specifying which assay to use for calculation.
`exprs_values` | a single `character` value for specifying which assay to use for calculation. (Please use `abund_values` instead. At some point `exprs_values` will be disabled.)
`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.

### Value

For `calculateCCA` a matrix with samples as rows and CCA dimensions as columns

For `runCCA` a modified `x` with the results stored in `reducedDim` as the given `name`

### See Also

For more details on the actual implementation see `cca` and `rda`

### Examples

    library(scater)
    data(GlobalPatterns)
    GlobalPatterns <- runCCA(GlobalPatterns, data ~ SampleType)
    plotReducedDim(GlobalPatterns,"CCA", colour_by = "SampleType")

    GlobalPatterns <- runRDA(GlobalPatterns, data ~ SampleType)
    plotReducedDim(GlobalPatterns,"CCA", colour_by = "SampleType")

[Package mia version 1.2.7 Index]