ScGeo
Quantify cell-state shifts across conditions and representations.
Quick start · Installation · API reference · Plotting gallery · Tutorials · Paper workflows · Cite ScGeo
ScGeo turns existing single-cell representations into quantitative comparisons of cell states. Estimate displacement between conditions, quantify uncertainty across biological samples, examine agreement across prespecified representations, and compare geometric shifts with supplied dynamics such as RNA velocity.
The Python library works with AnnData and the Scanpy ecosystem. Its outputs are inspectable state-level tables and figures, with separate evidence for displacement, representation stability, local geometry, and dynamics.
Published in Bioinformatics Advances: Liu and Yoshida (2026), vbag266.
Learn with known answers. The illustrated simulation guide explains how the tutorial data are generated: planted state shifts, constructed velocity fields, opposing local gene responses, and a deliberately sparse control population. The 12 executable notebooks let you reproduce these examples using ScGeo 0.2.0; lessons 00–10 require no dataset downloads. Simulated inputs test software behavior, not biological mechanisms.
Development 0.2.1 (not yet published): The visualization patch improves long-label graph plots, response compasses and sample-center layouts. The current verified public release remains 0.2.0 until the new candidate passes validation and release promotion.
New in ScGeo 0.2.0: One command composes available cell-state, projected-velocity, PAGA, and stored evidence views, without rerunning an analysis:
import scgeo as sg
result = sg.pl.geometry_dynamics_atlas(adata, color="cell_type", panels="auto", show=False)
result.save("geometry_dynamics", formats=("pdf", "svg", "png"))
See the reproducible atlas gallery and input requirements.
Synthetic demonstration only: constructed display coordinates, projected vectors and topology; quantitative effects computed on the simulated representation. Reproduce the figure.
Flexible UMAP and projected-velocity comparisons are also available in the 0.2.0 API, without prescribing an experimental organism or design:
import scgeo as sg
result = sg.pl.embedding_facets(
adata, facet="condition", color="cell_type", velocity="stream",
return_result=True, show=False,
)
result.save("faceted_velocity", formats=("png", "svg", "pdf"))
Facet plotting guide · Reproducible faceting gallery
Explain a state shift with genes, programs, and response curves in the
0.2.0 API. After a sample-aware tl.robust_shift on an expression-linked
representation, tl.explain_shift checks the affine mapping and accounts for the
displacement using the same numerical center weights. Optional local groups retain
heterogeneous responses and per-sample composition; supplied signed regulons add
explicitly sourced target-response evidence.
explanation = sg.tl.explain_shift(adata, shift_key="robust_shift")
curves = sg.pl.shift_curves(
adata, var_names=["Gata1", "Spi1"], state="HSPC", basis="umap",
return_result=True, show=False,
)
curves.save("shift_response", formats=("png", "svg", "pdf"))
The example requires those gene/state names, matching PCA loadings, and the original expression input. Curves describe a geometric coordinate; ribbons show between-sample ranges. Contributions and signed target responses are descriptive evidence, not causal-driver estimates. Complete workflow and synthetic gallery.
For states enriched in one condition with sparse reference coverage, retain
expression maps and sample distributions with panels=("distribution", "expression").
PAGA composition views can use node_position="pooled" so their nodes and pies
remain visible without a supported reference-state center. See
sparse-state expression and PAGA pies.
The state response compass can now pair pooled state locations with stored displacement and alignment, individual sample frequencies, and explicit coverage. Its optional summary layout retains a sparse state while marking unsupported comparisons unavailable. Display-only changes do not alter the stored quantitative evidence.
Synthetic demonstration; the graph, display coordinates and velocities are constructed, not biological observations.
Start here
| Your goal | Best starting point |
|---|---|
| Analyze your own AnnData object | Quick start |
| Try ScGeo without downloading a dataset | Runnable synthetic example · Illustrated simulation guide · Tutorial notebooks |
| Build evidence figures and compare contrasts | Plotting guide and visual gallery |
| Display state connectivity, condition shifts, and velocity | PAGA shift-map guide |
| Combine a state map, stored evidence, and individual samples | State response compass |
| Compare conditions, timepoints, batches or cell types in matched UMAP/velocity facets | Embedding faceting |
| Inspect local projected velocity and compare conditions | Local velocity fields |
| Explain displacement with genes/programs and plot response curves | Shift explanations and curves |
| Compose UMAP, velocity, PAGA and evidence in one figure | Unified geometry–dynamics atlas |
| Interpret stored geometry–velocity agreement and compare condition fields | Geometry–velocity interpretation |
| Compare annotations with ribbons, chords, and density panels | State associations and density |
| Run plotting checks on public single-cell datasets | Real-data plotting gallery |
| Understand the framework and outputs | Overview and analysis layers |
| Explore the paper's datasets and figures | Companion workflows |
| Reproduce the published analyses | Frozen provenance |
| Cite the method or report your analysis | Citation and Methods guide |
Install
ScGeo 0.2.0 is available on PyPI (26 November 2026). Install or upgrade the core package:
python -m pip install --upgrade scgeo
For a reproducible Scanpy workflow, start in a fresh Python 3.12 environment:
python -m pip install "scgeo[scanpy]==0.2.0"
python -m pip check
For a version-pinned core install, use python -m pip install scgeo==0.2.0.
The wheel and source archive match the verified TestPyPI distributions; the
production CI passed a fresh PyPI install and dependency/smoke checks.
Release provenance and maintainer instructions are in the release checklist.
Optional notebook, scvelo, and census extras support additional workflows.
The installation guide
explains feature dependencies, Windows/macOS/Linux use, and development installs.
Prefer conda? Create the environment with conda and install the released package with pip:
conda create -n scgeo -c conda-forge python=3.12 pip
conda activate scgeo
python -m pip install "scgeo[scanpy]==0.2.0"
Native Bioconda publication is pending as of 17 November 2026; follow PR #70318. The command above installs the verified PyPI 0.2.0 release in a conda-managed environment. The existing Bioconda submission targets 0.1.0 and is tracked separately.
A first analysis
For an existing adata, this example expects condition, cell_type, and
sample in adata.obs, plus quantitative coordinates in adata.obsm["X_pca"].
Here sample identifies independent biological samples, and condition contains
control and treated. Replace these keys and labels with your own.
import scgeo as sg
sg.tl.robust_shift(
adata,
rep="X_pca",
condition_key="condition",
group0="control",
group1="treated",
by="cell_type",
sample_key="sample",
n_boot=500,
)
report = sg.get.state_report(adata, node_key="cell_type")
sg.pl.state_evidence_panel(report)
This first step estimates displacement and sample-level uncertainty in one representation. Add representation stability, local geometry, and dynamics when their inputs are available; the report keeps missing evidence visible. The full quick start includes synthetic input, expected output, and the next analysis steps.
Example output
Actual output from the synthetic example: 720 simulated cells, three states, four samples per condition, and one supplied representation. This illustrates the API, not a biological result. Bootstrap magnitude intervals summarize resampling uncertainty and are not significance tests.
Plotting examples
ScGeo 0.2.0 adds clearer PAGA shift maps with distinct condition
centres, local projected-velocity grids and streamlines, and stored alignment
colours. It also adds proportional chord diagrams, polished alluvial ribbons,
and density panels with explicit common or relative scales, alongside evidence
panels, biological-sample views, scoped styles, and source-data exports.
These additions require 0.2.0 or the corresponding source checkout, rather than the earlier scgeo==0.1.0 distribution. Use the
plotting guide
to reproduce the gallery.
Generated by the public-data example from CellRank's preprocessed pancreas E15.5 input. ScGeo reuses the supplied UMAP and fitted projected velocities; it does not refit kinetics or establish lineage. The real-data guide also demonstrates PBMC annotation chords, alluvial ribbons, and matched density panels with exact input hashes and source tables. The full gallery retains the controlled synthetic examples for PAGA contrasts, biological-sample views, and known support failures.
Questions ScGeo can help answer
| Question | Main function | Output to inspect |
|---|---|---|
| Which states moved between conditions? | tl.robust_shift |
displacement, normalized effect, sample-bootstrap uncertainty |
| Does the conclusion persist across representations? | tl.representation_stability |
agreement, coverage, leave-one-representation-out sensitivity |
| How much did local neighborhoods change? | tl.local_geometry_stability |
overlap, Jaccard, local distortion |
| Do shifts agree with supplied RNA-velocity estimates? | tl.velocity_shift_alignment |
alignment, discordance, unavailable evidence |
| Did composition or within-state distributions change? | tl.paga_composition_stats, tl.distribution_test |
separate abundance and distribution summaries |
| How can these results be reviewed together? | get.state_report, pl.state_evidence_panel |
one state-level report and separate evidence tracks |
See the API reference for parameters, optional dependencies, and public utilities.
Controlled benchmarks
The scgeo.bench module tests displacement, abundance, distributional shape,
local distortion, representation stability, uncertainty, and geometry–dynamics
agreement under known simulated perturbations. Calibration and held-out seeds
remain separate, with the protocol's frozen thresholds retained.
Two sample-design scenarios are particularly useful for interpreting results:
balanced_replicate_heterogeneity uses random sample offsets that are
zero-centered within each condition, testing uncertainty without a systematic
condition shift. batch_condition_confounding adds a systematic sample/batch
offset correlated with condition; that contrast is non-identifiable without
additional design information.
These simulations assess behavior under stated failure modes. They do not establish biological truth. See the frozen benchmark protocol for scenarios, evaluation rules, and provenance.
From the method to the paper
The study begins with post-irradiation hematopoietic recovery (GSE280305). Controlled simulations and public pancreas, inflammatory HSPC, and mouse-lung radiation workflows examine complementary aspects of the framework. The companion repository provides dataset entry points, analysis scripts, output maps, and evidence records.
For new analyses, use the released package and record its version. For paper
reproduction, use the recorded environments and frozen package checkpoint
9a0ed16.
See Reproducibility.
Interpretation that follows the study design
ScGeo analyzes representations you supply. Prespecify the biological contrast, sample unit, and quantitative representations; keep UMAP for display and treat nested PCA views as related sensitivity analyses. Read displacement, abundance, distributional change, and dynamics as distinct evidence. Analyses without valid biological-sample identities remain descriptive.
The labels stable_effect, stable_neutral, representation_unstable, and
insufficient_coverage describe the stored evidence rules. Their interpretation
depends on the design and available layers. See
Result interpretation.
Cite ScGeo
Liu Y-C, Yoshida K. ScGeo reveals non-canonical trajectories beyond RNA velocity in radiation-induced hematopoietic recovery. Bioinformatics Advances. 2026;6(1):vbag266. doi:10.1093/bioadv/vbag266.
BibTeX · RIS for reference managers · CITATION.cff · Methods reporting guide
Please cite the paper when using ScGeo and record the exact package version or commit, input provenance, and analysis settings. Cite the original datasets and upstream methods used in your workflow as well. The article DOI identifies the paper; no separate software-archive DOI is asserted here.
Questions and contributions
Use GitHub Issues for reproducible problems, documentation improvements, and feature suggestions. Include the ScGeo/Python versions, a minimal example, and the relevant AnnData keys and shapes. Small synthetic examples are especially useful for resolving problems. ScGeo is distributed under the MIT license.
Metadata
Release files for scgeo 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scgeo-0.2.1.tar.gz | 8.7 MB | With provenance | Details for scgeo-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scgeo-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for scgeo-0.2.1-py3-none-any.whl |
Total release size: 9.1 MB
Release files / scgeo-0.2.1.tar.gz
| Download URL | scgeo-0.2.1.tar.gz |
|---|---|
| Size | 8.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad68e4a8261cad89e238807a16f816fbd4f5021e712e6ef9eecee2e729ba0774
|
|
BLAKE2b-256 checksum How to use checksums |
84e852e4da4a6ba8250ceb683042a336c8c62b7056c53faa720c051501e46e52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / scgeo-0.2.1-py3-none-any.whl
| Download URL | scgeo-0.2.1-py3-none-any.whl |
|---|---|
| Size | 373.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb8c14b1545afc1e74ce2eb3260fe934ba3a1acdfd17695557ce776389957705
|
|
BLAKE2b-256 checksum How to use checksums |
5f1faacc8ec6d6b1e36db5fc31130332ae5b689663e4a6057ebefc8540e1af79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for scgeo 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for scgeo-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.