LSMA

LONDON SCHOOL OF MULTIOMICS & AI

LSMA

LONDON SCHOOL OF MULTIOMICS & AI

Free course

Free course

0 of 31 lessons

From cells to cell types

From cells to cell types

From cells to cell types

Take 6,000 unlabelled blood cells from eight donors through quality control, clustering, markers and annotation, then test which genes interferon changes in the B cells you found yourself.

Comparing conditions with pseudobulk tested the interferon response with the published cell-type labels already in hand. This project removes that help: you start from raw counts and do every step of the module yourself.

Research question

Starting from 6,000 unlabelled blood cells from eight donors, can you find and name the main cell types yourself, and then show which genes change in B cells after interferon-beta stimulation?

The cells are a random sample from the Kang 2018 data of Comparing conditions with pseudobulk. That lesson used only the CD14 monocytes and took the cell types from the published labels. Here you hide those labels until task 4, find the cell types from the data alone, and only then compare your answer with the published one. The comparison at the end is in a different cell type, the B cells, chosen with your own labels.

How to approach this

  • Work from the lessons. Each task follows one lesson of this module. Reopen its code and adapt it: the main changes are the object name, here kang, and the thresholds you choose.
  • Use Seurat for tasks 1 to 4 and DESeq2 for task 5. Build the Seurat object from the SingleCellExperiment with CreateSeuratObject(counts = counts(sce)[, pick], meta.data = as.data.frame(colData(sce))[pick, ], min.cells = 3), where pick holds the 6,000 sampled columns.
  • Set the seeds. Use set.seed(2018) immediately before sample(ncol(sce), 6000), random.seed = 1 in FindClusters() and seed.use = 42 in RunUMAP(). With the same seeds and package versions your numbers should match the checkpoints; with others, the details will differ but the conclusions should not.
  • Keep the published labels out of sight. The cell column is in the metadata. Do not look at it until task 4, or your annotation is no longer a test.

Two things are new compared with pbmc3k. First, this sample mixes two conditions. Interferon-beta changes hundreds of genes in every cell type, so stimulated and control cells of the same type can look like different clusters. Expect that, and decide what it means for your labels. Second, the cells come from eight people, so the donor column, ind, matters for the final test, as it did in Comparing conditions with pseudobulk.

As in A reproducible workflow, write one script that runs from loading the data to saving the results table, and finish it with sessionInfo(). Single-cell steps take longer than anything earlier in the course, so save the Seurat object with saveRDS() after the slow steps and read it back when you rerun later tasks.

1

Build the object and check quality

Single-cell QC and normalisation

  • Load Kang18_8vs8(), sample 6,000 cells, build a Seurat object and add percent.mt.
  • Summarise the three QC metrics, and compare the median UMIs and genes of the cells labelled singlet, doublet and ambiguous in the multiplets column.
  • Keep singlets with a cell-type label and choose gene-count thresholds from the distributions.

Hint. Seurat warns that feature names cannot contain underscores and replaces them with dashes; this affects only a few gene names and can be ignored. Look at summary(kang$percent.mt) before you write a mitochondrial threshold: the result is the first surprise of the project, and you should say in your write-up what it means for QC. For the doublet comparison, aggregate(cbind(nCount_RNA, nFeature_RNA) ~ multiplets, data = kang[[]], FUN = median) gives one row per label. A lower limit of 200 genes and an upper limit near the 99th percentile are reasonable starting points.

Checkpoint: 13,384 genes × 6,000 cells; percent.mt is 0 in every cell, so this dataset carries no mitochondrial signal and that filter does nothing here; median UMIs 2,388 for doublets against 1,247 for singlets; with 200 to 1,500 genes, 5,067 cells remain, 2,530 control and 2,537 stimulated.

2

Cluster and map

Clustering and UMAP

  • Normalise, find 2,000 variable genes, scale and run PCA. Choose the number of components from the elbow plot.
  • Cluster at resolution 0.5, run UMAP, and draw it twice: coloured by cluster and coloured by condition.
  • Cross-tabulate clusters against stim.

Hint. DimPlot(kang, group.by = c("seurat_clusters", "stim")) draws the two maps side by side. The checkpoints use 15 components, slightly more than for pbmc3k because two conditions add structure. When you read the cross-table, ask for each cluster whether it holds both conditions or almost only one.

Checkpoint: PC1 holds 37.4% of the variance captured by 30 components; 13 clusters, from 1,001 cells down to 69; most clusters are nearly all one condition, for example cluster 0 has 994 stimulated and 7 control cells, and cluster 1 has 935 control and 22 stimulated. On the map, control and stimulated cells of the same kind lie side by side but separate.

3

Find markers

Markers and cell types

  • Run FindAllMarkers() with only.pos = TRUE and list the top three genes per cluster.
  • Tabulate the percentage of cells in each cluster expressing the 13 known blood-cell markers, and draw a dot plot of them.

Hint. Use the same marker list and the same percentage table as Markers and cell types. Some clusters' top genes will not be cell-type markers at all but interferon-response genes, because a cluster made only of stimulated cells differs from the rest mainly in the response. Use the known markers, which do not respond to interferon, to name the cell type.

Checkpoint: cluster 3's top markers are CCL8, IL27 and IL1RN, interferon-induced genes, and its known markers (LYZ 83%, CST3 94%) say monocyte; MS4A1 is highest in clusters 6 and 7 (48% and 43%); FCGR3A is in 99% and 100% of clusters 9 and 10; PPBP in 88% of cluster 12; FCER1A in 17% of cluster 11, lower than in pbmc3k because these cells have fewer UMIs.

4

Name the clusters and check

Markers and cell types

  • Give every cluster a cell-type label, using the same label for a control cluster and its stimulated partner.
  • Only now, compare your labels with the published cell column and compute the percentage that agree.

Hint. Store your labels in a new column, kang$cell_type, through a named vector as in Markers and cell types. The published labels use different names, such as "CD14+ Monocytes", so make a second named vector that translates them into yours before comparing. If a cluster mixes two types that your markers cannot separate, give it a combined label rather than guessing, and say so.

Checkpoint: seven labels: CD4 T (2,117 cells), CD14 monocyte (1,250), NK and CD8 T (811), B (522), FCGR3A monocyte (217), dendritic cell (81) and platelet (69); clusters 4 and 5 each contain both NK and CD8 T cells by the published labels, so a combined label is honest at this resolution; agreement with the published labels is 93.3%.

5

One pseudobulk comparison

Comparing conditions with pseudobulk

  • Take your B cells, sum their raw counts per donor and condition, and test stimulated against control with DESeq2 and a paired design.
  • Report the number of cells per pseudobulk sample, the number of genes tested, and the top genes.

Hint. In Seurat, AggregateExpression(b, assays = "RNA", group.by = c("ind", "stim"))$RNA returns the summed counts, with columns named such as g101_ctrl: Seurat adds the "g" because the donor codes start with a number. Build the sample table from those names with sub(), set control as the reference, filter genes with at least 10 counts in at least 8 samples, and use ~ donor + condition. Check table(b$ind, b$stim) first: with a sample of 6,000 cells, some pseudobulk samples are small.

Checkpoint: 522 B cells, from 6 to 99 per donor and condition; 398 genes pass the filter; 68 up and 38 down at padj < 0.05; the top genes are ISG20 and ISG15, and IFIT3 has a log2 fold change of 6.8, about 110-fold.

What the project shows

If your numbers match the checkpoints, you have taken unlabelled cells all the way to a tested biological result, and checked each step. Three lessons stand out.

First, quality metrics depend on how the data were prepared. Every cell here has a mitochondrial share of 0, so the filter that did most of the work in pbmc3k does nothing. The doublet labels from the donors' genetic variants show what a doublet looks like instead: about twice the UMIs of a single cell, which is why an upper threshold on genes helps when no such labels exist.

Second, a strong treatment shapes the clusters. Interferon-beta moved stimulated cells away from their control partners, so most cell types appeared as two clusters, one per condition. Naming them by markers that do not respond to the treatment, and giving partners the same label, solved this for annotation. Methods that align conditions before clustering, called integration (for example Seurat's IntegrateLayers() or Harmony), are the next step when the shift is harder to see through. Note also that the label "NK and CD8 T" records an honest limit: these two types share cytotoxic genes such as NKG7, and at this depth and resolution the clusters did not separate them.

Third, the final test is only as strong as the number of donors and cells behind it. The B-cell comparison found 106 genes from 398 tested, against 541 of 2,069 in Comparing conditions with pseudobulk, which used all 2,573 B cells. With a fifth of the cells, fewer genes pass the filter and power falls, but the direction and the leading genes, ISG15 and its relatives, are the same.

Go deeper: should the clustering include both conditions at all?

An alternative is to cluster and annotate the control cells first, then assign stimulated cells to the closest control type, for example with Seurat's FindTransferAnchors() and MapQuery(). Another is integration, which removes the shared shift between conditions before the graph is built. Both make each cell type a single cluster.

Both also carry a risk worth knowing. A method that removes differences between conditions can remove part of the effect you want to measure, and it changes the normalised values. That is one more reason to run the final test on summed raw counts, as in task 5, rather than on any corrected values.

Take it further

Raise the resolution, or use more components, and see whether clusters 4 and 5 split into NK and CD8 T cells: which markers decide it? Then run task 5 for the CD14 monocytes of your sample and compare the result with the full-data analysis of Comparing conditions with pseudobulk.

SeuratData also offers ifnb, about 14,000 PBMCs from the same Kang 2018 study, packaged without donor labels. Without them it cannot support a pseudobulk test, but it is a good dataset for practising integration and annotation.

Where this leads next

This module measured which genes each cell expresses. The next module, Genomic ranges and epigenomics in R, asks where things happen on the genome: where proteins bind DNA, where DNA is chemically marked by methylation, and how those positions relate to genes. It starts with the Bioconductor objects that store positions on chromosomes, and ends by combining several kinds of omics data measured on the same samples.

Further reading · Module 6Kang et al. 2018: the experiment behind this project, and how donors were told apart by their genetic variants. · All reading for this course

Check your understanding

1. In this sample, stimulated and control cells of the same type formed separate clusters. How should you label them?

2. Every cell in the Kang data has percent.mt = 0. What follows for quality control?

3. The B-cell comparison found 106 genes from a 6,000-cell sample but 541 from all cells. Why the difference?

Ask LSMA