calcModMoransI: calcModMoransI

Description Usage Arguments Details Value Examples

View source: R/calcModMoransI.R

Description

Calculate modified Moran's I statistic to rank spatially variable genes (SVGs).

Usage

1
2
3
4
5
6
7
8
calcModMoransI(
  spe,
  l_prop = 0.1,
  weights_min = 0.01,
  x_coord = "pxl_row_in_fullres",
  y_coord = "pxl_col_in_fullres",
  verbose = FALSE
)

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.1.

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.

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 x-coordinates. Default = "pxl_col_in_fullres".

verbose

Whether to print messages. Default = FALSE.

Details

Fast implementation of modified Moran's I statistic for ranking spatially variable genes (SVGs).

We modify the definition of Moran's I statistic to make two sparsity-preserving assumptions, due to the sparse nature of spatial transcriptomics data and to speed up runtime.

- We assume that most genes are not detected in most spots (spatial coordinates), and perform calculations using only the values from the non-zero spots. For example, mean expression of each gene (which is used inside the Moran's I formula) is calculated as the mean of the non-zero spots.

- We assume that weights (in the spatial covariance matrix) below some threshold (e.g. below 1

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.