Skip to main content

Cell-cell communications inference for spatial transcriptomics data via optimal transport.

Project description

COMMOT

Screening cell-cell communication in spatial transcriptomics via collective optimal transport

pytest

Installation

Install from PyPI by pip install commot or install from source by cd to this directory and pip install .

[Optional] Install tradeSeq in R to analyze the CCC differentially expressed genes.
Currently, tradeSeq version 1.0.1 with R version 3.6.3 has been tested to work.
In order for the R-python interface to work properly, rpy2==3.4.2 and anndata2ri==1.0.6 should be installed. To use this feature, install from PyPI by pip install commot[tradeSeq] or from source by pip install .[tradeSeq].

Usage

Basic usage

Import packages

import commot as ct
import scanpy as sc
import pandas as pd
import numpy as np

Load a spatial dataset
(e.g., a Visium dataset)

adata = sc.datasets.visium_sge(sample_id='V1_Mouse_Brain_Sagittal_Posterior')
adata.var_names_make_unique()

Basic processing

sc.pp.normalize_total(adata, inplace=True)
sc.pp.log1p(adata)

Specify ligand-receptor pairs

LR=np.array([['Tgfb1', 'Tgfbr1_Tgfbr2', 'Tgfb_pathway'],['Tgfb2', 'Tgfbr1_Tgfbr2', 'Tgfb_pathway'],['Tgfb3', 'Tgfbr1_Tgfbr2', 'Tgfb_pathway']],dtype=str)
df_ligrec = pd.DataFrame(data=LR)

(or use pairs from a ligand-receptor database df_ligrec=ct.pp.ligand_receptor_database(database='CellChat', species='mouse').)

Construct CCC networks
Use collective optimal transport to construct CCC networks for the ligand-receptor pairs with a spatial distance constraint of 200 (coupling between cells with distance greater than 200 is prohibited). For example, the spot-by-spot matrix for the pair Tgfb1 (ligand) and Tgfbr1_Tgfbr2 (receptor)is stored in adata.obsp['commot-user_database-Tgfb1-Tgfbr1_Tgfbr2']. The total sent or received signal for each pair is stored in adata.obsm['commot-user_database-sum-sender'] and adata.obsm['commot-user_database-sum-receiver'].

ct.tl.spatial_communication(adata,
    database_name='user_database', df_ligrec=df_ligrec, dis_thr=200, heteromeric=True)

Documentation

See the documentation at https://commot.readthedocs.io/en/latest/index.html for all the APIs to perform visualization and analyses such as visualizing spatial signaling direction and identifying CCC differentially expressed genes.

Reference

Cang, Zixuan, Yanxiang Zhao, Axel A. Almet, Adam Stabell, Raul Ramos, Maksim Plikus, Scott X. Atwood, and Qing Nie. "Screening cell-cell communication in spatial transcriptomics via collective optimal transport." bioRxiv (2022): 505185

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

commot-0.0.3.tar.gz (114.5 kB view details)

Uploaded Source

Built Distribution

commot-0.0.3-py3-none-any.whl (118.6 kB view details)

Uploaded Python 3

File details

Details for the file commot-0.0.3.tar.gz.

File metadata

  • Download URL: commot-0.0.3.tar.gz
  • Upload date:
  • Size: 114.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for commot-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f31e73cbc65058598fbde5f22c9ebc7d0b9466793a5729342d3192dbda599bd9
MD5 a3c7825e3b26617abe2a661568efbee1
BLAKE2b-256 cff3a02867bef8dac906e6eaa2842e60ef38aa482a2cee9d32f92aadd754949c

See more details on using hashes here.

File details

Details for the file commot-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: commot-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 118.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for commot-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fb4028e3cfea7073b4531f5c5c7b903f69128aaa4215834c0988429e2001e11b
MD5 4f8705483b373e152df3753bd91a1a1e
BLAKE2b-256 603955cd0a1c949162ceba88f3fa6fa823801aa5ecd25550b761f4755d64b31a

See more details on using hashes here.

Supported by

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