Method / tool

pycytominer

Python library for processing CellProfiler morphological profiles through the standard image-based profiling steps — aggregation, annotation, normalization, feature selection, and consensus — turning single-cell measurements into analysis-ready, reproducible datasets.

The problem — CellProfiler outputs a single-cell measurement table. That table is not a profile. Before any biological signal can be trusted, measurements must be aggregated to well-level, annotated with plate-map metadata, normalized against controls, and stripped of features that are low-variance, highly correlated, or driven by noise rather than biology. Doing each step ad hoc — in a one-off script — guarantees that two labs running nominally identical assays produce incompatible numbers.

What it is / how it works — pycytominer is the standard Python library for the bioinformatics layer of Cell Painting and image-based profiling pipelines. It implements five composable operations:

  1. Aggregate — collapses single-cell rows to a well-level profile (mean or median) by metadata grouping.
  2. Annotate — joins profile data with platemap files, attaching compound, dose, and perturbation identifiers.
  3. Normalize — standardizes feature distributions relative to negative controls (DMSO-MAD, whole-plate z-score, or population-level scaling), making cross-plate comparisons valid.
  4. Feature select — removes low-variance features, near-zero-variance features, correlated feature pairs, and features that fail a replicate reproducibility threshold — reducing dimensionality from ~1,500 to a cleaner, higher-signal representation.
  5. Consensus — averages replicate profiles into a single consensus signature per perturbation.

The library is built on pandas and scikit-learn, with Apache Parquet and AnnData output support. It is the de facto upstream preprocessing step before batch correction (Harmony, sphering) and readout (% replicating, mAP).

Where it fits — pycytominer spans the features, correct, and readout stages. In the JUMP Cell Painting dataset and the CPJUMP1 benchmark, the published pipeline runs CellProfiler → pycytominer normalization + feature selection → Harmony → copairs % replicating. Any deviation from that ordering changes the numbers.

Where it breaks — Normalization against a sparse or contaminated DMSO population propagates control-plate failures silently into every well. Feature selection thresholds that work for one plate layout can be too aggressive or too permissive on another. The library's defaults are sensible for standard 384-well Cell Painting but should be validated per assay rather than assumed universal.

pycytominer does not validate the upstream images or segmentation masks — it consumes whatever CellProfiler produces. A segmentation failure or an uncorrected illumination gradient becomes a feature artifact that passes through normalization unchanged. The pipeline is only as trustworthy as the stage that feeds it.

References

Appears in these notes

  • Cell Painting Pipelines — From Images to Phenotypic ProfilesA Cell Painting profile is the output of a long pipeline — illumination correction, segmentation, feature extraction, batch correction, then a reproducibility readout — and the number that matters (percent-replicating / mAP) lives only at the end. Every stage upstream can silently degrade it.

← Back to the constellation