Skip to main content

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

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:

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)

License

MIT

Contact

Release files for SpatialQuery 0.0.5

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.5
File Size Uploaded
spatialquery-0.0.5.tar.gz 117.0 kB Details

Built distributions (wheels)

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

Total release size: 20.5 MB

Release files / spatialquery-0.0.5.tar.gz

Download URL spatialquery-0.0.5.tar.gz
Size 117.0 kB
Tags Source
SHA-256 checksum
How to use checksums
92aa1af0c5e3ea9b420ec1fc6cb07b7bbe27cd99b4cc32f5ed249b369c5b8d8d
BLAKE2b-256 checksum
How to use checksums
2b0721a61d92bac3a5f2c8f92744ae26c22b9e8d177d50777a4d3e3b85d76465
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.1 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f777f952ec549ab3f02e7e464797cf7f80d91ad7dcb8f17dd400255a302bdc3b
BLAKE2b-256 checksum
How to use checksums
42f8951302f46ac53a85a7427e25c5e1b3d11950698e488ca844e81d81c042d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp312-cp312-macosx_11_0_arm64.whl
Size 376.1 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
91b9ac3ee3869232b0bd98147204de2899a2a61fa937cd56e5012bf43409e197
BLAKE2b-256 checksum
How to use checksums
3daea8afdb84f239dafb2332bbea62460621d9d99340801a78e4277bfcfe8878
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp312-cp312-macosx_10_13_x86_64.whl
Size 399.4 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
b0ffa3a733669ab89c45370b60bf8fac101d8a4fb1a3ed1a3a111a8feeb2a7d4
BLAKE2b-256 checksum
How to use checksums
8a0b9437e1086fe90d03c4ed0101b7a22ef0710c32fa085f30c4f8702ead57a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6e6e651e7837dfc64d017b6f8b2520211d03a0b137343daace84a74d951b53bf
BLAKE2b-256 checksum
How to use checksums
936b9375f174d8cefebd4d1ddaff1b3eef34f79f4f80003325f0f6cffc623426
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp311-cp311-macosx_11_0_arm64.whl
Size 374.7 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ea4e542c610727b99ea988555199f1623e7a9239367fdaf09596755510dfc045
BLAKE2b-256 checksum
How to use checksums
86c5d8de3a8f28beb10faa2a96d9b354eedd28d7a8ebdf7b695ae9a6f48b4dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp311-cp311-macosx_10_9_x86_64.whl
Size 394.5 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
2e62acd68f3c0c98b50d0f43e724d3e7d01365daed89f177404556bf73b071d3
BLAKE2b-256 checksum
How to use checksums
cacfa0d3b5d71fdd36831d0ba6437bde9b6113d8edb082c9aff968990c451590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a9ffb370c647c67594111ab424429893779818e32312df9c84a3246ad6109d48
BLAKE2b-256 checksum
How to use checksums
4eec0da7c5e97a636f4f7e06b5865bb573cba35111a3f4ebd4a499dfba235d74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
Size 373.7 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2a5dd66856d0723e2bc14a794f3661ae00d0c1433c6cf00d7f29c731c561bcb0
BLAKE2b-256 checksum
How to use checksums
05d0d444e41eda1079b409c434cf6e820438fca15f578e6c1abe40b8b11a7dbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

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

Download URL spatialquery-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl
Size 393.6 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
8bbbc2c5731be7799d736afb186ec187adcce6cfb18f47df0f4d205466c21cfe
BLAKE2b-256 checksum
How to use checksums
8fba8729b239555305b7f366add91fa8e1809e787f6a14e1e87a01fcf506478b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.5 This release

10 release files

0.0.2

2 release files

0.0.1

2 release files

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