plotSCEHeatmap: Plot heatmap of using data stored in SingleCellExperiment...

View source: R/plotSCEHeatmap.R

plotSCEHeatmapR Documentation

Plot heatmap of using data stored in SingleCellExperiment Object

Description

Plot heatmap of using data stored in SingleCellExperiment Object

Usage

plotSCEHeatmap(
  inSCE,
  useAssay = "logcounts",
  useReducedDim = NULL,
  doLog = FALSE,
  featureIndex = NULL,
  cellIndex = NULL,
  scale = TRUE,
  trim = c(-2, 2),
  featureIndexBy = "rownames",
  cellIndexBy = "rownames",
  rowDataName = NULL,
  colDataName = NULL,
  aggregateRow = NULL,
  aggregateCol = NULL,
  featureAnnotations = NULL,
  cellAnnotations = NULL,
  featureAnnotationColor = NULL,
  cellAnnotationColor = NULL,
  palette = c("ggplot", "celda", "random"),
  heatmapPalette = c("sequential", "diverging"),
  addCellSummary = NULL,
  rowSplitBy = NULL,
  colSplitBy = NULL,
  rowLabel = FALSE,
  colLabel = FALSE,
  rowLabelSize = 6,
  colLabelSize = 6,
  rowDend = TRUE,
  colDend = TRUE,
  title = NULL,
  rowTitle = "Features",
  colTitle = "Cells",
  rowGap = grid::unit(0, "mm"),
  colGap = grid::unit(0, "mm"),
  border = FALSE,
  colorScheme = NULL,
  ...
)

Arguments

inSCE

SingleCellExperiment inherited object.

useAssay

character. A string indicating the assay name that provides the expression level to plot. Only for plotSCEHeatmap.

useReducedDim

character. A string indicating the reducedDim name that provides the expression level to plot. Only for plotSCEDimReduceHeatmap.

doLog

Logical scalar. Whether to do log(assay + 1) transformation on the assay indicated by useAssay. Default FALSE.

featureIndex

A vector that can subset the input SCE object by rows (features). Alternatively, it can be a vector identifying features in another feature list indicated by featureIndexBy. Default NULL.

cellIndex

A vector that can subset the input SCE object by columns (cells). Alternatively, it can be a vector identifying cells in another cell list indicated by featureIndexBy. Default NULL.

scale

Whether to perform z-score scaling on each row. Default TRUE.

trim

A 2-element numeric vector. Values outside of this range will be trimmed to their nearst bound. Default c(-2, 2)

featureIndexBy

A single character specifying a column name of rowData(inSCE), or a vector of the same length as nrow(inSCE), where we search for the non-rowname feature indices. Not applicable for plotSCEDimReduceHeatmap. Default "rownames".

cellIndexBy

A single character specifying a column name of colData(inSCE), or a vector of the same length as ncol(inSCE), where we search for the non-rowname cell indices. Default "rownames".

rowDataName

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

colDataName

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

aggregateRow

Feature variable for aggregating the heatmap by row. Can be a vector or a rowData column name for feature variable. Multiple variables are allowed. Default NULL.

aggregateCol

Cell variable for aggregating the heatmap by column. Can be a vector or a colData column name for cell variable. Multiple variables are allowed. 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.

palette

Choose from "ggplot", "celda" or "random" to generate unique category colors.

heatmapPalette

Choose from "sequential", "diverging" or supply custom palette with colorScheme to generate unique category colors. Default is "sequential"

addCellSummary

Add summary barplots to column annotation. Supply the name of the column in colData as a character. This option will add summary for categorical variables as stacked barplots.

rowSplitBy

character. Do semi-heatmap based on the grouping of this(these) annotation(s). Should exist in either rowDataName or names(featureAnnotations). Default NULL.

colSplitBy

character. Do semi-heatmap based on the grouping of this(these) annotation(s). Should exist in either colDataName or names(cellAnnotations). Default NULL.

rowLabel

Use a logical for whether to display all the feature names, a single character to display a column of rowData(inSCE) annotation, a vector of the same length as full/subset nrow(inSCE) to display customized info. Default FALSE.

colLabel

Use a logical for whether to display all the cell names, a single character to display a column of colData(inSCE) annotation, a vector of the same length as full/subset ncol(inSCE) to display customized info. Default FALSE.

rowLabelSize

A number for the font size of feature names. Default 8

colLabelSize

A number for the font size of cell names. Default 8

rowDend

Whether to display row dendrogram. Default TRUE.

colDend

Whether to display column dendrogram. Default TRUE.

title

The main title of the whole plot. Default NULL.

rowTitle

The subtitle for the rows. Default "Genes".

colTitle

The subtitle for the columns. Default "Cells".

rowGap

A numeric value or a unit object. For the gap size between rows of the splitted heatmap. Default grid::unit(0, 'mm').

colGap

A numeric value or a unit object. For the gap size between columns of the splitted heatmap. Default grid::unit(0, 'mm').

border

A logical scalar. Whether to show the border of the heatmap or splitted heatmaps. Default TRUE.

colorScheme

function. A function that generates color code by giving a value. Can be generated by colorRamp2. Default NULL.

...

Other arguments passed to Heatmap.

Value

A ggplot object.

Author(s)

Yichen Wang

Examples

data(scExample, package = "singleCellTK")
plotSCEHeatmap(sce[1:3,1:3], useAssay = "counts")

compbiomed/singleCellTK documentation built on Oct. 27, 2024, 3:26 a.m.