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/

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.4.tar.gz (116.5 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.4-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.4-cp312-cp312-macosx_11_0_arm64.whl (375.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

spatialquery-0.0.4-cp312-cp312-macosx_10_13_x86_64.whl (399.1 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

spatialquery-0.0.4-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.4-cp311-cp311-macosx_11_0_arm64.whl (374.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

spatialquery-0.0.4-cp311-cp311-macosx_10_9_x86_64.whl (394.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

spatialquery-0.0.4-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.4-cp310-cp310-macosx_11_0_arm64.whl (373.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

spatialquery-0.0.4-cp310-cp310-macosx_10_9_x86_64.whl (393.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for spatialquery-0.0.4.tar.gz
Algorithm Hash digest
SHA256 92b634231ec0545f0a21c48f729ae31a6f8740bc537fd1fb54d29aa53e310b27
MD5 038076cb273ca189c17cbdfa640e1ea9
BLAKE2b-256 2524ad9ed8f38f8f92690905040a70d2d9fdfae8d877b155d705c2847ea267a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4.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.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de97aaf4bef262e17f214c1926f4ff3450800b69f7207b2aa95c52b811017586
MD5 e83c5a75432fe92896491ea651b0961d
BLAKE2b-256 424e685c9deb1203c2ae44e5ee49952d87a10a03022e1d39b1d059762f5ad4fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22bfaec880038d7673d51a816f7cef321b511a049618982ca2bfa84a0f906ffb
MD5 36d2fa4f68b1fd4db6e1b407a0a993d0
BLAKE2b-256 16f821b3087f360f78030a976da1d69bfaa3014dbfbf03ee98e3bd2cf58a9493

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b9c1fcce04abe1a03c5a4d9c35ee7b682e531387d7f51d9317cd727e96ddfabc
MD5 a85a96d3213245333ee708337f04fe62
BLAKE2b-256 6117f3a3e2958e8061ec157b3659d01df13c412d8a219558c4dba591d5932277

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a3f7e94297b73f8188cffecc3ed5e95168b93bdc5010ed9fa0664a12de1c8c43
MD5 783436eaebd89dc7144cdccf37675fed
BLAKE2b-256 2a536a255fc612acca8282804fabc377ca4acbba742ca5fd61640b7ce988e5f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 78cf90697d7b2c6ed3a1b117bfabf35ab41b40568cfe86fa6d61d2fd89badc2a
MD5 6f2e687e050b8c9ae76e4345bd764418
BLAKE2b-256 c8cb9406b6053192b88773d8735d5e01d69d3d2252e9c1fc7a8b4a3f6bd2ddfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df13708f361329908243116a5ff92acc60dcf422af9dc8d6969a2e224853c8d2
MD5 90f7e4073b67817af5b3c796cae0d13d
BLAKE2b-256 e5eae5c3871c279a4c04c255f9a5ee82bda2bcf714fa5b3b692803f6131298a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ec9d87ae17bffd2530cb5448d245d46da442e307e853986163976594c58ae24a
MD5 1efacc411f3e96ca55a8b6dde4a6c264
BLAKE2b-256 d0dc86007a2264c307fe0c2e48b5b73a2f40a1c8269bb6f13b2c5dfeb7682de3

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d440795a7255a7b5baeb5b5a5bfd9ec8f4ed6cda861ed7e22d4114a67dd85a57
MD5 3aedf23bded9449d464acc9164a9f07d
BLAKE2b-256 880bc7ac322d580e869f2d2ac96d8b0ce4de9c4d39fb6e7d3a59142bb3a1ea4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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.4-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for spatialquery-0.0.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04b6de26276d56844f24f5194e3323319e498358bdda10f084c7a226bf3efb33
MD5 a46b25102cdfdfa91a74a6b4a0a0d764
BLAKE2b-256 834874fd44330caa63651514024cbaa99980de142ae9650097acc7183825e3ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for spatialquery-0.0.4-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