Skip to main content

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

Metadata

Release files for cozipy 0.1.4

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

Source distribution (sdist)

Source distribution for cozipy 0.1.4
File Size Uploaded Provenance Actions
cozipy-0.1.4.tar.gz 9.8 kB With provenance Details for cozipy-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cozipy 0.1.4
File Interpreter ABI Platform Actions
cozipy-0.1.4-py3-none-any.whl Python 3 none any Details for cozipy-0.1.4-py3-none-any.whl

Total release size: 17.3 kB

Release files / cozipy-0.1.4.tar.gz

Download URL cozipy-0.1.4.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bfbbb87596c817cb67294f703fe6f5ffd35f0ad4d8d2ce54a6489fba0c6c3f5a
BLAKE2b-256 checksum
How to use checksums
85515b1f181dc8b1da926af0ad08f0303b7d2f65595b8f6b4075b910bed19ff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2026.

Transparency log

Release files / cozipy-0.1.4-py3-none-any.whl

Download URL cozipy-0.1.4-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8e2ddb0d57cfd2d0ac78f3e5cbb82f9d03ce24ef742e4073748f354c5818beb
BLAKE2b-256 checksum
How to use checksums
085be1718d1d1d612eca31a00f8b78ed6c458fa640722f581cb1e4bec53d8d13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2026.

Transparency log

Security for cozipy 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cozipy-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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