getExplanatoryPCs {scater} | R Documentation |
Estimate the percentage of variance explained for each gene.
getExplanatoryPCs(object, variables = NULL, use_dimred = "PCA", chunk = 1000, ...)
object |
A SingleCellExperiment object containing expression values and per-cell experimental information. |
variables |
Character vector specifying the explanatory factors in |
use_dimred |
String specifying the field in |
chunk |
Argument passed to |
... |
Arguments passed to |
This function computes the percentage of variance in PC scores that is explained by variables in the sample-level metadata. It allows identification of important PCs that are driven by known experimental conditions, e.g., treatment, disease. PCs correlated with echnical factors (e.g., batch effects, library size) can also be detected and removed prior to further analysis.
The function will attempt to extract existing PCA results in object
via the use_dimred
argument.
If these are not available, it will rerun the PCA using runPCA
.
A matrix containing the percentage of variance explained by each factor (column) and for each PC (row).
Aaron Lun
plotExplanatoryPCs
,
getVarianceExplained
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 <- getExplanatoryPCs(example_sce)