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.

Choosing dimensionality reductions

Single-cell RNA data describe each cell with thousands of gene measurements. We cannot view all those dimensions at once, and noisy features can obscure useful similarities. Principal component analysis (PCA) forms weighted combinations of the selected gene values, ordered by the variation they capture. Keeping the first few gives each cell a smaller set of coordinates that CyteArc uses to find neighbours and build a graph. Large variation can reflect technical effects as well as biological differences.

UMAP, densMAP, and t-SNE turn that neighbourhood graph into a two-dimensional view. Their settings change how the graph looks without changing its edges. These layouts are visual summaries, not alternative cluster assignments. Choosing how many PCA dimensions to retain does change the graph: too few can merge distinct populations, while too many can bring technical variation and noise back into the comparison.

Here we compare PCA dimension counts, UMAP packing, and all three layout methods on a prepared PBMC analysis. We will judge the views by whether known populations and local relationships remain visible, rather than by how tidy the pictures look.

See Clustering and cluster evidence for choosing and interpreting cluster assignments.

Open the prepared analysis

Started: 2026-10-11T18:54:46.033260Z | Wall time: 3.600 s

Open the downloaded store and its 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-10-11T18:54:49.636008Z | Wall time: 2.949 s

The saved analysis used 15 PCs; CyteArc’s current default is 21. We keep the example’s cells, genes, and normalization fixed so we can explore what changing the number of PCs does.

Baseline PBMC UMAP colored by ten clusters from the saved analysis using 15 principal components.

Started: 2026-10-11T18:54:52.586568Z | Wall time: 0.515 s

Compare PCA dimension counts

Build each candidate from the same normalized data and cluster each graph by passing it explicitly. Retain the 15-component graph and initialization for the layout comparisons below. The 15-component graph and clusters come from the saved analysis. The 10- and 30-component graphs are built below.

PCA variance-explained curve falls steeply over the first few components, then flattens. A red vertical line marks the detected elbow near component index 4.

Started: 2026-10-11T18:54:53.103877Z | Wall time: 19.702 s

PCA axes represent decreasing amounts of variation in the selected genes. An early bend in the elbow plot means later axes each add less variance. It suggests a range to investigate, rather than a single correct cutoff. CyteArc fits one extra component for this plot; when reusing a saved PCA result, it may warn that the plot is unavailable. Too few axes can merge distinct populations; too many can restore technical variation and noise. Compare graph connectivity, cluster stability, and marker coherence when the choice is uncertain.

Compare cluster sizes as well as the number of clusters. Cluster numbers can change between analyses, so matching row numbers do not necessarily identify the same cells.

PCs101530
cluster
1602716704
2127239237
324812371299
4738506601
5537318319
6298487317
7363149144
8149256258
92452517
106141525
1115015
1212012

Started: 2026-10-11T18:55:12.807854Z | Wall time: 0.012 s

10 vs 15 PCs 0.679137 10 vs 30 PCs 0.670148 15 vs 30 PCs 0.838912 Name: adjusted Rand index, dtype: float64

Started: 2026-10-11T18:55:12.820962Z | Wall time: 0.062 s

The adjusted Rand index measures partition agreement without requiring matching cluster numbers. It does not identify the biologically correct dimension count. Inspect markers and QC metrics where the partitions disagree. See Clustering and cluster evidence for more on cluster evidence.

Compare UMAP packing

The layout below uses the explicit 15-component graph. Colouring by each Leiden partition shows how the 10-, 15-, and 30-component cuts land on the same coordinates.

A common PBMC UMAP colored by Leiden clusters from graphs using 10, 15, and 30 principal components. The partitions differ even though the displayed coordinates are fixed.

Started: 2026-10-11T18:55:12.884322Z | Wall time: 1.346 s

min_dist controls how tightly cells can pack in the layout relative to spread, which sets the overall distance scale. A smaller min_dist often makes groups appear tighter, but it does not add evidence for a cluster or change the input graph. Compare 0.1 with the prepared example’s value of 1 while keeping the neighbours and cluster labels fixed.

Started: 2026-10-11T18:55:14.231860Z | Wall time: 4.399 s

Paired UMAPs use the same graph and cluster labels with min_dist values of 1 and 0.1. The smaller value packs the groups more tightly and increases visible gaps.

Started: 2026-10-11T18:55:18.632545Z | Wall time: 0.729 s

Optional: compare densMAP and t-SNE

Started: 2026-10-11T18:55:19.363405Z | Wall time: 5.129 s

densMAP adds a density-preservation objective. Relative packing can differ from UMAP; plot area is still not a direct estimate of cell frequency.

CyteArc’s t-SNE consumes the same neighbourhood graph. Computing a new embedding needs the optional sgtsnepi package from the tsne extra (see Optional t-SNE); reusing a saved embedding does not.

Started: 2026-10-11T18:55:24.494579Z | Wall time: 1.154 s

Read the layouts cautiously

UMAP, densMAP, and t-SNE layouts of the same cells, graph, and cluster labels. The methods produce different shapes, packing, and spacing between groups.

Started: 2026-10-11T18:55:25.650473Z | Wall time: 1.279 s

The three panels share cells, graph, and cluster labels. A useful comparison asks whether local neighbours and known populations remain visible. Differences in global orientation, distance, empty space, or apparent island size do not demonstrate different biology. A layout that hides connected transitions or separates obvious technical covariates needs further investigation.

Next: clustering

Continue with Clustering and cluster evidence to compare ways of grouping cells. That guide distinguishes graph connectivity between groups from the Paris hierarchy and covers both adaptive and fixed cuts.