Skip to main content

SpatialDM: Spatial co-expression Detected by bivariate Moran

Project description

About

SpatialDM (Spatial Direct Messaging, or Spatial co-expressed ligand and receptor Detected by Moran’s bivariant extension), a statistical model and toolbox to identify the spatial co-expression (i.e., spatial association) between a pair of ligand and receptor.

Uniquely, SpatialDM can distinguish co-expressed ligand and receptor pairs from spatially separating pairs, and identify the spots of interaction.

https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/AvsB-1.png?raw=true

With the analytical testing method, SpatialDM is scalable to 1 million spots within 12 min with only one core.

https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/runtime_aug16-1.png?raw=true

It comprises two main steps: 1) global selection spatialdm_global to identify significantly interacting LR pairs; 2) local selection spatialdm_local to identify local spots for each interaction.

Installation

SpatialDM is available through PyPI. To install, type the following command line and add -U for updates:

pip install -U SpatialDM

Alternatively, you can install from this GitHub repository for latest (often development) version by the following command line:

pip install -U git+https://github.com/StatBiomed/SpatialDM

Installation time: < 1 min

Quick example

Using the build-in melanoma dataset as an example, the following Python script will compute the p-value indicating whether a certain Ligand-Receptor is spatially co-expressed.

import spatialdm as sdm
adata = sdm.datasets.dataset.melanoma()
sdm.weight_matrix(adata, l=1.2, cutoff=0.2, single_cell=False) # weight_matrix by rbf kernel
sdm.extract_lr(adata, 'human', min_cell=3)      # find overlapping LRs from CellChatDB
sdm.spatialdm_global(adata, 1000, specified_ind=None, method='both', nproc=1)     # global Moran selection
sdm.sig_pairs(adata, method='permutation', fdr=True, threshold=0.1)     # select significant pairs
sdm.spatialdm_local(adata, n_perm=1000, method='both', specified_ind=None, nproc=1)     # local spot selection
sdm.sig_spots(adata, method='permutation', fdr=False, threshold=0.1)     # significant local spots

# visualize global and local pairs
import spatialdm.plottings as pl
pl.global_plot(adata, pairs=['SPP1_CD44'])
pl.plot_pairs(adata, ['SPP1_CD44'], marker='s')
https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/global_plot.png?raw=true https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/SPP1_CD44.png?raw=true

Detailed Manual

The full manual is at https://spatialdm.readthedocs.io, including:

References

SpatialDM manuscript with more details is available on bioRxiv now and is currently under review.

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

SpatialDM-0.2.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

SpatialDM-0.2.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file SpatialDM-0.2.0.tar.gz.

File metadata

  • Download URL: SpatialDM-0.2.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/7.0.1 pkginfo/1.9.6 requests/2.25.1 requests-toolbelt/1.0.0 tqdm/4.61.2 CPython/3.9.18

File hashes

Hashes for SpatialDM-0.2.0.tar.gz
Algorithm Hash digest
SHA256 961007369246f94d5f08d8539377bfd4338f0866f5ff145e256a85dd7c5b611a
MD5 044faf4e4b79767adecd9a881f5d17e9
BLAKE2b-256 ae82c14993592d15a444ca78a92cefeec42efba0f541cc837cb761266b1e43d7

See more details on using hashes here.

File details

Details for the file SpatialDM-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: SpatialDM-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/7.0.1 pkginfo/1.9.6 requests/2.25.1 requests-toolbelt/1.0.0 tqdm/4.61.2 CPython/3.9.18

File hashes

Hashes for SpatialDM-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9747a25a382c7a402cb0504a7eff24314f508a037b5935c2c4fab76e0f43fcb8
MD5 0cd2dfe5660e56507533fa3eb7fc763e
BLAKE2b-256 f9418708c0e50e0ec50b4a9e532eb5626a430cc11e4d7c5638f1e12cc0c31d0f

See more details on using hashes here.

Supported by

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