getVarianceExplained | R Documentation |
Compute, for each gene, the percentage of variance that is explained by one or more variables of interest.
getVarianceExplained(x, ...)
## S4 method for signature 'ANY'
getVarianceExplained(x, variables, subset_row = NULL, BPPARAM = SerialParam())
## S4 method for signature 'SummarizedExperiment'
getVarianceExplained(
x,
variables = NULL,
...,
exprs_values = "logcounts",
assay.type = exprs_values
)
x |
A numeric matrix of expression values, usually log-transformed and normalized. Alternatively, a SummarizedExperiment containing such a matrix. |
... |
For the generic, arguments to be passed to specific methods. For the SummarizedExperiment method, arguments to be passed to the ANY method. |
variables |
A DataFrame or data.frame containing one or more variables of interest.
This should have number of rows equal to the number of columns in For the SummarizedExperiment method, this can also be a character vector specifying column names of |
subset_row |
A vector specifying the subset of rows of |
BPPARAM |
A BiocParallelParam object specifying whether the calculations should be parallelized. |
exprs_values |
Alias for |
assay.type |
String or integer scalar specifying the expression values for which to compute the variance (also an alias |
This function computes the percentage of variance in gene expression that is explained by variables in the sample-level metadata. It allows problematic factors to be quickly identified, as well as the genes that are most affected.
A numeric matrix containing the percentage of variance explained by each factor (column) and for each gene (row).
Aaron Lun
getExplanatoryPCs
, which calls this function.
plotExplanatoryVariables
, to plot the results.
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
r2mat <- getVarianceExplained(example_sce)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.