forked from lmweber/PrinciplesSTA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspot-deconvolution.qmd
41 lines (23 loc) · 1.86 KB
/
spot-deconvolution.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Spot deconvolution {#sec-spot-deconvolution}
## Overview
Spot-level ST data (e.g. from the 10x Genomics Visium platform) can contain zero, one, or multiple cells per spot, depending on the spatial resolution of the platform and the tissue cell density. This characteristic of the data affects several steps in analysis workflows, including quality control (@sec-quality-control) and clustering (@sec-clustering).
Note that this is also a characteristic of ST data that is distinct from single-cell RNA sequencing data, so here we cannot easily apply existing methods from single-cell workflows.
In this section, we will demonstrate methods to deconvolve cell types per spot.
## Previous steps
## Load data from previous steps
We start by loading the data object(s) saved after running the analysis steps from the previous chapters. Code to re-run the previous steps is shown in condensed form in @sec-analysis-steps.
```{r, message=FALSE, results='hide'}
library(SpatialExperiment)
library(here)
spe <- readRDS(here("outputs/spe_cluster.rds"))
```
## Number of cells per spot
The following figure provides an overview of the number of cells per spot in this dataset, which is known in this dataset and stored in a column in `colData` in the `SpatialExperiment` object. We use a visualization function from [ggspavis](https://bioconductor.org/packages/ggspavis) to generate the plot.
We see that spots in this dataset contain around 0-10 cells, with a mode of 3. Therefore, it is plausible that some spots contain multiple cell types, and spot-level deconvolution could improve downstream analyses by deconvolving these cell types.
```{r, message=FALSE, warnings=FALSE, fig.width=5, fig.height=4}
library(ggspavis)
# plot number of cells per spot
plotSpotQC(spe, plot_type = "histogram", x_metric = "cell_count") +
xlab("number of cells") +
ggtitle("Number of cells per spot")
```