Skip to main content

ScGeo logo

ScGeo

Quantify cell-state shifts across conditions and representations.

PyPI Paper DOI Python License: MIT

Quick start · Installation · API reference · Plotting gallery · 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.

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.

Actual ScGeo unified atlas rendered from a fully synthetic example

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 stored-evidence compass with sample frequencies and explicit coverage

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
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

0.2.0 release line. Once production publication is verified on PyPI, install it in a fresh Python 3.12 environment:

python -m pip install "scgeo[scanpy]==0.2.0"
python -m pip check

For core geometry and plotting, use python -m pip install scgeo==0.2.0 after production verification. Release maintainers can follow the release checklist. Before 0.2.0 is published, the existing PyPI 0.1.0 release remains available; to use the new features immediately, install the reviewed source checkout with python -m pip install . (or pin a full commit SHA as described in the installation guide). 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 is the conda-managed route once 0.2.0 is published; the earlier PyPI 0.1.0 release and its Bioconda submission are unchanged.

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

ScGeo synthetic example: State A has a larger estimated displacement than State B and State C, with sample-bootstrap interval displays.

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.

Actual ScGeo development output on 2,531 public pancreas cells: supplied projected velocity shown as grid arrows and supported streamlines.

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scgeo 0.2.0
File Size Uploaded Provenance Actions
scgeo-0.2.0.tar.gz 8.7 MB With provenance Details for scgeo-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scgeo 0.2.0
File Interpreter ABI Platform Actions
scgeo-0.2.0-py3-none-any.whl Python 3 none any Details for scgeo-0.2.0-py3-none-any.whl

Total release size: 9.1 MB

Release files / scgeo-0.2.0.tar.gz

Download URL scgeo-0.2.0.tar.gz
Size 8.7 MB
Tags Source
SHA-256 checksum
How to use checksums
2bdcf4720b068bff7c03d282ec6dcab4a4d494376de8edcf096dc1732d1b9546
BLAKE2b-256 checksum
How to use checksums
4b3f7c17334712ea65ff139c0057b2042ee409db7ae9e40c022b4d1ec40570f3
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 26, 2026.

Transparency log

Release files / scgeo-0.2.0-py3-none-any.whl

Download URL scgeo-0.2.0-py3-none-any.whl
Size 371.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
105fe2e702ff995a1b46a9f09a5346a784175f9e75c03edf978bc7c728507a37
BLAKE2b-256 checksum
How to use checksums
f1bb4ef944926411d63265a617e96d4dcc5c9fc2fc1a485daba14c7c8bafda03
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 26, 2026.

Transparency log

Security for scgeo 0.2.0

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.

Select from 2 files

Attestation for scgeo-0.2.0.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 26, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page