SpaNormSVG

Model-based spatially variable gene (SVG) calling

Description

Spatially variable gene (SVG) calling using the SpaNorm model.

Usage

SpaNormSVG(spe, backend = c("auto", "cpu", "gpu"), verbose = TRUE)

## S4 method for signature 'SpatialExperiment'
SpaNormSVG(spe, backend = c("auto", "cpu", "gpu"), verbose = TRUE)

## S4 method for signature 'Seurat'
SpaNormSVG(spe, backend = c("auto", "cpu", "gpu"), verbose = TRUE)

Arguments

spe a SpatialExperiment or Seurat object, with the count data stored in ‘counts’ or ‘data’ assays respectively, and a SpaNorm model fit.
backend a character, specifying the backend to use for computations. Options are "auto" (default), "cpu", or "gpu". If "auto", it will use GPU if available, otherwise CPU.
verbose a logical, specifying whether to show update messages (default TRUE).

Details

SpaNorm SVG calling works by using the SpaNorm model fit for data normalisation to perform a likelihood ratio test (LRT). The model used for normalisation is considered to be the full model. A second nested model is fit without the splines representing biology. These nested models are then compared using a LRT to identify genes where the splines representing biology contain strong signal.

Value

a SpatialExperiment or Seurat object with F-statistics, false discovery rates (FDRs). For SpatialExperiment objects, these are stored in the rowData.

Examples

Note

The code below runs when the site is built, on a small pre-fitted subset of HumanDLPFC (301 genes x 4015 spots; SpaNorm(sample.p = 0.05, df.tps = 2), SpaNormSVG() and SpaNormPCA() already applied) that is fitted once per build. The outputs are those of the code shown.

library("SpaNorm")


library(SpatialExperiment)
library(ggplot2)

data(HumanDLPFC)

HumanDLPFC = SpaNorm(HumanDLPFC, sample.p = 0.05, df.tps = 2, tol = 1e-2)
(1/2) Retrieve precomputed SpaNorm model
(2/2) Normalising data
HumanDLPFC = SpaNormSVG(HumanDLPFC)
(1/3) Retrieving SpaNorm model
(2/3) Retrieving Null SpaNorm model
(3/3) Finding SVGs
102 SVGs found (FDR < 0.05)
head(rowData(HumanDLPFC))
DataFrame with 6 rows and 5 columns
                  gene_name   gene_biotype     svg.F       svg.p     svg.fdr
                <character>    <character> <numeric>   <numeric>   <numeric>
ENSG00000116251       RPL22 protein_coding    0.0000 1.00000e+00 1.00000e+00
ENSG00000074800        ENO1 protein_coding    0.0000 1.00000e+00 1.00000e+00
ENSG00000171603      CLSTN1 protein_coding    0.0000 1.00000e+00 1.00000e+00
ENSG00000162545     CAMK2N1 protein_coding   79.9690 2.21491e-65 4.44459e-64
ENSG00000142676       RPL11 protein_coding   13.1719 1.16127e-10 6.72198e-10
ENSG00000117632       STMN1 protein_coding   12.3297 5.75533e-10 3.20806e-09