Skip to main content

SpatialQuery

SpatialQuery

SpatialQuery is a Python package for systematic spatial analysis of single-cell resolution spatial omics data. It provides a unified framework to discover, quantify, and compare recurring spatial cell type patterns — termed motifs — across single or multiple fields of view (FOVs).

Starting from annotated spatial omics datasets (spatial transcriptomics and spatial proteomics data), SpatialQuery constructs cell neighborhoods using KNN or distance-based approaches and mines frequent cell type co-occurrence patterns via the FP-Growth algorithm. It then tests whether these motifs are statistically enriched beyond what is expected by chance, and supports comparison of motif compositions across biological conditions (e.g., healthy vs. disease) through differential motif analysis.

Beyond spatial structure, SpatialQuery links motifs to molecular phenotypes. For cells participating in a given motif, it performs motif-associated differential expression analysis to identify genes whose expression differs between motif-positive and motif-negative cells or across conditions. It further detects cross-cell gene-gene covariation — spatially dependent correlations between gene expression in anchor cells and their neighbors — to reveal intercellular signaling relationships that are specific to particular spatial contexts.

Key capabilities include:

  • Spatial motif discovery: Identify frequent cell type patterns in local neighborhoods
  • Motif enrichment analysis: Statistically test whether motifs occur more than expected
  • Motif composition: Quantify the relative abundance of each motif cell type within motif-positive neighborhoods
  • Differential motif analysis: Compare spatial compositions across conditions
  • Motif-associated differential expression: Find DE genes linked to specific motifs
  • Cross-cell gene-gene covariation: Detect spatially dependent intercellular gene correlations
  • Multi-FOV support: Pool and compare results across multiple tissue sections or samples

Installation

pip install SpatialQuery

Note: Installation typically takes ~5 minutes depending on your environment.

Documentation

Full documentation, tutorials, and API reference: https://spatialquery.readthedocs.io/en/latest/

Reproducibility

The following tutorials reproduce the main analyses presented in our manuscript. Each tutorial takes approximately 5–20 minutes to run depending on dataset size and hardware.

Quick Start

from SpatialQuery import spatial_query

# Single FOV analysis
sq = spatial_query(adata, spatial_key="X_spatial", label_key="cell_type", feature_name="gene")
enrich_motif = sq.motif_enrichment_dist(ct="T_cell", max_dist=10, min_support=0.5)
from SpatialQuery import spatial_query_multi

# Multi-FOV analysis
spm = spatial_query_multi(adatas=adatas, datasets=datasets,
                          spatial_key="X_spatial", label_key="cell_type", feature_name="gene")
enrich_motif = spm.motif_enrichment_dist(ct="T_cell", dataset="healthy", max_dist=10, min_support=0.5)

Citation

If you use SpatialQuery in your research, please cite:

An, S. et al. SpatialQuery: scalable discovery and molecular characterization of multicellular motifs from spatial omics data. bioRxiv (2026).

License

MIT

Contact

Metadata

Release files for SpatialQuery 0.0.7

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

Source distribution (sdist)

Source distribution for SpatialQuery 0.0.7
File Size Uploaded Provenance Actions
spatialquery-0.0.7.tar.gz 126.6 kB With provenance Details for spatialquery-0.0.7.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for SpatialQuery 0.0.7
File Actions
spatialquery-0.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for spatialquery-0.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
spatialquery-0.0.7-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for spatialquery-0.0.7-cp312-cp312-macosx_11_0_arm64.whl
spatialquery-0.0.7-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details for spatialquery-0.0.7-cp312-cp312-macosx_10_13_x86_64.whl
spatialquery-0.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for spatialquery-0.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
spatialquery-0.0.7-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for spatialquery-0.0.7-cp311-cp311-macosx_11_0_arm64.whl
spatialquery-0.0.7-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details for spatialquery-0.0.7-cp311-cp311-macosx_10_9_x86_64.whl
spatialquery-0.0.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for spatialquery-0.0.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
spatialquery-0.0.7-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for spatialquery-0.0.7-cp310-cp310-macosx_11_0_arm64.whl
spatialquery-0.0.7-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details for spatialquery-0.0.7-cp310-cp310-macosx_10_9_x86_64.whl

Total release size: 20.8 MB

Release files / spatialquery-0.0.7.tar.gz

Download URL spatialquery-0.0.7.tar.gz
Size 126.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e1ea40b283e7bbae94a961c01bf7b94ac6a9a9acca8406b72dccd7f0ecbc0796
BLAKE2b-256 checksum
How to use checksums
11a59d6b69dcf97866d23776698b94d2682d04249bbc34f100cade90700bfc85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL spatialquery-0.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.2 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c996cc0c0e53b403a3e15319a7f0eac271aac271e74b127d52033313e75b941b
BLAKE2b-256 checksum
How to use checksums
adaf271cad4189b435f733efa3e734fe0e369b7607898495f8070770c3defd5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp312-cp312-macosx_11_0_arm64.whl

Download URL spatialquery-0.0.7-cp312-cp312-macosx_11_0_arm64.whl
Size 389.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
25d259e7ecbc4b3b4ffdb82591f9deed71f527c89c5120e778634a201dda30be
BLAKE2b-256 checksum
How to use checksums
cebcad004b92dcd7d1a75086fad66bce88d23624fc2a23f547e6ee55e4907ea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp312-cp312-macosx_10_13_x86_64.whl

Download URL spatialquery-0.0.7-cp312-cp312-macosx_10_13_x86_64.whl
Size 409.6 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
f3bb622c4e4ddfaefc1acdf7609c3194d33dc32db0f20e3c54af6f48b281380a
BLAKE2b-256 checksum
How to use checksums
7e0b8d086c44aa22ef6c01a135edf41446d98704709287025c9894c5db8ce246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL spatialquery-0.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.1 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
bbe4ef907479b6ca898cfa74bf32c365016ad4c2b07ff2cb755151c2817dfe1a
BLAKE2b-256 checksum
How to use checksums
58ac8e091720b339d1d06825f23e07cb9554594b4e4e71b74b7eca0702ed8d9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp311-cp311-macosx_11_0_arm64.whl

Download URL spatialquery-0.0.7-cp311-cp311-macosx_11_0_arm64.whl
Size 389.1 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b50701e108fcf8e3e4bad3aba467c8653a285811e5846cc0d315414aeeb971a4
BLAKE2b-256 checksum
How to use checksums
33fd46b6fc79541ba8516a94d8425e18b4e0dede66e973de0284d58422cfbcd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp311-cp311-macosx_10_9_x86_64.whl

Download URL spatialquery-0.0.7-cp311-cp311-macosx_10_9_x86_64.whl
Size 406.2 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
77534ca3849a34e6d20d1b9a33314707360bdd7241fbf7fd256b70c478f82338
BLAKE2b-256 checksum
How to use checksums
e89169234b427f0acfe69d1d15378ff77524e3e21ca613a1cef8ff0442ce9035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL spatialquery-0.0.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.1 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b4c06b76679f3dd3966647a97fd0289fe8865513eb1a5c64c03a3ff5ec564384
BLAKE2b-256 checksum
How to use checksums
17376705b3ab8ce1eccf292a6ce652f9a29d8c8b13bc2a393b94a86a48549e30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp310-cp310-macosx_11_0_arm64.whl

Download URL spatialquery-0.0.7-cp310-cp310-macosx_11_0_arm64.whl
Size 388.0 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e222406c4d9ca50c80e9865a507411033e3f0dc2ddb407861b3783df71e2540f
BLAKE2b-256 checksum
How to use checksums
1c66c2eacc9fbf7d1e65d177d10e1715e693765ce11b6e9df1c610cd9b9e79fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / spatialquery-0.0.7-cp310-cp310-macosx_10_9_x86_64.whl

Download URL spatialquery-0.0.7-cp310-cp310-macosx_10_9_x86_64.whl
Size 404.5 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
26ae1af6b8a4abe335773e9a259bcac32b0c75c86d8f1fc0be505e490b1eb742
BLAKE2b-256 checksum
How to use checksums
6fb7374b78d615e47847386fddefd3d2c664a77014c0ba23885e686e7b0a78a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Security for SpatialQuery 0.0.7

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

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for spatialquery-0.0.7.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 Oct 21, 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