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.
- Mouse organogenesis — single-FOV analysis (seqFISH)
- Kidney disease atlas — multi-condition analysis (MERFISH)
- Colorectal cancer microenvironment — spatial proteomics (CODEX)
- Whole-brain atlas — large-scale analysis (MERFISH)
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
- Author: Shaokun An
- Email: shaokunan1@gmail.com
- GitHub: ShaokunAn
Metadata
Release files for SpatialQuery 0.0.8
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 |
|---|---|---|---|---|
| spatialquery-0.0.8.tar.gz | 131.9 kB | With provenance | Details for spatialquery-0.0.8.tar.gz |
Built distributions (wheels)
Total release size: 20.9 MB
Release files / spatialquery-0.0.8.tar.gz
| Download URL | spatialquery-0.0.8.tar.gz |
|---|---|
| Size | 131.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75afee9d44dc16c64d03806c40ed89039caf8f53699d6fe4cc4f8eb15e62cf30
|
|
BLAKE2b-256 checksum How to use checksums |
db8887c3eabbe48852d2cbf1a1951d61b20e964183798a4673ac94d3cd0af850
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | spatialquery-0.0.8-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 |
0a9aadbb345c06bf9f44407bfea0ee1f5e15a661de4c145f652208e5ac8b8176
|
|
BLAKE2b-256 checksum How to use checksums |
354ec401c737e593c186cff55046ea40ee3ee80a7679c22930e0c8b4bf5e1533
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | spatialquery-0.0.8-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 395.1 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ada6d11cb80c3eb2d2ca8d27543bd143f3b1f4c327e53d0cff95d53e95be6276
|
|
BLAKE2b-256 checksum How to use checksums |
dae3ebc6fa0478a77962c1170969febf3de1ce91d71176093f600667534d58cc
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | spatialquery-0.0.8-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 415.0 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
7ff45ddd51cc79fc877d0873641cffd8f71f3196d0f2730b2b04ca85f33c8493
|
|
BLAKE2b-256 checksum How to use checksums |
35ac1308541aab7f19ae525a1c683937fc9975a3c4055147483d4a330e3bd8aa
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | spatialquery-0.0.8-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 |
9993bc4324f66e1531f6acbd3c8468fb0d928eb086059c1fb2493ebbee45f648
|
|
BLAKE2b-256 checksum How to use checksums |
11011b2375b47c84567a58d9924071feb9288768987a50f965556ce6dec8e626
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | spatialquery-0.0.8-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 394.5 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
059414e5c50b71ebc5bbef36d09d9262095371a4b7f4ee507549c3dc7b82d420
|
|
BLAKE2b-256 checksum How to use checksums |
12a28c9f4d65f2cb0d10e86ed94fffe51685344c133f09e226df522e6967928d
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | spatialquery-0.0.8-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 411.5 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
67b1c73054255c20998c736fc54316c4bb55e6bf1412a85fef5d2b0cc5d84d78
|
|
BLAKE2b-256 checksum How to use checksums |
e97476c34c68634229816fad902d35e2a6858146241f54db8827589094349bc1
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | spatialquery-0.0.8-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 |
b78a3ae6d4fb59dee0ee5273e5857ee33e13bce81887f5c6d755fc41fef172b1
|
|
BLAKE2b-256 checksum How to use checksums |
16f157c802c592c17c22279b1a7b72c7f927008a422c4cd79b007148e26daee9
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | spatialquery-0.0.8-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 393.4 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
afd21c6a72a5dee61052cbcd76fecae10daea74e41b9997f6f8ca339b2c00487
|
|
BLAKE2b-256 checksum How to use checksums |
411934a3edb8d05b5602bba71fde450845db44627f00a80eb80b1aca30119d37
|
| 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 Nov 22, 2026.
Transparency logRelease files / spatialquery-0.0.8-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | spatialquery-0.0.8-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 409.8 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
f18be07c7eccb9be54fc2e1bec6612f0351c740d33cc9d3bbfc7a0f9c6fb5878
|
|
BLAKE2b-256 checksum How to use checksums |
6c6c4fdd817b6e3ba4d1f6e7abb29c9bd8998f20ba62431fe5efc008b4a1732a
|
| 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 Nov 22, 2026.
Transparency logSecurity for SpatialQuery 0.0.8
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.
Attestation for spatialquery-0.0.8.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 22, 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.