plotDR | R Documentation |
Dimension reduction plot colored by expression, cluster, sample or group ID.
plotDR(
x,
dr = NULL,
color_by = "condition",
facet_by = NULL,
ncol = NULL,
assay = "exprs",
scale = TRUE,
q = 0.01,
dims = c(1, 2),
k_pal = .cluster_cols,
a_pal = hcl.colors(10, "Viridis")
)
x |
a |
dr |
character string specifying which dimension reduction to use.
Should be one of |
color_by |
character string specifying the color coding;
valid values are |
facet_by |
character string specifying a
non-numeric cell metadata column to facet by;
valid values are |
ncol |
integer scalar specifying number of facet columns; ignored unless coloring by multiple features without facetting or coloring by a single feature with facetting. |
assay |
character string specifying which assay data to use
when coloring by marker(s); valid values are |
scale |
logical specifying whether |
q |
single numeric in [0,0.5) determining the
quantiles to trim when |
dims |
length 2 numeric specifying which dimensions to plot. |
k_pal |
character string specifying the cluster color palette;
ignored when |
a_pal |
character string specifying the |
a ggplot
object.
Helena L Crowell helena.crowell@uzh.ch
Nowicka M, Krieg C, Crowell HL, Weber LM et al. CyTOF workflow: Differential discovery in high-throughput high-dimensional cytometry datasets. F1000Research 2017, 6:748 (doi: 10.12688/f1000research.11622.1)
# construct SCE & run clustering
data(PBMC_fs, PBMC_panel, PBMC_md)
sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
# run clustering & dimension reduction
sce <- cluster(sce)
sce <- runDR(sce, dr = "UMAP", cells = 100)
# color by single marker, split by sample
plotDR(sce, color_by = "CD7", facet_by = "sample_id", ncol = 4)
# color by a set of markers using custom color palette
cdx <- grep("CD", rownames(sce), value = TRUE)
plotDR(sce, color_by = cdx, ncol = 4,
a_pal = rev(hcl.colors(10, "Spectral")))
# color by scaled expression for
# set of markers, split by condition
plotDR(sce,
scale = TRUE,
facet_by = "condition",
color_by = sample(rownames(sce), 4))
# color by 8 metaclusters using custom
# cluster color palette, split by sample
p <- plotDR(sce,
color_by = "meta8",
facet_by = "sample_id",
k_pal = c("lightgrey", "cornflowerblue", "navy"))
p$facet$params$ncol <- 4; p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.