UMAP Dimensionality Reduction
Graph-based nonlinear embeddings for exploring local structure in omics data
1 Topic at a Glance
One-sentence summary: Uniform Manifold Approximation and Projection (UMAP) makes a low-dimensional representation by preserving a weighted graph of local neighbors, providing a useful exploratory view of complex omics data but not a direct measurement of global distance or discrete cell types.
| Item | Description |
|---|---|
| Biological question | Which cells or samples have similar local molecular states, and are there candidate populations or continuous transitions to investigate? |
| Computational problem | Embed high-dimensional observations in two or more dimensions while retaining selected neighborhood relations |
| Method type | Nonlinear graph-based dimensionality reduction and visualization |
| Input | A processed feature matrix or embedding, a distance metric, neighbor count, and optimization settings |
| Output | Low-dimensional coordinates and an underlying weighted neighborhood graph |
| Bioinformatics uses | Single-cell RNA-seq and ATAC-seq displays, cytometry, spatial assays, and sample exploration |
| Prerequisites | PCA, distances, and k-nearest-neighbor graphs |
2 From an omics matrix to a layout
High-dimensional molecular profiles are difficult to inspect directly. UMAP first identifies local neighbors, then treats those relationships as a weighted graph. It places points in a low-dimensional space so that graph neighbors tend to remain close while non-neighbors are sampled as repulsive pairs during optimization.
quality-controlled matrix
-> select features and construct a representation, often PCA
-> find local neighbors under a stated metric
-> assign fuzzy graph memberships
-> optimize 2D or 3D coordinates
-> inspect neighborhoods with independent metadata and markers
The first three stages matter as much as the final layout. In a single-cell workflow, UMAP usually receives principal components derived from selected variable features, not raw counts. If those components retain batch, library-size, or ambient-RNA effects, the UMAP graph can faithfully display those technical effects.
3 The core algorithm
For each observation \(i\), UMAP finds a local neighbor set. It converts distance \(d(x_i,x_j)\) into a directed membership strength using a locally adjusted distance threshold \(\rho_i\) and scale \(\sigma_i\):
\[ w_{j\mid i}=\exp\left[-\frac{\max(0,d(x_i,x_j)-\rho_i)}{\sigma_i}\right]. \]
The scale is chosen so each point has a comparable effective neighborhood size. Directed strengths are combined into one undirected fuzzy simplicial-set edge weight:
\[ w_{ij}=w_{j\mid i}+w_{i\mid j}-w_{j\mid i}w_{i\mid j}. \]
UMAP then assigns low-dimensional coordinates \(y_i\) and uses a decreasing similarity curve,
\[ v_{ij}=\frac{1}{1+a\lVert y_i-y_j\rVert^{2b}}, \]
where \(a\) and \(b\) are selected from the requested spacing parameters. Optimizing a cross-entropy-like objective brings high-weight graph edges together and separates sampled non-edges. Negative sampling makes the procedure practical for large datasets, but the result is stochastic unless the random seed and implementation are recorded.
3.1 A small mental model
Imagine a dataset with two dense cell populations and a sparsely sampled differentiation path between them. With a modest neighborhood size, cells on the path may connect chiefly to their immediate developmental neighbors, and an embedding can display a continuum. If the path is undersampled, noisy, or removed during QC, the graph can instead split it into islands. Conversely, a large neighborhood setting can add edges across a real boundary. The display cannot decide whether a bridge or gap is biological; inspect the graph, marker genes, batch labels, and replicate samples.
4 Parameters that change the question
| Setting | Main effect | Practical interpretation |
|---|---|---|
n_neighbors |
Size of the local neighborhood used to form the graph | Smaller values emphasize fine local structure; larger values admit broader structure and can connect distinct states |
min_dist |
How tightly nearby points may pack in the embedding | Lower values produce denser-looking islands; they do not prove tighter biology |
| Metric | Defines similarity before graph construction | Match it to the representation; Euclidean distance on PCA coordinates is common but not automatic |
| Input dimensions | Sets the information available to the graph | Record feature selection, normalization, PCA dimensions, and integration choices |
| Random seed / initialization | Affects stochastic optimization and visual orientation | Fix and report it for a reproducible figure; repeat runs for sensitive claims |
UMAP implementations can also fit a model that places new observations into an existing embedding. That convenience does not make coordinates comparable across arbitrary separately fitted analyses: the reference representation, preprocessing, graph parameters, and fitted model must be retained.
5 Responsible use in single-cell analysis
- Apply assay-appropriate QC, normalization, transformation, and feature selection before creating the representation.
- Build and audit the kNN graph separately from the plot. Check neighbor composition for batch, donor, depth, and known controls.
- Overlay pre-specified metadata and independent markers. Treat apparent groups, gaps, and trajectories as hypotheses.
- Perform clustering, differential testing, trajectory analysis, or label transfer on their appropriate representations and statistical designs—not on UMAP coordinates alone.
| Tempting reading | Why it is unsafe | Better check |
|---|---|---|
| “Farther islands are more biologically different.” | UMAP prioritizes graph relationships; global geometry is not a calibrated distance scale | Compare original-space distances and relevant molecular evidence |
| “A dense island is a frequent or homogeneous population.” | Point packing depends on min_dist, sampling, and optimization |
Count observations and examine graph connectivity and markers |
| “Every visible island is a cell type.” | Graph partitions can reflect batch, density, or a continuous process | Validate with replicated samples, markers, and domain knowledge |
| “A bridge proves a lineage transition.” | Edges may arise from doublets, integration, or parameter choices | Examine local neighbors, doublet/QC metrics, and orthogonal evidence |
7 Take-home Messages
- UMAP turns a processed high-dimensional dataset into a weighted local-neighborhood graph and a low-dimensional layout.
- The representation, metric, neighbor count, and
min_distdefine what the visualization can show; report them. - UMAP coordinates support exploration, not direct claims about global distance, density, cluster identity, or statistical significance.
- Validate visible structure using the original representation, graph diagnostics, independent biological evidence, and replicate-aware analysis.
8 References
- McInnes, L., Healy, J., & Melville, J. 2018. UMAP: Uniform manifold approximation and projection for dimension reduction. arXiv:1802.03426.
- Becht, E. et al. 2018. Dimensionality reduction for visualizing single-cell data using UMAP. Nature Biotechnology 37:38–44.
- UMAP documentation: graph construction, parameters, reproducibility, and transforms.
- Scanpy UMAP documentation: UMAP use with an AnnData neighbor graph.