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

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.6
File Size Uploaded Provenance Actions
spatialquery-0.0.6.tar.gz 126.9 kB With provenance Details for spatialquery-0.0.6.tar.gz

Built distributions (wheels)

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

Total release size: 20.8 MB

Release files / spatialquery-0.0.6.tar.gz

Download URL spatialquery-0.0.6.tar.gz
Size 126.9 kB
Tags Source
SHA-256 checksum
How to use checksums
268f667e2cada4d823752cb09528ce9bb2978f38ec4517010957b4dceccfeff8
BLAKE2b-256 checksum
How to use checksums
5947ea96d6a08ebc4f451940df528f9016ea3be99db64f8b62d78eae992f2637
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-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
bdc0fa0c0bbdb5da3b66bbb7189f13a90cd502fc410aa5a2f2d4399054428f06
BLAKE2b-256 checksum
How to use checksums
ffb52462f66e2f286ed835fa4806c1bf231cfaab3c2db58ef3e58c91ebc537b9
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-cp312-cp312-macosx_11_0_arm64.whl
Size 390.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0c8e905a1575c867239f6b8bd95369805c0dbeb8609a5bf33da065a69fed67c5
BLAKE2b-256 checksum
How to use checksums
511d865a408fccff734cf36eb3ce0d764e42e1b21306e180def46ee987d17a0c
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-cp312-cp312-macosx_10_13_x86_64.whl
Size 409.9 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
cd6f17000a24c9741cd083e6bbbfac1ee608c0469a30a218817921636ef9d402
BLAKE2b-256 checksum
How to use checksums
74c6aa6a228040ab6e506c3eac26926e3eabb76c124ff1ac6d62036b3ef974e4
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-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
5f2ea9379c9bd51252d4f1652bd6088f7767e9272314f18280b12712fe5765d1
BLAKE2b-256 checksum
How to use checksums
aa88d9c0c4294b2d35aeba89cf1c477089d32e2543cb95a14757560b1559d4d5
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-cp311-cp311-macosx_11_0_arm64.whl
Size 389.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0f2e4838ad5e418c6c7d9f358ba2a5f87c0e4cbed14614aa5b9cd1b76bbd289
BLAKE2b-256 checksum
How to use checksums
306ad6a8951dc35085809a3663ae999a8650a3b754ae4c4c2528db309fcb9a67
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-cp311-cp311-macosx_10_9_x86_64.whl
Size 406.4 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
0ecb8938f3a9fa24ddecab7c3342cfcd9d3c7443118ce41633795213187c6cc5
BLAKE2b-256 checksum
How to use checksums
e70bae7cf17885b931bd973223e8c8c72b0a3582962dbd3ae1b97dca06589891
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-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
460ef8c0a783d1aa3a4d4ba352ed3eb4e06044875d494115728df0b15a1bbe4f
BLAKE2b-256 checksum
How to use checksums
9589527659a3629b48ce51b41cd2028df7b472b246028ea3eaade33fbf895603
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-cp310-cp310-macosx_11_0_arm64.whl
Size 388.3 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fe04552c9b5059165d6c7258dc80002472627281ee794d389a922c9d48504346
BLAKE2b-256 checksum
How to use checksums
d5bbd4ab7c1bb8d194a8790f008e8c3f925d932104fdab999c3d1150b7958872
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 Oct 18, 2026.

Transparency log

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

Download URL spatialquery-0.0.6-cp310-cp310-macosx_10_9_x86_64.whl
Size 404.7 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
b834bcf183b104fff86f69ada7f02184cf11de11ed49e3fc5f9f46b085524b0c
BLAKE2b-256 checksum
How to use checksums
0d8252ab94ebef33ee8c2891485a2f2025d2f8ef8e7f0f993dc2ea659504de92
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 Oct 18, 2026.

Transparency log

Security for SpatialQuery 0.0.6

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.6.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 18, 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