Skip to main content

ClumPyCells

ClumPyCells is a Python toolbox for spatial mark cross-correlation analysis in spatial omics data. It supports cell-size correction, long-running progress feedback, a Streamlit GUI, terminal/HPC execution, and downstream AUC, group comparison, decision-tree, survival, and permutation workflows.

Preprint: https://www.biorxiv.org/content/10.64898/2026.03.26.714529v1

Installation

From this repository:

python -m venv CLPC
source CLPC/bin/activate
python -m pip install --upgrade pip
python -m pip install .

After publication to PyPI:

python -m pip install clumpycells

GUI

Run the packaged Streamlit app:

clumpycells-gui

Or from a source checkout:

streamlit run streamlit_app.py

The GUI lets users map arbitrary CSV column names, preview images, run KMM/markcorr, generate HPC commands, and perform downstream analysis. The Cohort analysis tab uses the full CSV for the selected mapping, while Data preview remains intentionally sampled for responsiveness. The Image preview tab draws cell areas in the same coordinate scale as x/y and can filter visible cell types.

Python API

from ClumPyCells import MarkcorrResult, runSpatial

runSpatial(
    csv_path="cells.csv",
    savefolder="results/",
    xrange=[0, 1056],
    yrange=[0, 642],
    x_col="centroid_x",
    y_col="centroid_y",
    image_col="sample_id",
    area_col="cell_area",
    mark_columns=["cell_type", "CD3", "MPO"],
    sizeCorrection=True,
    pp_criterion=lambda df: df["Area"] > 100,
    max_workers=4,
)

result = MarkcorrResult(
    groups={"A": ["1", "2"], "B": ["3", "4"]},
    resultFolder="results/",
    axisName={"cell_type_on": "on", "cell_type_off": "off"},
)
auc, heatmaps = result.getAUC()

Terminal and HPC

The installable package provides a terminal command for offline and cluster runs:

clumpycells inspect-csv --csv cells.csv

clumpycells run-markcorr \
    --csv cells.csv \
    --out results_hpc \
    --x-col centroid_x \
    --y-col centroid_y \
    --image-col sample_id \
    --area-col cell_area \
    --mark cell_type \
    --xrange 0 1056 \
    --yrange 0 642 \
    --max-workers 4

clumpycells run-permutation \
    --run-config results_hpc \
    --out results_hpc \
    --seed 42 \
    --n-perm 100 \
    --max-workers 4

run-markcorr writes clumpycells_run_config.json under the result folder; run-permutation --run-config reuses those KMM settings. For scheduler arrays, pass image chunks with --image-id. The GUI also generates generic Slurm templates for markcorr and permutation jobs.

Documentation

Detailed usage, API examples, GUI notes, HPC templates, demo data descriptions, and testing commands are in Documentation/UserGuide.md.

The older function reference is in Documentation/Documentation.md.

Repository Layout

ClumPyCells/                # importable Python package
streamlit_app.py            # Streamlit GUI entry point
clumpycells_cli.py          # terminal/HPC command implementation
Documentation/              # detailed docs
Data/Demo/                  # small mock data for UI and API testing
tests/                      # pytest coverage for core workflows

Development Checks

python -m py_compile streamlit_app.py clumpycells_cli.py
pytest tests/ -v

Build metadata is defined in pyproject.toml. For a local release check, install the development extras and run:

python -m pip install -e ".[dev]"
python -m build
python -m twine check dist/*

Metadata

Release files for clumpycells 0.1.0

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

Source distribution (sdist)

Source distribution for clumpycells 0.1.0
File Size Uploaded
clumpycells-0.1.0.tar.gz 128.3 kB Details

Built distribution (wheel)

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

Total release size: 234.8 kB

Release files / clumpycells-0.1.0.tar.gz

Download URL clumpycells-0.1.0.tar.gz
Size 128.3 kB
Tags Source
SHA-256 checksum
How to use checksums
119182e9dcbd4c90f2390d06ff596ecc7c90221ee992cdeb3d691192b0007b7f
BLAKE2b-256 checksum
How to use checksums
bab4bbca3d4f6b84f1b10ef8bd6a86cfd04bc706b41f4c5579340eba2bbf45ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / clumpycells-0.1.0-py3-none-any.whl

Download URL clumpycells-0.1.0-py3-none-any.whl
Size 106.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec7937a0630b1a50ae45d4e2ea31c582e287db96296204d198a9a974cf92bde7
BLAKE2b-256 checksum
How to use checksums
095608b5fed5e4c747748ff53b213fdb608cbca39a94e124abad537fb96d67be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

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