findImportantPCs {scater} | R Documentation |
Find most important principal components for a given variable
findImportantPCs(object, variable = "total_features", plot_type = "pcs-vs-vars", exprs_values = "logcounts", ntop = 500, feature_set = NULL, scale_features = TRUE, theme_size = 10)
object |
an SCESet object containing expression values and experimental information. Must have been appropriately prepared. |
variable |
character scalar providing a variable name (column from
|
plot_type |
character string, indicating which type of plot to produce.
Default, |
exprs_values |
which slot of the |
ntop |
numeric scalar indicating the number of most variable features to
use for the PCA. Default is |
feature_set |
character, numeric or logical vector indicating a set of
features to use for the PCA. If character, entries must all be in
|
scale_features |
logical, should the expression values be standardised
so that each feature has unit variance? Default is |
theme_size |
numeric scalar providing base font size for ggplot theme. |
Plot the top 5 or 6 most important PCs (depending on the
plot_type
argument for a given variable. Importance here is defined as
the R-squared value from a linear model regressing each PC onto the variable
of interest.
a ggplot
plot object
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) drop_genes <- apply(exprs(example_sce), 1, function(x) {var(x) == 0}) example_sce <- example_sce[!drop_genes, ] example_sce <- calculateQCMetrics(example_sce) findImportantPCs(example_sce, variable="total_features")