getVarianceExplained {scater} | R Documentation |
Estimate the percentage of variance explained for each gene.
getVarianceExplained(object, exprs_values = "logcounts", variables = NULL, chunk = 1000)
object |
A SingleCellExperiment object containing expression values and per-cell experimental information. |
exprs_values |
String specifying the expression values for which to compute the variance. |
variables |
Character vector specifying the explanatory factors in |
chunk |
Integer scalar specifying the chunk size for chunk-wise processing. Only affects the speed/memory usage trade-off. |
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 matrix containing the percentage of variance explained by each factor (column) and for each gene (row).
Aaron Lun
data("sc_example_counts") data("sc_example_cell_info") example_sce <- SingleCellExperiment( assays = list(counts = sc_example_counts), colData = sc_example_cell_info) example_sce <- normalize(example_sce) r2mat <- getVarianceExplained(example_sce)