Description Usage Arguments Value Author(s) Examples
View source: R/plotDiffHeatmap.R
Heatmaps summarizing differental abundance & differential state testing results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | plotDiffHeatmap(
x,
y,
k = NULL,
top_n = 20,
fdr = 0.05,
lfc = 1,
all = FALSE,
sort_by = c("padj", "lfc", "none"),
y_cols = list(padj = "p_adj", lfc = "logFC", target = "marker_id"),
assay = "exprs",
fun = c("median", "mean", "sum"),
normalize = TRUE,
col_anno = TRUE,
row_anno = TRUE,
hm_pal = NULL,
fdr_pal = c("lightgrey", "lightgreen"),
lfc_pal = c("blue3", "white", "red3")
)
|
x |
a |
y |
a |
k |
character string specifying
the clustering in |
top_n |
numeric. Number of top clusters (if |
fdr |
numeric threshold on adjusted p-values below which results should be retained and considered to be significant. |
lfc |
numeric threshold on logFCs above which to retain results. |
all |
logical specifying whether all |
sort_by |
character string specifying the |
y_cols |
named list specifying columns in |
assay |
character string specifying which assay
data to use; valid values are |
fun |
character string specifying the function to use
as summary statistic for aggregation of |
normalize |
logical specifying whether Z-score normalized values
should be plotted. If |
col_anno |
logical specifying whether to include column annotations
for all non-numeric cell metadata variables; or a character vector
in |
row_anno |
logical specifying whether to include a row annotation indicating whether cluster (DA) or cluster-marker combinations (DS) are significant, labeled with adjusted p-values, as well as logFCs. |
hm_pal |
character vector of colors
to interpolate for the heatmap. Defaults to |
fdr_pal, lfc_pal |
character vector of colors to use for row annotations
|
a Heatmap-class
object.
Lukas M Weber & Helena L Crowell helena.crowell@uzh.ch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # construct SCE & run clustering
data(PBMC_fs, PBMC_panel, PBMC_md)
sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
sce <- cluster(sce)
## differential analysis
library(diffcyt)
# create design & constrast matrix
design <- createDesignMatrix(PBMC_md, cols_design=3:4)
contrast <- createContrast(c(0, 1, 0, 0, 0))
# test for
# - differential abundance (DA) of clusters
# - differential states (DS) within clusters
da <- diffcyt(sce, design = design, contrast = contrast,
analysis_type = "DA", method_DA = "diffcyt-DA-edgeR",
clustering_to_use = "meta20")
ds <- diffcyt(sce, design = design, contrast = contrast,
analysis_type = "DS", method_DS = "diffcyt-DS-limma",
clustering_to_use = "meta20")
# extract result tables
da <- rowData(da$res)
ds <- rowData(ds$res)
# display test results for
# - top DA clusters
# - top DS cluster-marker combinations
plotDiffHeatmap(sce, da)
plotDiffHeatmap(sce, ds)
# visualize results for subset of clusters
sub <- filterSCE(sce, cluster_id %in% seq_len(5), k = "meta20")
plotDiffHeatmap(sub, da, all = TRUE, sort_by = "none")
# visualize results for selected feature
# & include only selected annotation
plotDiffHeatmap(sce["pp38", ], ds, col_anno = "condition", all = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.