plotBatchVariance: Plot the percent of the variation that is explained by batch...

Description Usage Arguments Details Value Examples

View source: R/plotBatchVariance.R

Description

Visualize the percent variation in the data that is explained by batch and condition, individually, and that explained by combining both annotations. Plotting only the variation explained by batch is supported but not recommended, because this can be confounded by potential condition.

Usage

1
2
3
4
5
6
7
8
9
plotBatchVariance(
  inSCE,
  useAssay = NULL,
  useReddim = NULL,
  useAltExp = NULL,
  batch = "batch",
  condition = NULL,
  title = NULL
)

Arguments

inSCE

SingleCellExperiment inherited object.

useAssay

A single character. The name of the assay that stores the value to plot. For useReddim and useAltExp also. Default NULL.

useReddim

A single character. The name of the dimension reduced matrix that stores the value to plot. Default NULL.

useAltExp

A single character. The name of the alternative experiment that stores an assay of the value to plot. Default NULL.

batch

A single character. The name of batch annotation column in colData(inSCE). Default "batch".

condition

A single character. The name of an additional condition annotation column in colData(inSCE). Default NULL.

title

A single character. The title text on the top. Default NULL.

Details

When condition and batch both are causing some variation, if the difference between full variation and condition variation is close to batch variation, this might imply that batches are causing some effect; if the difference is much less than batch variation, then the batches are likely to be confounded by the conditions.

Value

A ggplot object of a boxplot of variation explained by batch, condition, and batch+condition.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
  if(requireNamespace("bladderbatch", quietly = TRUE)) {
    library(bladderbatch)
    data(bladderdata)
    dat <- as(as(bladderEset, "SummarizedExperiment"),
              "SingleCellExperiment")
    plotBatchVariance(dat,
                      useAssay="exprs",
                      batch="batch",
                      condition = "cancer")
  }

## End(Not run)

singleCellTK documentation built on Nov. 8, 2020, 5:21 p.m.