Skip to main content

peacoqc-rs

PyPI version Python versions CI License: MIT

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

Metadata

Release files for peacoqc-rs 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for peacoqc-rs 0.1.2
File Size Uploaded Provenance Actions
peacoqc_rs-0.1.2.tar.gz 562.5 kB Without provenance Details for peacoqc_rs-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for peacoqc-rs 0.1.2
File Actions
peacoqc_rs-0.1.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for peacoqc_rs-0.1.2-cp39-abi3-win_amd64.whl
peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
peacoqc_rs-0.1.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for peacoqc_rs-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
peacoqc_rs-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for peacoqc_rs-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 41.3 MB

Release files / peacoqc_rs-0.1.2.tar.gz

Download URL peacoqc_rs-0.1.2.tar.gz
Size 562.5 kB
Tags Source
SHA-256 checksum
How to use checksums
35569443dbb0faed151ad4f33ead9664bdc5f1b9b724d4487ff77c1a680a664b
BLAKE2b-256 checksum
How to use checksums
cee137b8e66a0be3d8f1d6290e60111969fe09629224bc29f42ebdc796549dbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / peacoqc_rs-0.1.2-cp39-abi3-win_amd64.whl

Download URL peacoqc_rs-0.1.2-cp39-abi3-win_amd64.whl
Size 8.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6944e12e12f23c98a1729e1abd6a0ed9cca1390c5a974e5e4b96d8aab39dac93
BLAKE2b-256 checksum
How to use checksums
4af4f2045293dab7d91501ee4ff78538f91242ff245d65062edf7c8521fa7aa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 9.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
7b352c20d14cb0d0aad1b3b6be676eda5999ac32bca94f5e75e78e8294f97c86
BLAKE2b-256 checksum
How to use checksums
bd11e9a86bcbf65dc87986e8eed3bf32d70f1fbc9c201ee1501ad92c049a6efc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL peacoqc_rs-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 8.5 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
f624c400491878b08a1df423927d6ae9188e9e86949f3c118ab19b51a6a45c87
BLAKE2b-256 checksum
How to use checksums
2283adc6b65d0202e4398e941757a5c82a6538f4345f4013d4fa5b967f211360
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / peacoqc_rs-0.1.2-cp39-abi3-macosx_11_0_arm64.whl

Download URL peacoqc_rs-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Size 6.9 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
50de89b267e416fffb4688c611a257e32364f07e182255da28a00f3b50f8aa88
BLAKE2b-256 checksum
How to use checksums
b57d5f9854f316cdf667436f0cf151693f7b3be4ab3da1ae4a1df18c9b67ec62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Release files / peacoqc_rs-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl

Download URL peacoqc_rs-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
Size 7.7 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c8fe3b96e74cb81ce17a12e685de231703273cc77645d4316d319c92454a018b
BLAKE2b-256 checksum
How to use checksums
260bc330d0c4e5367f3f087131f20bb8294810905c98e0187880bdd8682bab7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.14.1

Security for peacoqc-rs 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page