plotSignatures: Find enriched markers per identified cluster and visualise...

Description Usage Arguments Details Value Author(s) Examples

View source: R/plotSignatures.R

Description

Find enriched markers per identified cluster and visualise these as a custom corrplot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plotSignatures(
  indata,
  assay = "scaled",
  clusterAssign = metadata(indata)[["Cluster"]],
  funcSummarise = function(x) mean(x, na.rm = TRUE),
  col = colorRampPalette(brewer.pal(9, "RdPu"))(100),
  labCex = 1,
  legendPosition = "right",
  legendCex = 1,
  labDegree = 90,
  verbose = TRUE
)

Arguments

indata

A data-frame or matrix, or SingleCellExperiment object. If a data-frame or matrix, this should relate to expression data (cells as columns; genes as rows). If a SingleCellExperiment object, data will be extracted from an assay component named by assay.

assay

Name of the assay slot in indata from which data will be taken, assuming indata is a SingleCellExperiment object.

clusterAssign

A vector of cell-to-cluster assignments. This can be from any source but must align with your cells / variables. There is no check to ensure this when indata is not a SingleCellExperiment object.

funcSummarise

A mathematical function used to summarise expression per marker, per cluster.

col

colorRampPalette to be used for shading low-to-high expression.

labCex

cex (size) of the main plot labels.

legendPosition

position of legend. Can be one of 'top', 'right', 'bottom', 'left'

legendCex

cex (size) of the legend labels.

labDegree

Rotation angle of the main plot labels.

verbose

Boolean (TRUE / FALSE) to print messages to console or not.

Details

Find enriched markers per identified cluster and visualise these as a custom corrplot. plotSignatures first collapses your input data's expression profiles from the level of cells to the level of clusters based on a mathematical function specified by funcSummarise. It then centers and scales the data range to be between -1 and +1 for visualisation purposes.

Value

A corrplot object.

Author(s)

Kevin Blighe <kevin@clinicalbioinformatics.co.uk>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# create random data that follows a negative binomial
mat <- jitter(matrix(
  MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5),
  ncol = 20))
colnames(mat) <- paste0('CD', 1:ncol(mat))
rownames(mat) <- paste0('cell', 1:nrow(mat))

u <- umap::umap(mat)$layout
colnames(u) <- c('UMAP1','UMAP2')
rownames(u) <- rownames(mat)
clus <- clusKNN(u)

plotSignatures(t(mat), clusterAssign = clus)

kevinblighe/scDataviz documentation built on Sept. 28, 2021, 12:04 p.m.