Bootcamp / Session 5 / 5.2

Session 5.2 · Ozkan Aydemir

Single-cell data, QC and integration, live.

Ozkan Aydemir works through a public COVID-19 lung lavage dataset in marimo notebooks with an AI agent: merging samples, deciding which cells to keep, finding doublets, and then integrating samples without erasing the biology you came to study.

Watch the recordings Fri Oct 16 · two recordings, about 95 minutes

Recordings

Part 1: the data and quality control

Slides on how single-cell libraries are made (droplet capture, UMIs, 5′ versus 3′ kits, VDJ, Cell Ranger, intronic reads, ambient RNA), then the dataset and two notebooks: merging the samples into one AnnData object, and quality control.

Ozkan Aydemir · data and QC · 67 minutes

Part 2: integration

Slides on batch versus condition and over-integration, questions on pooled samples, then the third notebook: normalization, variable genes, PCs, UMAPs by sample and condition, and the integrated result.

Ozkan Aydemir · integration · 27 minutes

Part 3: checking our clusters against the paper

Recorded at the start of Session 6. The authors share their own cell type labels on GitHub, so Ozkan compares them with our clusters. Most cell types agree well. The differences come from our choices: we keep many more neutrophils, and we drop about 12,000 cells the paper kept, mostly doublets. The paper’s only doublet filter, a 6,000 gene cap, removes about 450 cells and only from deeply sequenced libraries, while the 10x doublet rate predicts 10,000 to 12,000. Ask your agent to fetch the paper’s labels and run the same comparison.

Ozkan Aydemir · comparison with the paper · 8 minutes

Part 4: does the same prompt give the same analysis?

Questions from the room. If you run the same analysis with an AI agent three times, expect the main conclusions to hold and the details to vary: thresholds are judgment calls, and clustering has a random start. Small differences are expected, while large ones usually mean a mistake. Two clusterings that split macrophages differently can both be right. When runs disagree, show the agent all of them and ask it to explain the differences.

Ozkan Aydemir and Manuel Garber · Q&A · 4 minutes

The dataset

Bronchoalveolar lavage (BAL) cells from patients with moderate and severe COVID-19 and from healthy controls, published by Liao and colleagues in 2020. The data are public. One caution comes up early: the healthy controls were not processed alongside the patients, so control versus COVID-19 is confounded with batch. Any integration that removes the batch can also remove the disease signal.

What the notebooks cover

Merging samples

Load each sample’s count matrix, combine them into one AnnData object, and count cells per sample. A short tour of AnnData: the count matrix, cell and gene tables, and layers that keep raw and normalized counts side by side.

Quality control

Signals of damaged cells: few genes, few UMIs, a high mitochondrial fraction. Three ways to set cutoffs: one fixed threshold for everything, a threshold per sample, or a threshold per cluster. Fixed filters quietly remove neutrophils, which naturally have few genes, so the choice changes which cell types survive. The notebook compares the filters side by side.

Doublets

Scrublet and scDblFinder both simulate artificial doublets and score real cells against them. They do not always agree, and the comparison is part of the lesson.

Integration

Normalize, choose variable genes, pick the number of PCs, and look at the UMAP colored by sample and by condition before and after integration. Integration that is too strong merges cells that differ for real biological reasons. The UMAP is a picture; clustering runs on the neighbor graph. Neutrophils return as a trade-off: keep them and accept noisier QC, or filter them out and lose a cell type that matters in COVID-19 lungs.

After the session

Two minutes of feedback, so the next session is pitched better. It also records your attendance, so fill it in whether you were in the room, on Zoom, or catching up on the recording.

Session 5 feedback