Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COMMOT

Screening cell–cell communication in spatial transcriptomics via collective optimal transport.

This repository is a maintained fork of zcang/COMMOT, incorporating the performance optimizations from Zaoqu-Liu/COMMOT and updating the codebase to work with modern Python and package versions.

What changed from the original

Area Change
Performance 2–3× faster via batch gene extraction and parallel COT (Zaoqu-Liu)
Performance Process-based parallelism (loky) for cot_row_sparse, cot_col_sparse, cot_blk_sparse — speeds up the part of Stage 1 that is parallelizable (note: cot_sparse dominates at tested dataset scales and is inherently sequential)
Performance 20–40× faster cluster summarization via cluster_communication_batch: vectorized sparse matmul replaces nested Python loops, shared pre-computed indicator matrices across all LR pairs
Python Requires Python ≥ 3.10 (was 3.7)
anndata Compatible with anndata 0.10–0.12 (was pinned to 0.7.6)
Dependencies All pins modernized; pysallibpysal
Bug fixes Missing functions restored; pandas/scipy/networkx deprecations fixed

Installation

git clone https://github.com/YOUR_USER/COMMOT.git
cd COMMOT
pip install .

For downstream analysis functions (group_cell_communication):

pip install \".[downstream]\"
# karateclub must be installed separately from GitHub:
pip install git+https://github.com/benedekrozemberczki/karateclub.git@cb46a91

Note: Do not use pip install commot — that installs the original unpatched version from PyPI.

Usage

The API is fully compatible with the original. See the official documentation for complete usage examples.

import commot as ct
import scanpy as sc

adata = sc.read_h5ad(\"your_data.h5ad\")

df_ligrec = ct.pp.ligand_receptor_database(database='CellChat', species='human')

ct.tl.spatial_communication(
    adata,
    database_name='CellChat',
    df_ligrec=df_ligrec,
    dis_thr=200,
    heteromeric=True,
    n_jobs=-1   # parallelization (new parameter)
)

Citation

If you use this software, please cite the original paper:

Cang, Z., Zhao, Y., Almet, A.A. et al. Screening cell–cell communication in spatial transcriptomics via collective optimal transport. Nat Methods 20, 218–228 (2023). https://doi.org/10.1038/s41592-022-01728-4

License

MIT License — original copyright Zixuan Cang (2022), see LICENSE.md.

About

Fork of an optimization fork of COMMOT, fixing bugs and updating for newer anndata and python versions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages