PeacoQC-CLI
Command-line tool for PeacoQC (Peak-based Quality Control) for flow cytometry FCS files built on top of the peacoqc-rs crate, which implements the PeacoQC algorithm. The CLI provides a simple interface to run quality control on one or more FCS files with parallel processing support.
Installation
From Source
The binary will be at target/release/peacoqc.
Using Cargo
Install the binary as a cargo tool by pointing to its location (e.g. using the path of the repo cloned above):
Usage
Basic Usage (Single File)
Process a single FCS file:
With output file:
Multiple Files
Process multiple files in parallel:
With output directory:
Directory Processing
Process all FCS files in a directory (recursively):
The tool will:
- Recursively find all
.fcsfiles in the directory - Process them in parallel
- Save outputs to the specified output directory (or alongside input files with
_cleanedsuffix)
Options
<INPUT_FILES>... ) )
)
)
)
)
)
)
)
)
)
)
)
QC plot options
When generating QC plots (--plots or when prompted), the following flags customize the plot image and typography. Omitted options use the library defaults.
| Option | Description | Default |
|---|---|---|
--plot-dir <PLOT_DIR> |
Directory to save QC plot PNGs | Same as input file (single file) or current dir |
--hide-spline-mad |
Hide spline and MAD threshold lines on channel plots | Shown |
--show-bin-boundaries |
Show bin boundaries (gray vertical lines) on channel plots | Hidden |
--plot-width <PIXELS> |
Plot image width in pixels | 2400 |
--plot-height <PIXELS> |
Plot image height in pixels | 1800 |
--plot-title-size <SIZE> |
Title (caption) font size in points | 22 |
--plot-axis-size <SIZE> |
Axis label font size in points | 20 |
--plot-tick-size <SIZE> |
Tick label font size in points | 17 |
--plot-legend-size <SIZE> |
Legend text font size in points | 17 |
--plot-font <FONT> |
Font family for all plot text (e.g. sans-serif, serif) |
sans-serif |
Example: larger plot and text for presentations:
Examples
Process Single File
# Basic processing
# With custom channels
# Save report
# Export QC results as CSV
# Export numeric CSV (R-compatible)
# Export JSON metadata
# Export to directory (auto-named files)
# Verbose output
Process Multiple Files
# Process all files in directory
# Process specific files
# Save individual reports
Custom QC Settings
# Use only Isolation Tree method
# Adjust MAD threshold (higher = less strict)
# Adjust Isolation Tree limit
# Keep margins and doublets (disable removal)
# Note: Keeping doublets may cause more bins to be flagged as outliers
# on some datasets, as doublets can interfere with peak detection and MAD calculations.
# Use --keep-doublets only if needed to match specific published results
# or if doublet removal is too aggressive for your dataset.
Performance
The CLI automatically processes files in parallel:
- Multiple files: Processed simultaneously using all available CPU cores
- Multiple channels: Processed in parallel within each file
- Multiple bins: Processed in parallel within each channel
Expected speedup:
- Single file with many channels: 2-4x speedup on typical multi-core systems
- Multiple files: ~N cores speedup (e.g., 8 files on 8 cores → ~8x speedup)
Output
Console Output
The tool prints progress and summary information:
🧬 PeacoQC - Flow Cytometry Quality Control
============================================
📂 Found 5 file(s) to process
✅ Processing Complete!
Processed: 5 file(s)
Successful: 5
⏱️ Total time: 12.34s
With --verbose flag, additional details are shown for each file.
Reports
Reports are saved as JSON files with the following structure:
For multiple files:
- If
--reportpoints to a directory: Individual JSON files are created for each input file - If
--reportpoints to a file: A combined report with all results is created
Export Formats
The CLI supports exporting QC results in multiple formats:
Boolean CSV (Recommended)
Exports a CSV file with 0/1 values:
1= good event (keep)0= bad event (remove)
Best for: pandas, R, SQL, general data analysis
Numeric CSV (R-Compatible)
Exports a CSV file with numeric codes matching R PeacoQC:
2000= good event (keep)6000= bad event (remove)
Best for: R compatibility, FlowJo CSV import, legacy pipelines
JSON Metadata
Exports comprehensive QC metrics including:
- Event counts (before/after/removed)
- Percentage removed by method (IT, MAD, consecutive)
- Configuration used
- Channels analyzed
Best for: Programmatic access, reporting, provenance tracking
Export to Directory
When exporting to a directory, files are automatically named:
# Creates: ./exports/sample.PeacoQC.csv and ./exports/sample.PeacoQC.json
Output Files (FCS)
When an output path is specified (using -o or --output), the CLI will write cleaned FCS files containing only the events that passed quality control.
- Single file: Output file will be saved with
_cleanedsuffix (e.g.,sample.fcs→sample_cleaned.fcs) - Multiple files: If output directory is specified, files will maintain their original names with
_cleanedsuffix - Filtered data: Output FCS files contain only events that passed all QC steps (IT, MAD, consecutive filtering)
Example:
# Single file - saves to sample_cleaned.fcs in same directory
# Multiple files - saves to output directory with _cleaned suffix
# Creates: ./clean_dir/file1_cleaned.fcs, ./clean_dir/file2_cleaned.fcs
This provides feature parity with the R PeacoQC package's save_fcs=TRUE option.
Error Handling
The CLI continues processing even if individual files fail:
- Successful files: Processed and included in results
- Failed files: Error messages are printed, processing continues
- Exit code: Returns non-zero exit code if any files failed
Integration with peacoqc-rs
This CLI is built on top of the peacoqc-rs library, which provides:
- Trait-based design for maximum flexibility
- Efficient parallel processing
- Comprehensive quality control algorithms
- Integration with
flow-fcsfor FCS file support
See the peacoqc-rs documentation for library usage.
License
MIT License - see LICENSE file for details
Attribution
We gratefully acknowledge the original PeacoQC algorithm authors:
Original Paper:
Original R Implementation:
- GitHub:
https://github.com/saeyslab/PeacoQC - Authors: Annelies Emmaneel, Katrien Quintelier, and the Saeys Lab
Contributing
Contributions are welcome! Please feel free to open issues or submit a Pull Request on Github.