This function can be used to spatially visualise the library size, biology or batch specific effect modelled for each gene.
Usage
plotCovariate(spe, covariate = c("biology", "ls", "batch"), ...)
Arguments
- spe
a SpatialExperiment object.
- covariate
a character, specifying the type of covariate to be plot: "biology" (default), "ls" to plot the library size effect, and "batch" to plot the batch-specific effect.
- ...
additional parameters to be passed to the plotSpatial function.
Examples
library(SpatialExperiment)
library(ggplot2)
data(HumanDLPFC)
# \donttest{
HumanDLPFC = SpaNorm(HumanDLPFC, sample.p = 0.05, df.tps = 2, tol = 1e-2)
#> (1/2) Fitting SpaNorm model
#> 201 cells/spots sampled to fit model
#> iter: 1, estimating gene-wise dispersion
#> iter: 1, log-likelihood: -1149654.530080
#> iter: 1, fitting NB model
#> iter: 1, iter: 1, log-likelihood: -1149654.530080
#> iter: 1, iter: 2, log-likelihood: -817133.743703
#> iter: 1, iter: 3, log-likelihood: -728255.929110
#> iter: 1, iter: 4, log-likelihood: -712315.325925
#> iter: 1, iter: 5, log-likelihood: -710016.017096
#> iter: 1, iter: 6, log-likelihood: -709613.773963
#> iter: 1, iter: 7, log-likelihood: -709519.701194
#> iter: 1, iter: 8, log-likelihood: -709487.815306 (converged)
#> iter: 2, estimating gene-wise dispersion
#> iter: 2, log-likelihood: -708972.165863
#> iter: 2, fitting NB model
#> iter: 2, iter: 1, log-likelihood: -708972.165863
#> iter: 2, iter: 2, log-likelihood: -708655.957792
#> iter: 2, iter: 3, log-likelihood: -708639.165945 (converged)
#> iter: 3, log-likelihood: -708639.165945 (converged)
#> (2/2) Normalising data
# plot spatial region annotations
p1 <- plotCovariate(HumanDLPFC, covariate = "biology", colour = ENSG00000075624) +
scale_colour_viridis_c(option = "F")
p1
p2 <- plotCovariate(HumanDLPFC, covariate = "ls", colour = ENSG00000075624) +
scale_colour_viridis_c(option = "F")
p2
# }