SpatialExperiment Input data, assumed to be a
SpatialExperiment object containing an assay named
counts containing unique molecular identifier (UMI) counts, and
spatial coordinates stored in the spatialCoords slot.
in_tissue
logical Whether to keep only spots over tissue,
identified by column in_tissue in colData. Default = TRUE.
filter_genes
integer Whether to filter low-expressed genes. If
a value is provided, genes with at least 1 unique molecular identifier
(UMI) count in at least this percentage of spatial coordinates will be
kept. Assumes spe contains an assay named counts containing
UMI counts. Default = 5, i.e. keep genes with at least 1 UMI in 5
spatial coordinates. Set to NULL to disable.
filter_mito
logical Whether to filter mitochondrial genes.
Assumes the rowData slot of spe contains a column named
gene_name, which can be used to identify mitochondrial genes.
Default = TRUE. Set to FALSE to disable.
residuals
logical Whether to calculate deviance residuals from
an approximate multinomial model using the scry package for input to
BRISC. Default = TRUE.
logcounts
logical Whether to calculate log-transformed
normalized counts (logcounts) using the scran package. Default =
TRUE.
deconv
logical Whether to use deconvolution method to calculate
logcounts (see ?scran::computeSumFactors). If FALSE, library
size normalization will be used instead. Default = TRUE.
Details
Convenience function to run several preprocessing steps to prepare input data
object for nnSVG. This function is designed for data from the 10x Genomics
Visium platform, and is used for examples in the nnSVG package.
In general, the code in this function will need to be adapted for a given
dataset, so we recommend running the steps individually instead of using this
function. The steps are described in more detail in our online book
"Orchestrating Spatially Resolved Transcriptomics Analysis with Bioconductor
(OSTA)".
Value
Returns a SpatialExperiment object that can be provided to
nnSVG.
Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
library(SpatialExperiment)library(STexampleData)spe<-Visium_humanDLPFC()# subset genes for faster runtime in this exampleset.seed(123)spe<-spe[sample(seq_len(1000)),]# set seed for reproducibilityset.seed(123)spe<-preprocessSVG(spe)spe