Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Identify PBMC populations with scRNA-seq

Name the cell populations in a saved RNA analysis of 5,025 human peripheral blood mononuclear cells (PBMCs) from a healthy donor, the 10x Genomics 5k PBMC dataset (tenx_5K_pbmc_rnaseq). The analysis kept 3,948 cells after quality filtering and divided them into 12 Leiden clusters. Two or three marker genes for each of six lineages name every cluster: 2,385 T cells in four clusters, 704 CD14 monocytes in one, 495 B cells and 312 NK cells in two clusters each, and one small cluster each of 25 CD16 monocytes, 15 cells that resemble plasmacytoid dendritic cells (pDC-like cells) and 12 platelets. The names are saved as the cell column pbmc_cell_type, which later plots and analyses can group cells by.

To analyze your own counts, start with the quick start.

Open the saved analysis

DataStore has 3948 (5025) cells with 1 assays: RNA Cell metadata: 'I', 'ids', 'names', 'RNA_G2M_score', 'RNA_S_score', 'RNA_UMAP1', 'RNA_UMAP2', 'RNA_cell_cycle_phase', 'RNA_clusters', 'RNA_doublet_score', 'RNA_leiden_cluster', 'RNA_nCounts', 'RNA_nFeatures', 'RNA_paris_cluster', 'RNA_percentMito', 'RNA_percentRibo' RNA assay has 33538 features and following metadata: 'I', 'ids', 'names', 'dropOuts', 'feature_type', 'genome', 'nCells'

Started: 2026-11-18T00:16:07.354000Z | Wall time: 9.282 s

ds shows 3,948 active cells out of the store’s 5,025: the cells that passed the quality filters of the saved analysis, which plots and analyses use by default. ds.pipeline.open(label="rna") reopens that analysis as a pipeline run, the saved record of one call of the RNA recipe ds.pipeline.rna: the call’s settings, a summary of each stage and the stage results. run.report() returns the settings and the stage summaries. Read the settings of the five stages that shape the clusters:

{'filtering': {'enabled': True, 'method': 'manual', 'attrs': ['RNA_nCounts', 'RNA_nFeatures', 'RNA_percentMito'], 'lows': [1000, 500, 0], 'highs': [15000, 4000, 15], 'keepBounds': False}, 'hvg': {'top_n': 500}, 'pca': {'dims': 15}, 'neighbors': {'k': 11}, 'leiden': {'partitions': [0.5], 'selected': None}}

Started: 2026-11-18T00:16:16.640864Z | Wall time: 0.035 s

The run kept the cells with more than 1,000 and fewer than 15,000 RNA counts, more than 500 and fewer than 4,000 detected genes, and more than 0% but less than 15% of counts from mitochondrial genes; Quality control and doublet detection compares these thresholds with automatic bounds. The run then selected the 500 most variable genes, summarized them in 15 principal components, connected each cell to its 11 nearest neighbors, and divided the neighbor graph into clusters with Leiden at resolution 0.5. Only the 11 neighbors match the recipe’s defaults: by default the recipe sets the filter bounds from the spread of each measure, keeps more genes and principal components, and runs Leiden at four resolutions, saving the clustering with the best silhouette score.

Look at the clusters

run=run draws the run’s UMAP and reads the colors from the cell fields that the run saved, such as its clusters, so later edits to the store’s cell table cannot change the figure. CellField("clusters", label="Leiden cluster") names the field to color by and the title to show for it:

UMAP of the 3,948 analyzed PBMCs colored by 12 Leiden clusters, numbered 1 to 12 from largest to smallest. Clusters 1, 3, 4, 5 and 8 form one continuous region on the left, with the small cluster 9 beside the lower end of cluster 3. Clusters 6 and 7 form a group at the top, clusters 2 and 10 a group on the right with cluster 10 at its tip, and the small clusters 11 and 12 sit apart above cluster 2.

Started: 2026-11-18T00:16:16.679800Z | Wall time: 1.427 s

CyteArc numbers the Leiden clusters by size, from cluster 1, the largest, to cluster 12. Clusters 1, 3, 4, 5 and 8 form one continuous region on the left, with the small cluster 9 beside the lower end of cluster 3. Clusters 6 and 7 form a group at the top, clusters 2 and 10 a group on the right, and the two smallest clusters, 11 and 12, sit apart above cluster 2.

Compare markers across clusters

In the dot plot, dot size is the fraction of a cluster’s cells that detect the gene, and color is the gene’s mean expression after each cell’s counts are scaled to a total of 1,000, so a mean of 10 corresponds to 1% of a cell’s counts on average. groups=run["clusters"] groups the cells by the run’s clusters: indexing a run by an output name returns an ArtifactRef, a reference to that saved result.

Dot plot of 13 marker genes in six lineage panels, monocyte, B cell, T cell, NK cell, pDC-like and platelet (rows), across the 12 Leiden clusters (columns). Dot size gives the fraction of cells that detect the gene, from near 0% to 100%, and color gives the mean expression on a scale from 0 to 33. PPBP in cluster 12 is the only yellow dot. PF4 in cluster 12, S100A8 in cluster 2, NKG7 in cluster 5 and GNLY in clusters 5 and 9 are blue, and the T-cell and B-cell markers are dark purple in every cluster, although their dots are large in the clusters of their lineage.

Started: 2026-11-18T00:16:18.109624Z | Wall time: 1.161 s

The plot’s result also holds the values that it draws, as mean_dotplot.tables["aggregate"], one row per gene and cluster. Find the cluster where each marker’s mean expression peaks:

clustermean expressionfraction detected
gene
LST1103.191.00
S100A8210.960.99
FCGR3A102.701.00
MS4A161.120.99
CD79A61.881.00
CD3D30.690.97
IL7R41.150.91
NKG757.551.00
GNLY910.011.00
GZMB113.101.00
JCHAIN111.631.00
PPBP1232.951.00
PF41212.021.00

Started: 2026-11-18T00:16:19.273761Z | Wall time: 0.022 s

Every marker is detected in at least 91% of the cells of the cluster where it peaks. The peak means differ almost 50-fold: PPBP averages 33 in cluster 12, so this platelet gene makes up 3.3% of those cells’ counts on average, while the T-cell marker CD3D peaks at 0.69 and the B-cell marker MS4A1 at 1.12. PPBP sets the top of the shared color scale, so the T-cell and B-cell markers stay dark in every cluster of the first plot, and only their dot sizes show where the markers are detected.

Standardizing each gene across the clusters turns its 12 cluster means into z-scores: 0 at the gene’s average over the clusters and 1 at one standard deviation above it. The colors then compare clusters within a gene, not one gene with another. A gene confined to one cluster, such as PPBP, reaches the top of the color scale, while a gene shared by several clusters, such as CD3D, peaks lower:

The same dot plot with each gene's cluster means standardized across the 12 Leiden clusters, on a color scale from below 0 to above 3. Each gene is brightest in the clusters of its lineage: S100A8 in cluster 2, LST1 and FCGR3A in cluster 10, MS4A1 and CD79A in clusters 6 and 7, CD3D and IL7R in clusters 1, 3, 4 and 8, NKG7 and GNLY in clusters 5 and 9, GZMB and JCHAIN in cluster 11, and PPBP and PF4 in cluster 12. Genes confined to one cluster, such as S100A8, PPBP and JCHAIN, reach yellow, while CD3D, which four clusters share, peaks at mid-scale in cluster 3. GZMB and FCGR3A are also teal in cluster 5.

Started: 2026-11-18T00:16:19.299214Z | Wall time: 0.805 s

Name the clusters

Read the standardized plot one lineage at a time:

  • Clusters 1, 3, 4 and 8 express the T-cell markers CD3D and IL7R. Cluster 3, where CD3D peaks, also expresses NKG7, part of a cytotoxic program that T cells share with NK cells.

  • Clusters 6 and 7 express the B-cell markers MS4A1 and CD79A.

  • Clusters 5 and 9 express NKG7 and GNLY most strongly and detect CD3D in fewer cells than the T-cell clusters, the profile of NK cells. Cluster 5 also expresses GZMB and FCGR3A. Its CD3D dot is mid-sized, against a dot near zero in cluster 9, so cluster 5 may also hold some T cells, which the cell type annotation tutorial checks with more T-cell genes.

  • Clusters 2 and 10 both express the monocyte marker LST1 and differ in the other two: S100A8 peaks in cluster 2 and FCGR3A in cluster 10. S100A8 marks classical monocytes, which are usually named for their surface marker CD14, so cluster 2 is named CD14 monocytes although the panel holds no CD14. FCGR3A encodes CD16, which marks nonclassical monocytes and also NK cells, as cluster 5 shows; every cell of cluster 10 detects the monocyte marker LST1, and the NK markers NKG7 and GNLY stay dark there, so cluster 10 is named CD16 monocytes.

  • Cluster 11 expresses GZMB and JCHAIN in every cell, a combination typical of plasmacytoid dendritic cells (pDCs). Both genes also mark other cells, GZMB the NK cells of cluster 5 and JCHAIN some B cells, so the name pDC-like stays provisional.

  • Cluster 12 expresses the platelet markers PPBP and PF4 in every cell, and almost no cells of other clusters do. Platelets are not mononuclear cells, but PBMC preparations often retain some.

Started: 2026-11-18T00:16:20.107442Z | Wall time: 0.005 s

Save the names in the cell table

The run’s cell fields cover only its 3,948 analyzed cells, while the store’s cell table, ds.cells, has a row for each of its 5,025 cells. run.cells.fetch_all("I") returns the run’s active-cell flag I for every row of the cell table, marking the analyzed rows, and run.cells.fetch("clusters") returns the clusters of the analyzed rows only, in the same order. Give the other rows the label “Not analyzed” and insert the names as the column pbmc_cell_type:

cellspercent
cell type
T cells238560.4
CD14 monocytes70417.8
B cells49512.5
NK cells3127.9
CD16 monocytes250.6
pDC-like cells150.4
platelets120.3

Started: 2026-11-18T00:16:20.115649Z | Wall time: 0.074 s

T cells make up 60% of the analyzed cells and CD14 monocytes 18%. overwrite=True lets the code run again and replace the column, and the run’s saved results stay as they were, because the column belongs to the store’s cell table. A plot with run=run colors only by the run’s cell fields, so the next plot takes the UMAP coordinates from the run with layout=run["umap"] and the colors from the new column:

UMAP of the 3,948 analyzed PBMCs colored by broad cell type. T cells (gray) fill the region on the left, with the NK cells (red) at its lower end: the larger NK group touches the T cells, and a small one sits apart to their left. B cells (blue) form the group at the top, CD14 monocytes (orange) the large group on the right with the CD16 monocytes (green) at its upper right tip, and pDC-like cells (brown) and platelets (pink) two small groups above the monocytes.

Started: 2026-11-18T00:16:20.192346Z | Wall time: 0.309 s

T cells fill the continuous region on the left. Both NK clusters sit beside the lower end of T-cell cluster 3, which shares NKG7 with them: cluster 5 below it and cluster 9 in a small group to its left. The B cells, the monocytes, the pDC-like cells and the platelets each form a separate group, with the CD16 monocytes at the tip of the CD14 monocytes.

Build on this analysis

The cell type annotation tutorial continues from these names: it tests them against the marker statistics of every gene and refines them where several markers agree. The highly variable genes, dimensionality reduction, neighbor graph and clustering tutorials each change one stage of this analysis and compare the clusters that result, and the analysis reuse tutorial shows how a rerun with one changed setting reuses the saved stages before that setting.