Skip to contents

This function takes a SpatialMap or Region object and plots biomarker expression values in a heatmap.

Usage

plotExpressionHeatmap(
  object,
  data.slot = "NormalizedData",
  summary.fun = "mean",
  summarize.across = ".clusters",
  exclude.markers = NULL,
  subsample = TRUE,
  color.pal = NULL,
  remove = c("na", "inf", "nan"),
  trim = "all",
  cuts = c(0.01, 0.99),
  scaling = "row",
  name = "Marker\nexpression",
  column_title = sprintf("Marker expression by `%s`", summarize.across),
  row_names_gp = grid::gpar(fontsize = 7),
  bottom_pad = 0.2,
  left_pad = 0.2,
  top_pad = 0.2,
  right_pad = 0.5,
  pad_units = "cm",
  ...
)

Arguments

object

A SpatialMap or Region object.

data.slot

Which data slot to use.

summary.fun

How to summarize the cells specified by summarize.across groups. Should be the name of a function given as a string.

summarize.across

Groups to summarize data values across using summary.fun. Can be the name of any column in cellMetadata.

exclude.markers

Specific markers to exclude from the heatmap. If NULL, does nothing.

subsample

Whether or not to subsample cells if there are more than 10,000 cells.

color.pal

A vector of colors.

remove

Character or char vector describing classes to remove, e.g. na, inf, nan

trim

How to trim quantiles - rowwise ("row"), colwise ("col"), or in whole matrix ("all").

cuts

Quantile values to cut. If NULL, trim will not happen.

scaling

Character describing the style of scaling to employ

name

ComplexHeatmap::Heatmap() argument. The legend title -- what is plotted in the heatmap?

column_title

ComplexHeatmap::Heatmap() argument. Title at the top of the heatmap.

row_names_gp

ComplexHeatmap::Heatmap() Graphical parameters to row names. Argument must be a call to grid::gpar().

bottom_pad

Padding to add to bottom of plot. Useful if text is getting cut off.

left_pad

Padding to add to left side of plot. Useful if text is getting cut off.

top_pad

Padding to add to top of plot. Useful if text is getting cut off.

right_pad

Padding to add to right side of plot. Useful if text is getting cut off.

pad_units

What units of measurement should the padding values be interpreted as? See ?grid::unit for a list of allowed values.

...

Additional arguments passed to ComplexHeatmap::Heatmap()

Examples

if (FALSE) {
  sm <- load_sm_data(dataset = "skin")
  # With all features
  plts <- plotExpressionHeatmap(
    sm,
    data.slot = "Data",
    summarize.across = "cell_type"
  )
  print(plts)
  # With excluding features
  exclude_features <- tail(features(sm), n = -3)
  plts_2 <- plotExpressionHeatmap(
    sm,
    data.slot = "Data",
    summarize.across = "cell_type",
    exclude.markers = exclude_features
  )
  print(plts_2)
}
Scroll to top