7  Normalization

7.1 Introduction

Here we apply normalization methods developed for single-cell RNA-seq data, treating each spot as equivalent to one cell.

7.2 Load previously saved data

We start by loading the previously saved data object(s) (see Section 6.8).

library(SpatialExperiment)
spe <- readRDS("spe_qc.rds")

7.3 Logcounts

Calculate log-transformed normalized counts (abbreviated as “logcounts”) using library size factors.

We apply the methods implemented in the scater (McCarthy et al. 2017) and scran (Lun, McCarthy, and Marioni 2016) packages, which were originally developed for single-cell RNA-seq data, making the assumption here that these methods can be applied to spatial transcriptomics data by treating spots as equivalent to cells.

We use the library size factors methodology since this is the simplest approach, and can easily be applied to spatial transcriptomics data. Alternative approaches that are popular for single-cell RNA-seq data, including normalization by deconvolution, are more difficulty to justify in the context of spot-based spatial transcriptomics data since (i) spots may contain multiple cells from more than one cell type, and (ii) datasets can contain multiple samples (e.g. multiple Visium slides, resulting in sample-specific clustering).

library(scran)

# calculate library size factors
spe <- computeLibraryFactors(spe)

summary(sizeFactors(spe))
##     Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.1321  0.6312  0.9000  1.0000  1.2849  3.7582
hist(sizeFactors(spe), breaks = 20)

# calculate logcounts and store in object
spe <- logNormCounts(spe)

# check
assayNames(spe)
##  [1] "counts"    "logcounts"
dim(counts(spe))
##  [1] 33538  3524
##  [1] 33538  3524

7.4 Save objects for later chapters

We also save the object(s) in .rds format for re-use within later chapters to speed up the build time of the book.

# save object(s)
saveRDS(spe, file = "spe_logcounts.rds")

References

Lun, Aaron T. L., Davis J. McCarthy, and John C. Marioni. 2016. “A Step-by-Step Workflow for Low-Level Analysis of Single-Cell RNA-seq Data with Bioconductor.” F1000Research 5 (2122). https://doi.org/10.12688/f1000research.9501.2.
McCarthy, Davis J., Kieran R. Campbell, Aaron T. L. Lun, and Quin F. Wills. 2017. Scater: Pre-Processing, Quality Control, Normalization and Visualization of Single-Cell RNA-seq Data in R.” Bioinformatics 33 (8): 1179–86. https://doi.org/10.1093/bioinformatics/btw777.
Back to top