Skip to contents

Computes a correlation matrix across selected result columns and visualizes it with corrplot, including adjusted p-values.

Usage

spatialcorr(
  spe,
  method,
  adjust = "fdr",
  variables = NULL,
  sig.level = 0.05,
  type = "lower",
  diag = FALSE,
  order = "original",
  plot_layout = "color",
  insig = "label_sig",
  addCoef.col = NULL,
  ...
)

Arguments

spe

SpatialExperiment.

method

Method prefix to select result columns (e.g., a deconvolution token or decoupleR output such as "cell2location").

adjust

Method to adjust p-values for multiple testing (see stats::p.adjust.methods).

variables

Optional vector of column names to use instead of method.

sig.level

Significance level(s) for marking correlations.

type

Character, 'full' 'upper' or 'lower' (default), display full matrix, lower triangular or upper triangular matrix.

diag

Logical, whether display the correlation coefficients on the principal diagonal. default is FALSE

order

Character, the ordering method of the correlation matrix.'original' for original order (default),'AOE' for the angular order of the eigenvectors, 'FPC' for the first principal component order, 'hclust' for the hierarchical clustering order,'alphabet' for alphabetical order.

plot_layout

Corrplot layout: "circle", "square", "ellipse", "number", "shade", "color", or "pie".

insig

If 'blank', wipe away the corresponding glyphs; if 'p-value', add p-values the corresponding glyphs; if 'pch', add characters (see pch for details) on corresponding glyphs; if 'n', don't take any measures; if 'label_sig' (default), mark significant correlations with pch (see sig.level).

addCoef.col

to add labels to the plot showing the correlation values, default is NULL, the user can choose any other color to add and color the values.

...

Additional parameters passed to corrplot().