Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 5780aae

Browse files
committed
Write description of what the code is doing in basic usage vignette
1 parent e66a019 commit 5780aae

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

vignettes/basic-usage.Rmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,29 @@ knitr::opts_chunk$set(
1616
```
1717

1818
```{r setup}
19+
suppressPackageStartupMessages({
1920
library(Seurat)
2021
library(SeuratData)
2122
2223
library(callback)
24+
})
2325
```
2426

27+
First, we use the `SeuratData` data package to first download and then load
28+
2700 PBMCs. The loaded `SeuratObject`, `pbmc3k`, is from an old version of
29+
`Seurat`, and so we update the object to v5.
30+
2531
```{r load_data}
2632
set.seed(123)
2733
28-
# load pbmc3k dataset
2934
SeuratData::InstallData("pbmc3k")
3035
data("pbmc3k")
3136
3237
pbmc3k <- UpdateSeuratObject(pbmc3k)
3338
```
3439

40+
Now, we use `Seurat` to perform the usual preprocessing steps that are performed prior to clustering.
41+
3542
```{r preprocessing}
3643
pbmc3k <- NormalizeData(pbmc3k)
3744
pbmc3k <- FindVariableFeatures(pbmc3k)
@@ -41,15 +48,22 @@ pbmc3k <- FindNeighbors(pbmc3k)
4148
pbmc3k <- RunUMAP(pbmc3k, dims = 1:10)
4249
```
4350

51+
The `callback` algorithm can be run with a single function call as a drop-in
52+
replacement for the `Seurat` function `FindClusters`.
53+
4454
```{r run_callback}
4555
pbmc3k <- FindClustersCallback(pbmc3k)
4656
```
4757

58+
The `callback` clusters are set to the idents of the `SeuratObject` that is
59+
returned by `FindClustersCallback`
60+
4861
```{r plot_umap}
4962
DimPlot(pbmc3k)
5063
```
5164

52-
Cluster labels from `FindClustersCallback` care stored in in `[email protected]$callback_clusters`.
65+
Cluster labels from `FindClustersCallback` care stored in the metadata in the
66+
column `[email protected]$callback_clusters`.
5367

5468
```{r plot_umap2}
5569
DimPlot(pbmc3k, group.by = "callback_clusters")

0 commit comments

Comments
 (0)