Benchmarking preprocessing workflows that turn multiplexed protein images into cell-by-protein matrices.
Note
This README is normally generated by scripts/create_readme.sh, which renders
the API in src/api/ through a container. It is written by hand here because
that generator has not yet been run against this repository; running it will
overwrite this file with the canonical rendering.
Imaging-based spatial proteomics platforms — CyCIF, CODEX, MIBI, IMC — produce multiplexed images in which each channel is an antibody-stained protein marker. Turning those images into cell-level protein profiles takes a chain of preprocessing choices: correcting the image, segmenting cells, aggregating pixel intensities per cell, applying quality control, and normalizing. Each choice changes the cell-by-protein matrix that every downstream analysis is built on, there is no established consensus on which to make, and the effect of any single one is rarely reported in isolation.
This task benchmarks those steps as interchangeable modules:
SpatialData .zarr
-> image correction corrected_image.npy (C x Y x X float32) + corrected_markers.json
-> segmentation segmentation_labels.npy (Y x X int32) + segmentation_metadata.json
-> aggregation cell_by_protein.h5ad
-> QC cell_by_protein_qc.h5ad
-> normalization cell_by_protein_norm.h5ad
-> metrics metrics_*.h5ad
Methods within a module share an argument contract, so a run can swap one module while holding the rest fixed.
The task stops at preprocessing. Cell-type annotation and biological interpretation are treated as downstream consumers of the output rather than as benchmarked steps.
Metric implementations live in sprotmetrics;
the components in src/metrics_proteomics/ are the Viash contracts around them.
scripts/create_component/generate_metric_info.py regenerates the info.metrics
blocks from that package's registry, so the direction and bounds declared here
cannot drift from the implementations.
The metrics are deliberately reference-free wherever possible — they score a result against properties the data must satisfy if preprocessing is correct, rather than against a ground truth:
| family | what it scores |
|---|---|
basic |
cell counts, morphology, intensity, marker coverage |
marker_distribution |
per-marker sparsity, coverage, dynamic range |
normalization_diagnostics |
raw-versus-normalized totals, variance, rank preservation |
segmentation_quality |
nuclear positivity, agreement between repeated nuclear stains, mutually exclusive co-expression, neighbour spillover |
technical_covariates |
residual dependence on cell area; variance stabilisation |
signal_background |
pixel-level signal inside masks against a locally proximal background |
This matters because ground-truth segmentation masks are unavailable for most real datasets, including the public exemplar this task is developed against.
Every metric is additionally reported over the QC-passing subset, suffixed
_qc_pass. QC components annotate rather than filter, and every normalization
method is per-cell, so without that second pass the choice of QC method would
leave every other metric untouched.
The workflow takes a SpatialData Zarr store: at least one Images element
with dims (c, y, x) and a channel coordinate carrying marker names, and
optionally a Labels element used by the reference segmentation method.
The public MCMICRO exemplar-001 download is raw acquisition data — unstitched
tiles for three imaging cycles — so two steps bridge the gap, both scripted:
bash scripts/create_resources/isp/prepare_exemplar_001.sh resources/ispThis downloads the dataset, registers the cycles into one mosaic with ashlar,
and converts the result to exemplar-001.zarr. Pass that path as ZARR_PATH.
ZARR_PATH=/path/to/exemplar-001.zarr \
NUCLEAR_MARKERS="DNA_6,DNA_7,DNA_8" \
EXCLUSIVE_PAIRS="ECAD:CD45,ECAD:CD11B,SMA:CD45" \
bash src/workflows/run_benchmark/test.shPanel-dependent metrics return NaN when their configuration is absent, rather
than guessing for an unknown panel.
One invocation runs many method chains, not one. --default_methods names the
baseline — one method per step — and a method that is not a default is only ever
combined with the defaults, so each non-baseline chain differs from the baseline
in exactly one step. With the shipped defaults that is 10 chains rather than the
162 a cross-product would give, and it is what makes a difference in a metric
attributable to a single choice. Per-method parameters come from the component
defaults or from a YAML of parameter sets and sweeps.
The run publishes score_uns.yaml — one record per (chain, metric component),
carrying the metric values together with the chain that produced them — next to
the method and metric configs needed to interpret it.
See DEVELOPER.md for the component layout, how to add a method, how to select methods and sweep parameters, and how to run the tests.
| name | roles |
|---|---|
| Julius Stein | author |
| Sergio Marco Salas | author, maintainer |
| namespace | purpose |
|---|---|
methods_image_correction |
background and illumination correction |
methods_proteomics_segmentation |
cell label masks |
methods_protein_aggregation |
pixel intensities to a cell-by-protein matrix |
methods_proteomics_qc |
per-cell QC annotation |
methods_proteomics_normalization |
intensity normalization |
metrics_proteomics |
preprocessing quality metrics |