Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Geert van Geest committed Jun 14, 2024
1 parent 2ec437a commit 4871b20
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion 1_setup.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ course_data/

This data is provided by 10x genomics, and further information, like material and methods can be found here:

- Antherior: [https://www.10xgenomics.com/datasets/mouse-brain-serial-section-1-sagittal-anterior-1-standard-1-1-0](https://www.10xgenomics.com/datasets/mouse-brain-serial-section-1-sagittal-anterior-1-standard-1-1-0)
- Anterior: [https://www.10xgenomics.com/datasets/mouse-brain-serial-section-1-sagittal-anterior-1-standard-1-1-0](https://www.10xgenomics.com/datasets/mouse-brain-serial-section-1-sagittal-anterior-1-standard-1-1-0)
- Posterior: [https://www.10xgenomics.com/datasets/mouse-brain-serial-section-1-sagittal-posterior-1-standard-1-1-0](https://www.10xgenomics.com/datasets/mouse-brain-serial-section-1-sagittal-posterior-1-standard-1-1-0)

16 changes: 12 additions & 4 deletions 2_quality_control.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,25 @@ s
# defining the high mt spot in anterior
seu$percent_mt_keep <- !(seu$orig.ident == "Anterior" & seu$percent_mt > 38)
SpatialPlot(seu, group.by = "percent_mt_keep") +
cells_mt_keep <- colnames(seu)[seu$percent_mt_keep]
SpatialPlot(seu, cells.highlight = cells_mt_keep,
cols.highlight = c("grey50", "red"),
pt.size.factor = 2.5) +
plot_annotation(title = "Filter % mitochondrial UMI") +
plot_layout(guides='collect') & theme(legend.position = "none")
# defining the low number of genes
seu$nFeature_Spatial_keep <- seu$nFeature_Spatial > 100
SpatialPlot(seu, group.by = "nFeature_Spatial_keep") +
plot_annotation(title = "Filter % low number of features") +
plot_layout(guides='collect') & theme(legend.position = "none")
cells_nfeature_keep <- colnames(seu)[seu$nFeature_Spatial_keep]
SpatialPlot(seu, cells.highlight = cells_nfeature_keep,
cols.highlight = c("grey50", "red"),
pt.size.factor = 2.5) +
plot_annotation(title = "Filter % low number of features") +
plot_layout(guides='collect') & theme(legend.position = "none")
```

Now, we remove the spots, and visualize the spots that are left over:
Expand Down
6 changes: 5 additions & 1 deletion 3_normalization_scaling.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ We need to apply `SCTransform` on each individual slice. Therefore, we split the

```{r}
#| message: FALSE
#| warning: FALSE
seu_list <- SplitObject(seu, split.by = "orig.ident")
# images aren't split with SplitObject. Resetting the images.
# preparing both objects for SCTransform
for(slice in names(seu_list)) {
# images aren't split with SplitObject. Resetting the images.
seu_list[[slice]]@images <- setNames(
list(seu_list[[slice]]@images[[slice]]),
slice)
# bugfix based on https://github.com/satijalab/seurat/issues/8216
seu_list[[slice]][["RNA"]] <- seu_list[[slice]][["Spatial"]]
DefaultAssay(seu_list[[slice]]) <- "RNA"
}
seu_list <- lapply(X = seu_list, FUN = SCTransform, assay = "RNA",
Expand Down
8 changes: 7 additions & 1 deletion 4_integration_clustering.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ DimPlot(seu, reduction = "pca", group.by = "orig.ident") +
Based on the PCA, we can create a UMAP to get a representation of all 50 dimensions in a two dimensional space:

```{r}
#| warning: FALSE
#| message: FALSE
seu <- RunUMAP(seu, reduction = "pca", dims = 1:50)
DimPlot(seu, reduction = "umap", group.by = "orig.ident") +
Expand Down Expand Up @@ -176,7 +179,7 @@ There is not 'true' clustering, but based on the `clustree` plot, it seems that

```{r}
#| warning: false
res <- "integrated_snn_res.0.5"
res <- "integrated_snn_res.0.4"
seu <- SetIdent(seu, value = res)
```

Expand All @@ -187,13 +190,16 @@ The script below assumes that you have set object `res` to the column of your se

```{r}
#| eval: false
# this is not (necessarily) the correct answer to the previous question!
res <- "integrated_snn_res.0.8"
```
:::

Now that we have selected a resolution, we can color both the UMAP and the slices accordingly. First we defnie some appropriate colors, then we plot the UMAP with `DimPlot` and the slices with `SpatialPlot`.

```{r}
#| warning: false
#| message: false
nclust <- seu[[res]] |> unique() |> nrow()
cluster_cols <- viridis::viridis_pal(option = "H")(nclust)
Expand Down

0 comments on commit 4871b20

Please sign in to comment.