A small FastAPI application for exploring the supplied PBMC single-cell dataset in a browser. The app loads data/pbmc3k.h5ad at startup and provides a UMAP, cluster QC summaries, marker tables, and gene-expression coloring.
- Python 3.11+
uv
The project uses uv for its virtual environment and dependency management. Dependencies include Scanpy, FastAPI, and Uvicorn. The browser UI loads Tailwind CSS and Plotly.js from CDN script tags; there is no npm dependency or frontend build step.
From the project directory:
uv venv
uv sync
uv run uvicorn app:app --host 0.0.0.0 --port 8000Open http://localhost:8000.
The app expects the dataset at data/pbmc3k.h5ad. To use another H5AD file, replace that file or update DATA_PATH in app.py.
- UMAP colored by:
- Cluster
- Detected genes per cell
- Mitochondrial reads (%)
- Gene expression
- Scroll-wheel/touchpad zoom on the UMAP
- Pan tool in the left sidebar
- Autoscale and image download tools
- Gene selector with loading and not-found feedback
- Quick selection of clusters 4 and 7
- Selected-cluster QC and detailed marker table
- Full cluster overview for clusters 0–7 with cell counts, QC medians, and top markers
- Cream/beige light theme with dark, readable tables
The Plotly default modebar is hidden. Plot controls are provided in the left sidebar.
GET /api/umap— UMAP coordinates, cluster labels, and per-cell QC fieldsGET /api/genes/{gene}— per-cell log-normalized expression fromadata.XGET /api/clusters/overview— all-cluster counts, QC medians, and five top markersGET /api/clusters/{cluster}/markers?n_genes=15— ranked markers and selected-cluster QC
Validate the key cluster 4 and 7 values with:
uv run python validate_app_clusters.pyThe script reports the dataset cell count, cluster cell counts, QC medians, and top five markers.
Run the seeded sampled trap checks with:
uv run python sampled_trap_check.pyThis samples up to 30 cells per cluster with seed 42, compares sample and full-cluster QC, checks marker coherence and raw-count incompatible-lineage co-expression, and writes the detailed report to results/sampled_trap_check.csv. PASS means no obvious artifact was detected; it does not confirm a novel cell type.
The supplied H5AD contains 2,700 cells, precomputed clusters, UMAP coordinates, QC metadata, log-normalized adata.X, and raw counts in adata.layers["counts"]. Donor/batch identifiers and formal doublet scores are not available in the supplied data, so donor-level reproducibility and formal doublet-score validation are out of scope.