This function will first reads the result saved in metadata slot, named by "findMarker" and generated by findMarkerDiffExp. Then it do the filtering on the statistics based on the input parameters and get unique genes to plot. We choose the genes that are identified as up-regulated only. As for the genes identified as up-regulated for multiple clusters, we only keep the belonging towards the one they have the highest Log2FC value. In the heatmap, there will always be a cell annotation for the cluster labeling used when finding the markers, and a feature annotation for which cluster each gene belongs to. And by default we split the heatmap by these two annotations. Additional legends can be added and the splitting can be canceled.

This function will first reads the result saved in metadata slot, named by "findMarker" and generated by findMarkerDiffExp. Then it do the filtering on the statistics based on the input parameters and get unique genes to plot. We choose the genes that are identified as up-regulated only. As for the genes identified as up-regulated for multiple clusters, we only keep the belonging towards the one they have the highest Log2FC value. In the heatmap, there will always be a cell annotation for the cluster labeling used when finding the markers, and a feature annotation for which cluster each gene belongs to. And by default we split the heatmap by these two annotations. Additional legends can be added and the splitting can be canceled.

plotMarkerDiffExp(
  inSCE,
  orderBy = "size",
  log2fcThreshold = 1,
  fdrThreshold = 0.05,
  minClustExprPerc = 0.7,
  maxCtrlExprPerc = 0.4,
  minMeanExpr = 1,
  topN = 10,
  decreasing = TRUE,
  rowDataName = NULL,
  colDataName = NULL,
  featureAnnotations = NULL,
  cellAnnotations = NULL,
  featureAnnotationColor = NULL,
  cellAnnotationColor = NULL,
  colSplitBy = ifelse(is.null(orderBy), NULL, colnames(inSCE@metadata$findMarker)[5]),
  rowSplitBy = "marker",
  rowDend = FALSE,
  colDend = FALSE,
  title = "Top Marker Heatmap",
  ...
)

plotMarkerDiffExp(
  inSCE,
  orderBy = "size",
  log2fcThreshold = 1,
  fdrThreshold = 0.05,
  minClustExprPerc = 0.7,
  maxCtrlExprPerc = 0.4,
  minMeanExpr = 1,
  topN = 10,
  decreasing = TRUE,
  rowDataName = NULL,
  colDataName = NULL,
  featureAnnotations = NULL,
  cellAnnotations = NULL,
  featureAnnotationColor = NULL,
  cellAnnotationColor = NULL,
  colSplitBy = ifelse(is.null(orderBy), NULL, colnames(inSCE@metadata$findMarker)[5]),
  rowSplitBy = "marker",
  rowDend = FALSE,
  colDend = FALSE,
  title = "Top Marker Heatmap",
  ...
)

Arguments

inSCE

SingleCellExperiment inherited object.

orderBy

The ordering method of the clusters on the splitted heatmap. Can be chosen from "size" or "name", specified with vector of ordered unique cluster labels, or set as NULL for unsplitted heatmap. Default "size".

log2fcThreshold

Only use DEGs with the absolute values of log2FC larger than this value. Default 1

fdrThreshold

Only use DEGs with FDR value smaller than this value. Default 0.05

minClustExprPerc

A numeric scalar. The minimum cutoff of the percentage of cells in the cluster of interests that expressed the marker gene. Default 0.7.

maxCtrlExprPerc

A numeric scalar. The maximum cutoff of the percentage of cells out of the cluster (control group) that expressed the marker gene. Default 0.4.

minMeanExpr

A numeric scalar. The minimum cutoff of the mean expression value of the marker in the cluster of interests. Default 1.

topN

An integer. Only to plot this number of top markers for each cluster in maximum, in terms of log2FC value. Use NULL to cancel the top N subscription. Default 10.

decreasing

Order the cluster decreasingly. Default TRUE.

rowDataName

character. The column name(s) in rowData that need to be added to the annotation. Default NULL.

colDataName

character. The column name(s) in colData that need to be added to the annotation. Default NULL.

featureAnnotations

data.frame, with rownames containing all the features going to be plotted. Character columns should be factors. Default NULL.

cellAnnotations

data.frame, with rownames containing all the cells going to be plotted. Character columns should be factors. Default NULL.

featureAnnotationColor

A named list. Customized color settings for feature labeling. Should match the entries in the featureAnnotations or rowDataName. For each entry, there should be a list/vector of colors named with categories. Default NULL.

cellAnnotationColor

A named list. Customized color settings for cell labeling. Should match the entries in the cellAnnotations or colDataName. For each entry, there should be a list/vector of colors named with categories. Default NULL.

colSplitBy

character vector. Do semi-heatmap based on the grouping of this(these) annotation(s). Should exist in either colDataName or names(cellAnnotations). Default is the value of cluster in findMarkerDiffExp when orderBy is not NULL, or NULL otherwise.

rowSplitBy

character vector. Do semi-heatmap based on the grouping of this(these) annotation(s). Should exist in either rowDataName or names(featureAnnotations). Default "marker", which indicates an auto generated annotation for this plot.

rowDend

Whether to display row dendrogram. Default FALSE.

colDend

Whether to display column dendrogram. Default FALSE.

title

Text of the title, at the top of the heatmap. Default "Top Marker Heatmap".

...

Other arguments passed to plotSCEHeatmap.

Value

A Heatmap object A Heatmap object

Author

Yichen Wang

Yichen Wang

Examples

data("sceBatches")
logcounts(sceBatches) <- log(counts(sceBatches) + 1)
sce.w <- subsetSCECols(sceBatches, colData = "batch == 'w'")
sce.w <- findMarkerDiffExp(sce.w, method = "wilcox", cluster = "cell_type")
#> Running with wilcox
#> Computing for cluster: beta
#> Computing for cluster: alpha
plotMarkerDiffExp(sce.w)

data("sceBatches")
logcounts(sceBatches) <- log(counts(sceBatches) + 1)
sce.w <- subsetSCECols(sceBatches, colData = "batch == 'w'")
sce.w <- findMarkerDiffExp(sce.w, method = "wilcox", cluster = "cell_type")
#> Running with wilcox
#> Computing for cluster: beta
#> Computing for cluster: alpha
plotMarkerDiffExp(sce.w)