SpatialDM


NameSpatialDM JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/StatBiomed/SpatialDM
SummarySpatialDM: Spatial co-expression Detected by bivariate Moran
upload_time2025-07-16 08:24:33
maintainerNone
docs_urlNone
author['Zhouxuan Li', 'Tianjie Wang', 'Yuanhua Huang']
requires_pythonNone
licenseApache-2.0
keywords spatial transcriptomics spatial association ligand-recptor interaction
VCS
bugtrack_url
requirements anndata scanpy SparseAEH numpy scipy statsmodels pandas h5py matplotlib holoviews seaborn selenium scikit-learn hilearn threadpoolctl
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===============================================================
SpatialDM: Spatial Direct Messaging Detected by bivariate Moran
===============================================================

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.

.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/AvsB-1.png?raw=true
   :width: 900px
   :align: center

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

.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/runtime_aug16-1.png?raw=true
   :width: 600px
   :align: center
   
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 <https://pypi.org/project/SpatialDM/>`_. 
To install, type the following command line and add ``-U`` for updates:

.. code-block:: bash

   pip install -U SpatialDM

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

.. code-block:: bash

   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. 


.. code-block:: python

        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')
 
.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/global_plot.png?raw=true
   :width: 200px
   :align: center
   
.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/SPP1_CD44.png?raw=true
   :width: 600px
   :align: center



Detailed Manual
===============

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

* `Permutation-based SpatialDM (Recommended for small datasets, <10k spots)`_.

* `Differential analyses of whole interactome among varying conditions`_.

.. _Permutation-based SpatialDM (Recommended for small datasets, <10k spots): tutorial/melanoma.ipynb

.. _Differential analyses of whole interactome among varying conditions: tutorial/differential_test_intestine.ipynb




References
==========

| Li, Z., Wang, T., Liu, P., & Huang, Y. (2023). SpatialDM for rapid 
  identification of spatially co-expressed ligand–receptor and revealing 
  cell–cell communication patterns. Nature communications, 14(1), 3995.
  https://www.nature.com/articles/s41467-023-39608-w


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/StatBiomed/SpatialDM",
    "name": "SpatialDM",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Spatial transcriptomics, Spatial association, Ligand-recptor interaction",
    "author": "['Zhouxuan Li', 'Tianjie Wang', 'Yuanhua Huang']",
    "author_email": "leeyoyo@connect.hku.hk",
    "download_url": "https://files.pythonhosted.org/packages/66/1d/84a777fc71478d42086e5bc36e56ddbe031c7f7ef842c9c83b3771d7aead/spatialdm-0.3.0.tar.gz",
    "platform": null,
    "description": "===============================================================\nSpatialDM: Spatial Direct Messaging Detected by bivariate Moran\n===============================================================\n\nAbout\n=====\n\nSpatialDM (Spatial Direct Messaging, or Spatial co-expressed ligand and \nreceptor Detected by Moran's bivariant extension), a statistical model and \ntoolbox to identify the spatial co-expression (i.e., spatial association) \nbetween a pair of ligand and receptor. \\\n\nUniquely, SpatialDM can distinguish co-expressed ligand and receptor pairs from \nspatially separating pairs, and identify the spots of interaction.\n\n.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/AvsB-1.png?raw=true\n   :width: 900px\n   :align: center\n\nWith the analytical testing method, SpatialDM is scalable to 1 million spots \nwithin 12 min with only one core.\n\n.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/runtime_aug16-1.png?raw=true\n   :width: 600px\n   :align: center\n   \nIt comprises two main steps: \\\n1) global selection `spatialdm_global` to identify significantly interacting LR pairs; \\\n2) local selection `spatialdm_local` to identify local spots for each interaction.\n\nInstallation\n============\n\nSpatialDM is available through `PyPI <https://pypi.org/project/SpatialDM/>`_. \nTo install, type the following command line and add ``-U`` for updates:\n\n.. code-block:: bash\n\n   pip install -U SpatialDM\n\nAlternatively, you can install from this GitHub repository for latest (often \ndevelopment) version by the following command line:\n\n.. code-block:: bash\n\n   pip install -U git+https://github.com/StatBiomed/SpatialDM\n\nInstallation time: < 1 min\n\n\n\nQuick example\n=============\n\nUsing the build-in melanoma dataset as an example, the following Python script\nwill compute the p-value indicating whether a certain Ligand-Receptor is \nspatially co-expressed. \n\n\n.. code-block:: python\n\n        import spatialdm as sdm\n        adata = sdm.datasets.dataset.melanoma()\n        sdm.weight_matrix(adata, l=1.2, cutoff=0.2, single_cell=False) # weight_matrix by rbf kernel\n        sdm.extract_lr(adata, 'human', min_cell=3)      # find overlapping LRs from CellChatDB\n        sdm.spatialdm_global(adata, 1000, specified_ind=None, method='both', nproc=1)     # global Moran selection\n        sdm.sig_pairs(adata, method='permutation', fdr=True, threshold=0.1)     # select significant pairs\n        sdm.spatialdm_local(adata, n_perm=1000, method='both', specified_ind=None, nproc=1)     # local spot selection\n        sdm.sig_spots(adata, method='permutation', fdr=False, threshold=0.1)     # significant local spots\n\n        # visualize global and local pairs\n        import spatialdm.plottings as pl\n        pl.global_plot(adata, pairs=['SPP1_CD44'])\n        pl.plot_pairs(adata, ['SPP1_CD44'], marker='s')\n \n.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/global_plot.png?raw=true\n   :width: 200px\n   :align: center\n   \n.. image:: https://github.com/StatBiomed/SpatialDM/blob/main/docs/.figs/SPP1_CD44.png?raw=true\n   :width: 600px\n   :align: center\n\n\n\nDetailed Manual\n===============\n\nThe full manual is at https://spatialdm.readthedocs.io, including:  \n\n* `Permutation-based SpatialDM (Recommended for small datasets, <10k spots)`_.\n\n* `Differential analyses of whole interactome among varying conditions`_.\n\n.. _Permutation-based SpatialDM (Recommended for small datasets, <10k spots): tutorial/melanoma.ipynb\n\n.. _Differential analyses of whole interactome among varying conditions: tutorial/differential_test_intestine.ipynb\n\n\n\n\nReferences\n==========\n\n| Li, Z., Wang, T., Liu, P., & Huang, Y. (2023). SpatialDM for rapid \n  identification of spatially co-expressed ligand\u2013receptor and revealing \n  cell\u2013cell communication patterns. Nature communications, 14(1), 3995.\n  https://www.nature.com/articles/s41467-023-39608-w\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "SpatialDM: Spatial co-expression Detected by bivariate Moran",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/StatBiomed/SpatialDM"
    },
    "split_keywords": [
        "spatial transcriptomics",
        " spatial association",
        " ligand-recptor interaction"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "661d84a777fc71478d42086e5bc36e56ddbe031c7f7ef842c9c83b3771d7aead",
                "md5": "1dd606b5bec92e4b099ac2c4b1252683",
                "sha256": "8c725406f5345df0b769686b8d6e8b9915da301070642c4f62c3cc07fa7502f1"
            },
            "downloads": -1,
            "filename": "spatialdm-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1dd606b5bec92e4b099ac2c4b1252683",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5679385,
            "upload_time": "2025-07-16T08:24:33",
            "upload_time_iso_8601": "2025-07-16T08:24:33.841219Z",
            "url": "https://files.pythonhosted.org/packages/66/1d/84a777fc71478d42086e5bc36e56ddbe031c7f7ef842c9c83b3771d7aead/spatialdm-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 08:24:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "StatBiomed",
    "github_project": "SpatialDM",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "anndata",
            "specs": [
                [
                    ">=",
                    "0.6"
                ]
            ]
        },
        {
            "name": "scanpy",
            "specs": [
                [
                    ">=",
                    "1.5"
                ]
            ]
        },
        {
            "name": "SparseAEH",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "statsmodels",
            "specs": [
                [
                    ">=",
                    "0.11"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "0.23.0"
                ]
            ]
        },
        {
            "name": "h5py",
            "specs": [
                [
                    ">=",
                    "2.9.0"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "holoviews",
            "specs": []
        },
        {
            "name": "seaborn",
            "specs": []
        },
        {
            "name": "selenium",
            "specs": []
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "0.23"
                ]
            ]
        },
        {
            "name": "hilearn",
            "specs": []
        },
        {
            "name": "threadpoolctl",
            "specs": []
        }
    ],
    "lcname": "spatialdm"
}
        
Elapsed time: 1.51943s