Skip to main content

Spatial query tools for analyzing spatial transcriptomics data

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spatialquery-0.0.5.tar.gz (117.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spatialquery-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

spatialquery-0.0.5-cp312-cp312-macosx_11_0_arm64.whl (376.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

spatialquery-0.0.5-cp312-cp312-macosx_10_13_x86_64.whl (399.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

spatialquery-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

spatialquery-0.0.5-cp311-cp311-macosx_11_0_arm64.whl (374.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

spatialquery-0.0.5-cp311-cp311-macosx_10_9_x86_64.whl (394.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

spatialquery-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

spatialquery-0.0.5-cp310-cp310-macosx_11_0_arm64.whl (373.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

spatialquery-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl (393.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file spatialquery-0.0.5.tar.gz.

File metadata

  • Download URL: spatialquery-0.0.5.tar.gz
  • Upload date:
  • Size: 117.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spatialquery-0.0.5.tar.gz
Algorithm Hash digest
SHA256 92aa1af0c5e3ea9b420ec1fc6cb07b7bbe27cd99b4cc32f5ed249b369c5b8d8d
MD5 b1cbfb0585befe6ee2ee3d48aeba8462
BLAKE2b-256 2b0721a61d92bac3a5f2c8f92744ae26c22b9e8d177d50777a4d3e3b85d76465

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5.tar.gz:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f777f952ec549ab3f02e7e464797cf7f80d91ad7dcb8f17dd400255a302bdc3b
MD5 f8a54d3b14cbc559e819886e3e5a40cb
BLAKE2b-256 42f8951302f46ac53a85a7427e25c5e1b3d11950698e488ca844e81d81c042d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 91b9ac3ee3869232b0bd98147204de2899a2a61fa937cd56e5012bf43409e197
MD5 3972939384dab358451b22a0a16d580e
BLAKE2b-256 3daea8afdb84f239dafb2332bbea62460621d9d99340801a78e4277bfcfe8878

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b0ffa3a733669ab89c45370b60bf8fac101d8a4fb1a3ed1a3a111a8feeb2a7d4
MD5 fce4997418afdd951308594f619bea55
BLAKE2b-256 8a0b9437e1086fe90d03c4ed0101b7a22ef0710c32fa085f30c4f8702ead57a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e6e651e7837dfc64d017b6f8b2520211d03a0b137343daace84a74d951b53bf
MD5 239508518a807106d74d76dd27010c62
BLAKE2b-256 936b9375f174d8cefebd4d1ddaff1b3eef34f79f4f80003325f0f6cffc623426

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea4e542c610727b99ea988555199f1623e7a9239367fdaf09596755510dfc045
MD5 4a68e912bf9009114b5f8b364c61269b
BLAKE2b-256 86c5d8de3a8f28beb10faa2a96d9b354eedd28d7a8ebdf7b695ae9a6f48b4dd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2e62acd68f3c0c98b50d0f43e724d3e7d01365daed89f177404556bf73b071d3
MD5 96c0404de2c65ac11450ddb66faf8616
BLAKE2b-256 cacfa0d3b5d71fdd36831d0ba6437bde9b6113d8edb082c9aff968990c451590

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a9ffb370c647c67594111ab424429893779818e32312df9c84a3246ad6109d48
MD5 f0ee07b86a66efa387931f6c77e86145
BLAKE2b-256 4eec0da7c5e97a636f4f7e06b5865bb573cba35111a3f4ebd4a499dfba235d74

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a5dd66856d0723e2bc14a794f3661ae00d0c1433c6cf00d7f29c731c561bcb0
MD5 8382e426ab9060b1623efd430a271250
BLAKE2b-256 05d0d444e41eda1079b409c434cf6e820438fca15f578e6c1abe40b8b11a7dbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spatialquery-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8bbbc2c5731be7799d736afb186ec187adcce6cfb18f47df0f4d205466c21cfe
MD5 caedf2eb34d3bc8aded428ac3f4ff936
BLAKE2b-256 8fba8729b239555305b7f366add91fa8e1809e787f6a14e1e87a01fcf506478b

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl:

Publisher: build_wheels.yml on ShaokunAn/Spatial-Query

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page