Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/getExplanatoryPCs.R
Compute, for each principal component, the percentage of variance that is explained by one or more variables of interest.
1 | getExplanatoryPCs(x, dimred = "PCA", n_dimred = 10, ...)
|
x |
A SingleCellExperiment object containing dimensionality reduction results. |
dimred |
String or integer scalar specifying the field in |
n_dimred |
Integer scalar specifying the number of the top principal components to use. |
... |
Additional 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 technical factors (e.g., batch effects, library size) can also be detected and removed prior to further analysis.
By default, the function will attempt to use pre-computed PCA results in object
.
This is done by taking the top n_dimred
PCs from the matrix specified by dimred
.
If these are not available or if rerun=TRUE
, the function will rerun the PCA using runPCA
;
however, this mode is deprecated and users are advised to explicitly call runPCA
themselves.
A matrix containing the percentage of variance explained by each factor (column) and for each PC (row).
Aaron Lun
plotExplanatoryPCs
, to plot the results.
getVarianceExplained
, to compute the variance explained.
1 2 3 4 5 | example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce <- runPCA(example_sce)
r2mat <- getExplanatoryPCs(example_sce)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.