Skip to main content

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}
}

Metadata

Release files for cntools 2.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cntools 2.1.11
File Size Uploaded
cntools-2.1.11.tar.gz 167.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cntools 2.1.11
File Interpreter ABI Platform
cntools-2.1.11-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
cntools-2.1.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
cntools-2.1.11-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details

Total release size: 1.3 MB

Release files / cntools-2.1.11.tar.gz

Download URL cntools-2.1.11.tar.gz
Size 167.7 kB
Tags Source
SHA-256 checksum
How to use checksums
15e5c6e006ab9ab8f77971acc7e7f7c5b09db8a6cb96cf4f159b596bf0f31f00
BLAKE2b-256 checksum
How to use checksums
43f5dcb43652dcf0fe07f08628e5bbd194a1f75e7b84c7897af0458f2c3d23b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release files / cntools-2.1.11-cp38-cp38-win_amd64.whl

Download URL cntools-2.1.11-cp38-cp38-win_amd64.whl
Size 261.7 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
7b40d62066251a8e75fe98cd3a23f6c1636fae2bdf6aaf52d3600f89d6f02840
BLAKE2b-256 checksum
How to use checksums
d1663e05aaa89437b6fcef7b64c9d7c2d75c0628d457f0cb375f2b4054a1e7f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release files / cntools-2.1.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cntools-2.1.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 588.7 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d5a564726e796f1699baa100555aa05cecd16d44c413a5ccd4786115faef1ad0
BLAKE2b-256 checksum
How to use checksums
51f96ff02e4baf785160422e528f10ca7dba26ab342cdbc009d33696bb999466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release files / cntools-2.1.11-cp38-cp38-macosx_10_9_x86_64.whl

Download URL cntools-2.1.11-cp38-cp38-macosx_10_9_x86_64.whl
Size 273.0 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
e957f6ffed5dda527e56e48712876008ff9819e1190dc6d65b4743ecbfc0acda
BLAKE2b-256 checksum
How to use checksums
fc85e6b8310191805e11777ca908111f056407bf7a56ff82b3bbc9e401506680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release history Release notifications | RSS feed

This release

2.1.11 This release

4 release files

2.1.10

1 release file

2.1.9

1 release file

2.1.8

1 release file

2.1.7

1 release file

2.1.6

1 release file

2.1.5

1 release file

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.9

1 release file

2.0.8

1 release file

2.0.7

1 release file

2.0.6

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.0.0

1 release file

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page