Skip to content

Commit

Permalink
Merge pull request #128 from maxplanck-ie/KS
Browse files Browse the repository at this point in the history
partial fixes rmd14
  • Loading branch information
katsikora authored Jun 17, 2024
2 parents accc48e + 9135b38 commit 8691f83
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions rmd/14_FirstSteps.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -153,38 +153,22 @@ We are only loading cells with at least 200 genes detected, and we are only incl
With these filters in this particular dataset, we are reducing the number of genes from `33000` to `14000`.

The `SeuratObject` serves as a container that contains both data (like the count matrix) and analysis (like PCA, or clustering results) for a single-cell dataset.
For example, the count matrix is stored in `pbmc[["RNA"]]@counts`.
On RStudio, you can use `View(pbmc)` to inspect all the slots.
<!-- For example, the count matrix can be accessed as `LayerData(pbmc,assay="RNA",layer="counts")`. -->
On RStudio, you can use `View(pbmc)` to inspect all the layers (slots).

> 🧭✨ Poll:
>
> In cell "AAATTCGATTCTCA-1", how many reads map to gene "ACTB"? https://PollEv.com/multiple_choice_polls/ALEQy4aTk6YCvdvQMnCbg/respond
> Hint: subset the assay data, `pbmc@assays$RNA`.
> Hint: subset the assay data, `pbmc@assays$RNA` or use the [`FetchData()`](https://satijalab.github.io/seurat-object/reference/FetchData.html) function.

At the top level, `SeuratObject` serves as a collection of `Assay` and `DimReduc` objects, representing expression data and dimensional reductions of the expression data, respectively.
The `Assay` objects are designed to hold expression data of a single type, such as RNA-seq gene expression, CITE-seq ADTs, cell hashtags, or imputed gene values.

On the other hand, `DimReduc` objects represent transformations of the data contained within the Assay object(s) via various dimensional reduction techniques such as PCA.
For class-specific details, including more in depth description of the slots, please see the wiki sections for each class:
For class-specific details, including more in depth description of the layers (slots), please see the documentation sections for each class:

- [`Seurat`](https://github.com/satijalab/seurat/wiki/Seurat)

- [Slots](https://github.com/satijalab/seurat/wiki/Seurat#slots)
- [Object Information](https://github.com/satijalab/seurat/wiki/Seurat#object-information)
- [Data Access](https://github.com/satijalab/seurat/wiki/Seurat#data-access)

- [`Assay`](https://github.com/satijalab/seurat/wiki/Assay)

- [Slots](https://github.com/satijalab/seurat/wiki/Assay#slots)
- [Object Information](https://github.com/satijalab/seurat/wiki/Assay#object-information)
- [Data Access](https://github.com/satijalab/seurat/wiki/Assay#data-access)

- [`DimReduc`](https://github.com/satijalab/seurat/wiki/DimReduc)

- [Slots](https://github.com/satijalab/seurat/wiki/DimReduc#slots)
- [Object Information](https://github.com/satijalab/seurat/wiki/DimReduc#object-information)
- [Data Access](https://github.com/satijalab/seurat/wiki/DimReduc#data-access)
- [`Seurat Documentation`](https://satijalab.org/seurat/articles/essential_commands#seurat-object-data-access)

# Quality Control

Expand All @@ -211,7 +195,7 @@ You can find them stored in the object `meta.data`, let's see for the first 5 ce
pbmc@meta.data %>% head(5)
```

The `@` operator we just used, is for accessing the slot on the object.
The `@` operator we just used, is for accessing the layer (slot) on the object.

The `[[` operator can add columns to object metadata.
This is a great place to stash additional QC stats:
Expand All @@ -238,7 +222,8 @@ VlnPlot(
The `VlnPlot()` function plots the probability density function for all the specified variables (features).

> 🧭✨ Poll: How many cells have equal or less than 2000 counts in total (summed over all genes)?
> Hint: use `colSums`.
https://PollEv.com/multiple_choice_polls/YPYGTUEew6Y4XcqrqObxX/respond
> Hint: you can use `colSums` on the countdata layer or take advantage of the meta.data metrics calculated by Seurat and stored in the object.
Individually these variables may not fully discriminate dead cells, but could also reflect real biological properties (e.g. higher mitochondrial count).
Therefore it is useful to look a relationship between these variables.
Expand All @@ -248,7 +233,7 @@ All those are **features**
```{r featurescatter}
plot1 <- FeatureScatter(pbmc, feature1 = "nCount_RNA", feature2 = "percent.mt") + NoLegend()
plot2 <- FeatureScatter(pbmc, feature1 = "nCount_RNA", feature2 = "nFeature_RNA") + NoLegend()
plot3 <- FeatureScatter(pbmc, feature1 = "nCount_RNA", feature2 = "ACTB", slot = "counts") + NoLegend()
plot3 <- FeatureScatter(pbmc, feature1 = "nCount_RNA", feature2 = "ACTB", slot = "counts") + NoLegend()
plot1 + plot2
plot3
```
Expand Down Expand Up @@ -439,7 +424,7 @@ DimPlot(pbmc, shape.by = "mt.categories")
What about using colors?

To do that, we need to 'speak' to the Seurat function (`DimPlot`) through the `SeuratObj`.
There is a variable (actually, it's a slot) inside it, called `active.ident`.
There is a variable (actually, it's a layer (slot)) inside it, called `active.ident`.
To access or set this to different values (e.g. metadata columns) we use the `Idents()` function:

```{r}
Expand Down Expand Up @@ -510,7 +495,7 @@ Optimal resolution often increases for larger datasets.
pbmc <- FindClusters(pbmc, resolution = 0.5)
```

After this process, we have a new `seurat_clusters` column in our `meta.data` slot.
After this process, we have a new `seurat_clusters` column in our `meta.data` layer (slot).
Also, this is our new active identity!

> 🧭✨ Poll: How many clusters did we find?
Expand Down

0 comments on commit 8691f83

Please sign in to comment.