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.
With the analytical testing method, SpatialDM is scalable to 1 million spots within 12 min with only one core.
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/leeyoyohku/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
import spatialdm.plottings as pl
adata = sdm.datasets.melanoma()
raw = pd.DataFrame(adata.raw.X, index=adata.obs_names, columns=adata.var_names)
log = pd.DataFrame(adata.X, index=adata.obs_names, columns=adata.var_names)
spatialcoord = pd.DataFrame(adata.obsm['spatial'], index=adata.obs_names, columns=['x','y'])
# Preprocessing
my_sample = sdm.SpatialDM(log, raw, spatialcoord) # load spatial data with simply log, raw, spatial input
my_sample.extract_lr(species='human', min_cell=3)
my_sample.weight_matrix(l=1.2, cutoff=0.2, single_cell=False) # Not single-cell resolution
# Global selection of significant pairs
my_sample.spatialdm_global(1000, select_num=None, method='permutation') # complete in seconds
my_sample.sig_pairs(method='permutation', fdr=True, threshold=0.1) # select significant pairs
pl.global_plot(my_sample, pairs=['CSF1_CSF1R']) # Overview of global selection
# Local selection of significant spots
my_sample.spatialdm_local(n_perm=1000, method='both', select_num=None, nproc=1) # local spot selection complete in seconds
my_sample.sig_spots(method='permutation', fdr=False, threshold=0.1) # significant local spots
pl.plot_pairs(my_sample, ['CSF1_CSF1R'], marker='s') # visualize known melanoma pair(s)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SpatialDM-0.0.4.tar.gz.
File metadata
- Download URL: SpatialDM-0.0.4.tar.gz
- Upload date:
- Size: 40.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b651c8cdd177a33145e35601ebd78f4a0af1a22c0175217cd7f01bbb8793965c
|
|
| MD5 |
7512da40e68aaf14328b6658603d68fb
|
|
| BLAKE2b-256 |
5a0ae9aadae12da5618e2b2466f885507fecd463179d0c321bf63e63abe6ec7e
|
File details
Details for the file SpatialDM-0.0.4-py3-none-any.whl.
File metadata
- Download URL: SpatialDM-0.0.4-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5e7e42e102cf55a72b8abc27a549bb2cf370574acd3e3ec1ccf5105cc6d2036
|
|
| MD5 |
dee45a6c127e46d14cfb18c0556230b9
|
|
| BLAKE2b-256 |
cb80dd7c21e2247d509fa120ec84c6ca9892f1940c1503adff93e2c5f11e89c8
|