datanuggets-flow
Explore flow cytometry populations across multiple FCS files with data nuggets.
What it does
A flow cytometry experiment can produce millions of events across dozens of samples. Analyzing each file separately makes it hard to compare clusters across samples. Analyzing everything together can become expensive, especially when a method needs pairwise distances.
datanuggets-flow takes a middle route. It helps you select candidate
populations in each file using forward and side scatter, reduces the selected events to
weighted data nuggets and clusters the pooled nuggets in one analysis. The cluster
labels are shared across the files in a run, so you can examine how their relative
abundance and marker profiles differ between samples.
The package builds on
datanuggets, a Python port of the R packages datanugget and WCluster.
It offers a local web app, a command-line interface and a Python API.
Research alpha (0.1.0a6). This is an exploratory analysis
tool. It isn't an automated cell-type identification system or a validated clinical
analysis system. Its clusters are mathematical groupings, and they aren't confirmed
biological populations. The API and analysis defaults may change.
Get the app
The app runs on your own computer in Docker. The image is published for linux/amd64 and linux/arm64.
-
Install Docker and start it. That's Docker Desktop on Windows and macOS.
-
Run this in a terminal:
docker run --rm -p 127.0.0.1:8000:8000 -v datanuggets-data:/data ghcr.io/ron2k1/datanuggets-flow:0.1.0a6 -
Open http://127.0.0.1:8000 in your browser.
The app lets you inspect candidate gates, choose which populations to include, run the
clustering and explore the results with interactive plots. Ctrl+C stops it,
and the next docker run with the same
-v datanuggets-data:/data finds your uploads and runs where you left them.
The address is bound to your own computer rather than your local network. The named Docker volume keeps uploads and completed runs between containers. The analysis runs on your computer. Downloading the container image itself requires a network connection. Check your environment's network and data-handling requirements before you use sensitive files.
The image includes a small public PBMC demonstration dataset of four FCS files, so you can explore the workflow before adding your own. The app guide covers the app's settings and building the image from source.
What the app shows
The app gives you several ways to inspect a finished run:
- 2D and 3D scatter plots of nuggets or sampled cells, colored by the common cluster labels
- Marker and PCA axes to examine where clusters sit in measured or derived feature space
- t-SNE views for exploring local groupings, with separate two- and three-dimensional fits
- Parallel-coordinate plots for checking marker patterns across clusters
- Per-cluster box plots and per-file comparison tables for reviewing marker levels and cluster frequencies
Pooled clustering gives every file the same labels. It doesn't prove that a label denotes the same cell type in every file. The README lists the checks to make before interpreting a cluster.
Use it from Python
The package requires Python 3.12 or newer and a platform that the underlying
datanuggets package supports. Those are Windows x64, Apple silicon Macs
running macOS 12 or newer, and Linux x86-64 or ARM64 with glibc 2.27 or newer. Install
the pinned alpha:
python -m pip install "datanuggets-flow==0.1.0a6"
Run the command-line workflow
datanuggets-flow path/to/fcs_folder
The command finds candidate scatter populations in each FCS file, shows the gating figure and asks which populations to keep. It then runs a joint clustering analysis and writes the figures, tables and settings to a new output directory.
Run it from Python
The Python API exposes the same two stages. The first creates and saves the candidate gates. The second analyzes the populations you select. The README has a complete example.
The datanuggets library
The nugget and weighted k-means implementations come from datanuggets,
which is its own package. Data nuggets bring a large dataset down to a size you can
explore with weighted clustering and PCA.
python -m pip install "datanuggets[frame,plot]==0.1.0a3"
Documentation
Papers and acknowledgments
Core method
Beavers, T. E., Cheng, G., Duan, Y., Cabrera, J., Lubomirski, M., Amaratunga, D., and Teigler, J. E. (2025). Data Nuggets: A Method for Reducing Big Data While Preserving Data Structure. Journal of Computational and Graphical Statistics, 34(1), 330-342. Published online in 2024. doi:10.1080/10618600.2024.2341896.
Related research
- Dastgiri, M., Cabrera, J., Duan, Y., et al. (2026). Novel machine learning approach to differential cell flow cytometry analysis based on projection pursuit. Journal of Biopharmaceutical Statistics, 36(6), 1244-1256. Published online in 2025. doi:10.1080/10543406.2025.2490725.
- Duan, Y., Cabrera, J., and Emir, B. (2025). A New Projection Pursuit Index for Big Data. Journal of Computational and Graphical Statistics, 34(4), 1566-1577. doi:10.1080/10618600.2025.2468791.
- Cherasia, K. E., Cabrera, J., Fernholz, L. T., and Fernholz, R. (2023). Data Nuggets in Supervised Learning. In M. Yi and K. Nordhausen (eds.), Robust and Multivariate Statistical Methods: Festschrift in Honor of David E. Tyler (pp. 429-449). Springer. Published online in 2022. doi:10.1007/978-3-031-22687-8_20.
The data nugget reduction and weighted clustering methods belong to their original
researchers and the maintainers of the R datanugget and
WCluster packages. datanuggets-flow builds on the
datanuggets Python
port. The scatter gate finder adapts Python code supplied by Prof. Javier Cabrera. The
third-party notices
record the permissions and the upstream licenses.
The demonstration files in the app and the recorded test data come from Stefanie Kreutmair and Susanne Unger (2026), Flow cytometry data of PBMC of critically ill, mechanically ventilated patients (V1), Zenodo, doi:10.5281/zenodo.22079206.