Skip to contents

Function to plot pairwise adjacency from a SpatialMap object. Creates a list of heatmaps showing the value of the specified interaction metric for each pair of cell types in each region or sample.

Usage

plotPairwiseAdjacency(
  object,
  nn,
  feature,
  what = c("log2.enrichment", "p.value", "p.value.enrichment", "p.value.depletion",
    "p.adj", "padj.enrichment", "padj.depletion", "log10.padj", "log10.padj.enrichment",
    "log10.padj.depletion"),
  remove = c("na", "inf", "nan"),
  trim = "all",
  cuts = NULL,
  scaling = "none",
  bottom_pad = 0.2,
  left_pad = 0.2,
  top_pad = 0.2,
  right_pad = 1.5,
  pad_units = "cm",
  analyze = "regions",
  ...
)

Arguments

object

A SpatialMap object

nn

The name of a nearestNeighborGraph from object (character).

feature

The name of a cellMetadata column (character).

what

What exactly to plot. The options are given in the default character vector

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

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.

analyze

What to analyze (and how). The options are "regions", NULL (activeAnalysis), the name of a currently existing formal analysis, or the name of a column in object's projectMetadata (an "informal" analysis).

...

Arguments passed to ComplexHeatmap::Heatmap

Value

A named list of ComplexHeatmap objects. If analyze = "regions", then one plot will be returned for each region, and list items will be named by Region IDs. If you're performing sample-level aggregation analysis, then one plot will be returned for each group in the analysis specified (usually one per sample), and list items will be named by groups in the analysis.

Details

See vignette("AnalysisGuide5_Cell_interactions") for a representative workflow that uses this function.

For the what parameter, the following values calculated by pairwiseAdjacency can be used:

  • "log2.enrichment"

  • "p.value"

  • "p.value.enrichment"

  • "p.value.depletion"

  • "p.adj"

  • "padj.enrichment"

  • "padj.depletion"

  • "log10.padj"

  • "log10.padj.enrichment"

  • "log10.padj.depletion"

Note

If sample-level aggregation analysis was performed with pairwiseAdjacency, you must specify the same analyze parameter to plotPairwiseAdjacency.

Scroll to top