A package for identifying cellular neighborhoods
Project description
CNTools
System requirements
The software denpendencies are listed in pyproject.toml
. The software is independent of operating systems except that it needs Rosetta translation to work in macOS with Apple silicon.
Installation guide
As we need a conda package pydot=1.4.2 (not a pip one), the package should be installed by
conda create -n cntools python=3.8 pydot=1.4.2
conda activate cntools
python -m pip install cntools
In macOS with Apple silicon, the package should be installed in an x86-64 conda environment by
CONDA_SUBDIR=osx-64 conda create -n cntools python=3.8 pydot=1.4.2
conda activate cntools
python -m pip install cntools
Instructions for use
Idenfity and smooth cellular neighborhoods
See tests/test_crc.ipynb
for CRC dataset, tests/test_t2d.ipynb
for T2D dataset, and tests/test_hlt.ipynb
for HLT dataset. For example, to run CNE on the CRC dataset, just do
from cntools.datasets import load_ct_order, prep_crc, Dataset
from cntools.identification import CNE
from cntools.smoothing import NaiveSmooth
# load dataset
df = prep_crc(pd.read_csv('data/CRC/CRC_clusters_neighborhoods_markers.csv'))
ct_order = load_ct_order('data/CRC/ct_order.json')
ds = Dataset(df, ct_order)
# identify
identifier = CNE(n_cns=9, perp=15, lam=0.25)
cns = identifier.fit(ds) # output CN
# smooth
smoother = NaiveSmooth(ds=ds, n_cns=identifier.n_cns, feats=identifier.feats, s=3)
cns_smoothed_naive = smoother.fit(cns) # output CN after smoothing
Analyze cellular neighborhoods
See jupyter notebooks in the tests/analysis
folder.
Demo
Run tests/test_crc.ipynb
, tests/test_t2d.ipynb
, and tests/test_hlt.ipynb
for CN identification and smoothing. Run jupyter notebooks in the tests/analysis/
folder for CN analyses. Expected CN outputs are in the tests/cn/*/CNE/
folder. Expected analysis outputs are in the tests/analysis_res/*/CNE/
folder.
Acknowledgements
Our implementation adapts the code of Spatial LDA, Schurch et al. (2020), and Bhate et al. (2022) as cellular neighborhood identification and analysis methods. We thank the authors for sharing their code.
@article{chen2020modeling,
title={Modeling Multiplexed Images with Spatial-LDA Reveals Novel Tissue Microenvironments},
author={Chen, Zhenghao and Soifer, Ilya and Hilton, Hugo and Keren, Leeat and Jojic, Vladimir},
journal={Journal of Computational Biology},
year={2020},
publisher={Mary Ann Liebert, Inc., publishers 140 Huguenot Street, 3rd Floor New~…}
}
@article{schurch2020coordinated,
title={Coordinated cellular neighborhoods orchestrate antitumoral immunity at the colorectal cancer invasive front},
author={Sch{\"u}rch, Christian M and Bhate, Salil S and Barlow, Graham L and Phillips, Darci J and Noti, Luca and Zlobec, Inti and Chu, Pauline and Black, Sarah and Demeter, Janos and McIlwain, David R and others},
journal={Cell},
volume={182},
number={5},
pages={1341--1359},
year={2020},
publisher={Elsevier}
}
@article{bhate2022tissue,
title={Tissue schematics map the specialization of immune tissue motifs and their appropriation by tumors},
author={Bhate, Salil S and Barlow, Graham L and Sch{\"u}rch, Christian M and Nolan, Garry P},
journal={Cell Systems},
volume={13},
number={2},
pages={109--130},
year={2022},
publisher={Elsevier}
}
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 Distributions
Hashes for cntools-2.1.11-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b40d62066251a8e75fe98cd3a23f6c1636fae2bdf6aaf52d3600f89d6f02840 |
|
MD5 | 255a9518051ad94e1222b5df0e54fe5f |
|
BLAKE2b-256 | d1663e05aaa89437b6fcef7b64c9d7c2d75c0628d457f0cb375f2b4054a1e7f0 |
Hashes for cntools-2.1.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5a564726e796f1699baa100555aa05cecd16d44c413a5ccd4786115faef1ad0 |
|
MD5 | 50ca68851aab5436602b5035673804d1 |
|
BLAKE2b-256 | 51f96ff02e4baf785160422e528f10ca7dba26ab342cdbc009d33696bb999466 |
Hashes for cntools-2.1.11-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e957f6ffed5dda527e56e48712876008ff9819e1190dc6d65b4743ecbfc0acda |
|
MD5 | d518a3a8a01b7247b82a8499d5553588 |
|
BLAKE2b-256 | fc85e6b8310191805e11777ca908111f056407bf7a56ff82b3bbc9e401506680 |