peacoqc-rs
Python bindings for peacoqc-rs, a Rust implementation of the
PeacoQC automated quality-control algorithm for flow
cytometry data. Distributed on PyPI as peacoqc-rs; imported in Python as peacoqc.
How it works
A native extension module (built with maturin and
PyO3) wraps the Rust peacoqc-rs crate and exposes its QC entry points to
Python, bridging event tables through Polars/
pyo3-polars. Type stubs
(peacoqc.pyi) ship with the package, so run_qc(...),
FcsFile, etc. autocomplete and type-check in editors without extra config.
Prebuilt wheels are published for Linux (x86_64/aarch64), macOS (Intel/Apple Silicon), and
Windows (x64), targeting Python 3.9+ via PyO3's stable ABI (abi3) — one wheel per platform
covers every supported Python version, so there's no wheel-matrix version lottery to worry about.
Installation
pip install peacoqc-rs
Or with uv:
uv add peacoqc-rs
Quick Start
Point at an .fcs file and get filtered data back in one call:
import peacoqc
result, clean_df = peacoqc.run_qc_on_fcs("sample.fcs")
print(f"Removed {result.percentage_removed:.2f}% of events")
run_qc_on_fcs opens the file, applies compensation/transformation, and runs PeacoQC — the
fastest path if you're starting from a raw .fcs file.
Already have a Polars DataFrame? Run QC directly against it:
import polars as pl
import peacoqc
df = pl.read_csv("events.csv")
result = peacoqc.run_qc(
df,
channels=["FL1-A", "FL2-A"],
channel_ranges={"FL1-A": (0.0, 262144.0), "FL2-A": (0.0, 262144.0)},
)
print(f"Removed {result.percentage_removed:.2f}% of events")
# Apply the mask to filter good cells
clean_df = df.filter(pl.Series(result.good_cells))
Need more control over each pipeline stage? Margin removal, doublet removal, and
FCS-specific helpers (FcsFile, open_fcs, preprocess, filter_fcs) are all available —
see peacoqc.pyi for the full API surface and every function's
parameters, or test_poc.py for exercised end-to-end usage.
Checking versions
peacoqc-py's bindings version and the underlying peacoqc-rs algorithm version are
tracked independently — a bindings-only release (e.g. fixing a Python-facing error
message) doesn't require bumping the algorithm version, and vice versa. Check both
when comparing behavior against the peacoqc-rs changelog:
import peacoqc
print(peacoqc.__version__) # peacoqc-py bindings version
print(peacoqc.__peacoqc_rs_version__) # peacoqc-rs algorithm version baked into this wheel
Performance
Same algorithmic costs as peacoqc-rs; Python overhead is binding/conversion only.
Cross-language QC-core timings live with the Rust crate (bindings do not re-time R separately):
| Case | R | Rust | Speedup vs R |
|---|---|---|---|
| real ~215k×13 | 1.53 | 0.103 | 14.9× |
| real ~394k×13 | 1.78 | 0.114 | 15.7× |
| synth 1M×15 | 3.83 | 0.186 | 20.6× |
Do not enable the Rust gpu feature for full PeacoQC in this version — e2e GPU was much slower than CPU on every measured size.
On the three real FCS cases in the sample, R and Rust % removed agreed closely (|Δ| ≈ 0.3–2%). Full tables:
../peacoqc-rs/docs/throughput_vs_r_sample.md,
../peacoqc-rs/docs/comparison-with-r.md.
Building from source
For contributors: build from this directory with the usual PyO3/maturin flow.
maturin develop # build + install into the active venv for local testing
maturin build --release # build a release wheel into dist/
License
MIT
Related crates
peacoqc-rs— algorithm implementationflow-fcs— FCS loading behind the bindings
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file peacoqc_rs-0.1.2.tar.gz.
File metadata
- Download URL: peacoqc_rs-0.1.2.tar.gz
- Upload date:
- Size: 562.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35569443dbb0faed151ad4f33ead9664bdc5f1b9b724d4487ff77c1a680a664b
|
|
| MD5 |
bc3550176956ecf6179d73d5235c0fa9
|
|
| BLAKE2b-256 |
cee137b8e66a0be3d8f1d6290e60111969fe09629224bc29f42ebdc796549dbb
|
File details
Details for the file peacoqc_rs-0.1.2-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: peacoqc_rs-0.1.2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 8.1 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6944e12e12f23c98a1729e1abd6a0ed9cca1390c5a974e5e4b96d8aab39dac93
|
|
| MD5 |
7ac38400d52e9f40936f0c6b54a4a3b5
|
|
| BLAKE2b-256 |
4af4f2045293dab7d91501ee4ff78538f91242ff245d65062edf7c8521fa7aa8
|
File details
Details for the file peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 9.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b352c20d14cb0d0aad1b3b6be676eda5999ac32bca94f5e75e78e8294f97c86
|
|
| MD5 |
cd7fdae3ac092dc2059879eb24d090fd
|
|
| BLAKE2b-256 |
bd11e9a86bcbf65dc87986e8eed3bf32d70f1fbc9c201ee1501ad92c049a6efc
|
File details
Details for the file peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 8.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f624c400491878b08a1df423927d6ae9188e9e86949f3c118ab19b51a6a45c87
|
|
| MD5 |
62b6436111d037dec12ceb480ece96a8
|
|
| BLAKE2b-256 |
2283adc6b65d0202e4398e941757a5c82a6538f4345f4013d4fa5b967f211360
|
File details
Details for the file peacoqc_rs-0.1.2-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: peacoqc_rs-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.9 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50de89b267e416fffb4688c611a257e32364f07e182255da28a00f3b50f8aa88
|
|
| MD5 |
637c218dd1fbb862b8765241b74eac8d
|
|
| BLAKE2b-256 |
b57d5f9854f316cdf667436f0cf151693f7b3be4ab3da1ae4a1df18c9b67ec62
|
File details
Details for the file peacoqc_rs-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: peacoqc_rs-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8fe3b96e74cb81ce17a12e685de231703273cc77645d4316d319c92454a018b
|
|
| MD5 |
2966da31ae3488ed7f7c6a26c1e8cd5b
|
|
| BLAKE2b-256 |
260bc330d0c4e5367f3f087131f20bb8294810905c98e0187880bdd8682bab7e
|