Large data#

scPyviewer scales from a laptop toy dataset to million-cell atlases larger than available RAM.

Explore a huge atlas in the web viewer#

Subsample once, then point the viewer at it. The embedding scatter renders with WebGL and is capped at SCPYVIEWER_MAX_SCATTER points (default 200k):

mkdir -p ~/sc_view
scpyviewer-prepare /path/to/Aging_Cohort.h5ad \
    --subsample 50000 --stratify cell_type \
    -o ~/sc_view/Aging_Cohort.sub.prepared.h5ad

scpyviewer --data-dir ~/sc_view        # open http://localhost:8501

Tuning knobs:

SCPYVIEWER_MAX_SCATTER=100000 scpyviewer --data-dir ~/sc_view     # fewer scatter points
SCPYVIEWER_BACKED_BYTES=2000000000 scpyviewer --data-dir ~/sc_view  # raise in-memory cutoff

Full-object modes (when you need every cell)#

  • RAM-aware loading (load_dataset()): a file loads fully into memory when it comfortably fits (≈3× on-disk size < available RAM); otherwise it opens backed='r'. Backed per-gene access is memory-bounded — CSC files read the column directly, CSR files stream in row-blocks. A dense CSR column still needs a full-file scan per gene, so subsampling is preferred for interactivity.

  • Backed-only prepare (auto when a file is larger than 0.66× available RAM): keeps X on disk, computes UMAP from any pre-existing embedding, peak RAM ≈ 2–6 GB. DE markers are skipped (they need X in RAM).