Skip to content

Repository files navigation

peprs logo

peprs - A spicy 🌶️ library for managing biological sample metadata to enable reproducible and scalable bioinformatics

Don't let sample metadata parsing bottleneck your pipelines!

About this project

peprs is a rust implementation of the PEP specification and expanded ecosystem. In short, PEP is a framework for managing biological sample metadata. PEP is a community driven effort to create a fast, reliable, reusable, and scalable library for handling biological sample metadata.

PEP and its ecosystem is developed and maintained by the Databio team. As a challenge and learning experience, we have been rewriting the core components of the PEP ecosystem in Rust for performance and reliability.

We are starting with the core PEP specification for metadata management and will expand to include the full ecosystem (looper, pephub-client, pipestat). The core PEP specification is implemented in the peprs-core crate. The Python bindings are implemented in the peprs-py crate.

📦 Modules

  • peprs-core — Core library implementing the PEP specification. With core module user can create pep objects and do all kind of manipulations.
  • peprs-eido — Schema-based validation of PEP projects against JSON schemas with eido-specific extensions (imports, tangible file checks).
  • peprs-cli — Command-line interface with inspect, validate, and convert subcommands.
  • peprs-py — Python bindings via PyO3. Exposes the Project class with full Polars/Pandas DataFrame interoperability.
  • pephub-client — Work in progress

⚙️ Installation

Python (recommended)

pip install peprs

or with uv

uv pip install peprs

Python (from source)

To build and install the Python package from source (requires maturin and Rust toolchain):

git clone https://github.com/pepkit/peprs.git
cd peprs/peprs-py
maturin develop

Rust

Add to your Cargo.toml:

[dependencies]
peprs-core = { git = "https://github.com/pepkit/peprs" }

CLI

Prebuilt binaries are published to GitHub Releases for Linux, macOS, Windows, and FreeBSD (x86_64 and aarch64).

Using ubi (cross-platform, no Rust required)

ubi auto-detects your platform, downloads the right archive, and installs peprs:

ubi --project khoroshevskyi/peprs --in ~/.local/bin

Using cargo-binstall

cargo binstall peprs-cli

Manual download

Grab the archive for your platform from the releases page, extract it, and place the peprs binary on your PATH. For example on Linux x86_64:

curl -L https://github.com/khoroshevskyi/peprs/releases/latest/download/peprs-Linux-x86_64-musl.tar.gz \
| tar xz -C ~/.local/bin/

From source

cargo install --path peprs-cli

Using Python

pip install peprs

🔧 Environment Variables

VariableDefaultDescription
PH_HOME~/.pephubclient/Directory where the PEPHub auth cache (jwt.toml) is stored.
PEPHUB_BASE_URLhttps://pephub-api.databio.orgOverrides the PEPHub API endpoint used for login and Project.from_pephub(...).

🐍 Quick Python example

importpeprs# Load a PEP from a YAML config fileproject=peprs.Project("path/to/project_config.yaml")
# orproject=peprs.Project.from_pephub("databio/example:default")
# Inspect the projectprint(project.name)
print(project.description)
print(len(project)) # number of samples# Get samples as a Polars DataFramedf_pl=project.to_polars()
print(df_pl)
# Get samples as a Pandas DataFramedf_pd=project.to_pandas()
print(df_pd)
# Look up a single sample by namesample=project.get_sample("3-1_11102016")
# Iterate over samplesforsampleinproject.samples:
print(sample)
# Convert projectsproject.write_csv("output.csv")
project.write_yaml("output.yaml")
project.write_json("output.json")

Benchmarks

Comparison of peppy (pure Python) vs peprs (Rust bindings). Averaged over 3 runs per sample size.

Initialization Time (seconds)

Library5201005001,0005,00010,00050,000100,000600,000
peppy0.0190.0260.0960.4280.8514.2268.70044.01787.613297.433
peprs0.0030.0020.0020.0030.0040.0140.0360.0430.0680.339
speedup7x15x50x149x196x306x244x1,021x1,288x877x

Validation Time (seconds)

Library5201005001,0005,00010,00050,000100,000600,000
peppy0.0040.0060.0170.0700.1660.6851.3806.92814.20884.452
peprs0.0120.0010.0020.0080.0080.0380.0790.4230.7944.339
speedup0.4x9x10x9x20x18x17x16x18x19x

🚀 Afterword

We are looking forward to integrating this project with WDL, Snakemake, and Nextflow. All contributions are welcome. Please open an issue or submit a pull request.

About

PEP implementation in memory safe language Rust

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages