Skip to main content

COZI neighbor preference analysis package

Project description

COZIpy - Neighbor preference analysis with a conditional z-score

License

COZI is a python package for neighbor preference (NEP) analysis of cell type labelled spatial data. As described in Schiller et al. 2026, COZI is one optimized flavor of neighbor preference analysis and infers directional neighbor preferences based on label permutations.

Installation

Option 1. Clone the repository

If you plan to develop or modify COZIpy, install it in editable mode:

# Clone the repository
git clone https://github.com/SchapiroLabor/COZIpy
cd COZIpy

# (Optional) create the conda environment
conda env create -f env.yml
conda activate cozi-env

# Install in editable/development mode
pip install -e .

Option 2. Install from PyPI

Directly install with pip:

pip install cozipy

How to run COZIpy

Description

COZI requires x and y-coordinates and cell type label information as input. The function allows the definition of three different neighborhoods, namely k-nearest neighbor, radius and delaunay. COZI outputs z-scores generated by comparing the observed against the expected neighbor counts between cell types. The counts themselves are normalized by the number of cells of type A with at least one neighbor of type B (termed conditional normalization). It also outputs the conditional cell ratio, so the ratio of cells of type A that actually neighbor cells of type B. For more methodological details, please refer to Schiller et al. 2026.

Tutorial

Check the Tutorial for a code example.

Contributing

Contributions, issues, and feature requests are welcome!
Feel free to open a pull request or submit an issue on GitHub Issues.

Before submitting a PR:

  • Run tests
  • Follow existing code style and documentation patterns

Citing

If you use COZIpy or any other COZI implementation in IMCRtools or Squidpy in your work, please cite:

Schiller, C. et al. Comparison and optimization of cellular neighbor preference methods for quantitative tissue analysis. Nat Commun 17, 3514 (2026). https://doi.org/10.1038/s41467-026-71699-z

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

cozipy-0.1.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cozipy-0.1.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file cozipy-0.1.3.tar.gz.

File metadata

  • Download URL: cozipy-0.1.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cozipy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9d79b3c42d1e39bd6250a1cf05dfca9dc5d9bebf212728b950ddba2697327fe4
MD5 05e51416cd427bdca39a1b85f5f9ed45
BLAKE2b-256 dab1c41b0df137c8946ba0000b2849888f45380de0d72a88c733f5e751a1d917

See more details on using hashes here.

Provenance

The following attestation bundles were made for cozipy-0.1.3.tar.gz:

Publisher: python-publish.yml on SchapiroLabor/COZIpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cozipy-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cozipy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cozipy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 95f97eeb4cb262f9de5d64ffd182c5d13b9dd2fe0e4866a5225305e1c314d247
MD5 ab58a300472c1edf42947c8491e0ac56
BLAKE2b-256 8d3abdb0b876a2cf45559da6149f5453d947f9a97b937578f056def8d65d047f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cozipy-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on SchapiroLabor/COZIpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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