calcSpatialAutoCov: calcSpatialAutoCov

Description Usage Arguments Details Value Examples

View source: R/calcSpatialAutoCov.R

Description

Calculate spatial autocovariance

Usage

1
2
3
4
5
6
7
8
9
calcSpatialAutoCov(
  spe,
  l_prop = 0.1,
  weights_min = 0.01,
  x_coord = "pxl_row_in_fullres",
  y_coord = "pxl_col_in_fullres",
  max_cores = 4,
  verbose = TRUE
)

Arguments

spe

Input object (SpatialExperiment). Assumed to contain an assay named "logcounts" containing log-transformed normalized counts in sparse matrix format, and "spatialCoords" slot containing spatial coordinates.

l_prop

Value to set characteristic length parameter in squared exponential kernel used to calculate weights matrix. The characteristic length parameter is set to "l_prop" times the maximum range of the x or y coordinates. Default = 0.2.

weights_min

Minimum weights threshold. Weights (in the spatial covariance matrix) that are below "weights_min" times the maximum weights value are assumed to be zero. Default = 0.05.

x_coord

Name of column in spatialCoords slot containing x-coordinates. Default = "pxl_row_in_fullres".

y_coord

Name of column in spatialCoords slot containing y-coordinates. Default = "pxl_col_in_fullres".

max_cores

Maximum number of cores to use for parallelized evaluation. Default = 4.

verbose

Whether to print messages. Default = TRUE.

Details

Calculate spatial autocovariance for each gene, for use in ranking spatially variable genes (SVGs), either directly or as part of the formula for Moran's I statistic.

This is a fast implementation that makes use of sparsity and vectorized calculations. Sparsity is due to both (i) spots with zero expression and (ii) weights below a minimum threshold. This greatly speeds up runtime compared to simpler implementations of Moran's I statistic.

Value

Returns a list containing output values (one value per gene).

Examples

1
paste0("to do")

lmweber/spatzli documentation built on Feb. 2, 2022, 1:09 p.m.