Reduced dimension plots {scater} | R Documentation |
Wrapper functions to create plots for specific types of reduced dimension results in a SingleCellExperiment object.
plotPCASCE(object, ..., rerun = FALSE, ncomponents = 2, run_args = list()) plotTSNE(object, ..., rerun = FALSE, ncomponents = 2, run_args = list()) plotUMAP(object, ..., rerun = FALSE, ncomponents = 2, run_args = list()) plotDiffusionMap(object, ..., rerun = FALSE, ncomponents = 2, run_args = list()) plotMDS(object, ..., rerun = FALSE, ncomponents = 2, run_args = list()) ## S4 method for signature 'SingleCellExperiment' plotPCA(object, ..., rerun = FALSE, ncomponents = 2, run_args = list())
object |
A SingleCellExperiment object. |
... |
Additional arguments to pass to |
rerun |
Logical, should the reduced dimensions be recomputed even if |
ncomponents |
Numeric scalar indicating the number of dimensions components to (calculate and) plot.
This can also be a numeric vector, see |
run_args |
Each function is a convenient wrapper around plotReducedDim
that searches the reducedDims
slot for an appropriately named dimensionality reduction result:
"PCA"
for plotPCA
"TSNE"
for plotTSNE
"DiffusionMap"
for plotDiffusionMap
"MDS"
for "plotMDS"
"UMAP"
for "plotUMAP"
Its only purpose is to streamline workflows to avoid the need to specify the dimred
argument.
Previous versions of these functions would recompute the dimensionality reduction results if they were not already present.
This has been deprecated in favour of users explicitly calling the relevant run*
function,
to avoid uncertainties about what was actually being plotted.
A ggplot object.
Davis McCarthy, with modifications by Aaron Lun
runPCA
,
runDiffusionMap
,
runTSNE
,
runMDS
,
and runUMAP
,
for the functions that actually perform the calculations.
plotReducedDim
, for the underlying plotting function.
example_sce <- mockSCE() example_sce <- logNormCounts(example_sce) example_sce <- runPCA(example_sce) ## Examples plotting PC1 and PC2 plotPCA(example_sce) plotPCA(example_sce, colour_by = "Cell_Cycle") plotPCA(example_sce, colour_by = "Cell_Cycle", shape_by = "Treatment") plotPCA(example_sce, colour_by = "Cell_Cycle", shape_by = "Treatment", size_by = "Mutation_Status") ## Force legend to appear for shape: example_subset <- example_sce[, example_sce$Treatment == "treat1"] plotPCA(example_subset, colour_by = "Cell_Cycle", shape_by = "Treatment", by_show_single = TRUE) ## Examples plotting more than 2 PCs plotPCA(example_sce, ncomponents = 4, colour_by = "Treatment", shape_by = "Mutation_Status") ## Same for TSNE: example_sce <- runTSNE(example_sce) plotTSNE(example_sce, run_args=list(perplexity = 10)) ## Same for DiffusionMaps: example_sce <- runDiffusionMap(example_sce) plotDiffusionMap(example_sce) ## Same for MDS plots: example_sce <- runMDS(example_sce) plotMDS(example_sce)