Krewlyzer: Comprehensive cfDNA Feature Extraction Toolkit
Krewlyzer is a high-performance toolkit for extracting biological features from cell-free DNA (cfDNA) sequencing data. Designed for cancer genomics, liquid biopsy research, and clinical bioinformatics.
Built with Python + Rust for maximum performance. The compute-intensive core uses PyO3 to deliver 5-50x speedups over pure Python.
[!TIP] Full Documentation: msk-access.github.io/krewlyzer
Why Krewlyzer?
Cancer cells leave molecular fingerprints in your blood. Krewlyzer finds them.
The Fragmentomics Advantage
| Traditional Liquid Biopsy | Fragmentomics with Krewlyzer |
|---|---|
| Look for specific mutations | Analyze how DNA is cut |
| Need prior knowledge of tumor | Works without knowing mutations |
| Miss ~50% of early cancers | Detect more cancers, earlier |
Key insight: Tumor DNA fragments are shorter (~145bp) than healthy DNA (~166bp). Krewlyzer quantifies this difference and extracts ML-ready features.
What You Get
| Feature | Clinical Use |
|---|---|
| Fragment size ratios | Tumor burden estimation |
| Cutting patterns | Tissue of origin identification |
| Nucleosome positioning | Epigenetic profiling |
| Mutation-specific sizes | MRD monitoring |
New to cfDNA? Read Core Concepts for background.
Quick Install
# Docker (recommended - all data bundled)
docker pull ghcr.io/msk-access/krewlyzer:latest
# Clone + Install (development)
git clone https://github.com/msk-access/krewlyzer.git && cd krewlyzer
git lfs pull && pip install -e .
# pip + Data Clone (custom environments)
pip install krewlyzer
git clone --depth 1 https://github.com/msk-access/krewlyzer.git ~/.krewlyzer-data
cd ~/.krewlyzer-data && git lfs pull
export KREWLYZER_DATA_DIR=~/.krewlyzer-data/src/krewlyzer/data
[!NOTE] pip users: The
KREWLYZER_DATA_DIRenv var is required to locate bundled assets. See Installation Guide for details.
Quick Start
# Run all fragmentomics features
krewlyzer run-all -i sample.bam --reference hg19.fa --output results/
# Generate unified JSON for ML pipelines
krewlyzer run-all -i sample.bam --reference hg19.fa --output results/ --generate-json
# Individual tools
krewlyzer extract -i sample.bam -r hg19.fa -o output/
krewlyzer fsc -i output/sample.bed.gz -o output/
# Panel data (MSK-ACCESS) with target regions
krewlyzer run-all -i sample.bam -r hg19.fa -o results/ \
--target-regions panel_targets.bed \
--pon-model msk-access.pon.parquet
Features
| Command | Description | Output |
|---|---|---|
extract |
Extract fragments from BAM | .bed.gz |
motif |
End, breakpoint & MDS scores | .EndMotif.tsv, .BreakPointMotif.tsv, .MDS.tsv |
fsc |
Fragment size coverage | .FSC.tsv |
fsr |
Fragment size ratios | .FSR.tsv |
fsd |
Size distribution by arm | .FSD.tsv |
wps |
Windowed protection score | .WPS.parquet |
ocf |
Orientation-aware fragmentation | .OCF.tsv |
region-entropy |
TFBS/ATAC size entropy | .TFBS.tsv, .ATAC.tsv |
region-mds |
Gene- and exon-level MDS | .MDS.gene.tsv, .MDS.exon.tsv |
uxm |
Fragment-level methylation | .UXM.tsv |
mfsd |
Mutant vs wild-type sizes | .mFSD.tsv |
build-pon |
Build Panel of Normals (--from-outputs re-aggregates existing runs) |
.pon.parquet |
build-gc-reference |
Build GC reference assets | .gc_reference.tsv |
run-all |
All features in one pass | All outputs |
Pass --output-format parquet to any of them, or --generate-json to run-all
for a single .features.json for ML pipelines.
Inspecting and Validating
These read inputs or a finished output directory rather than producing features.
| Command | Description |
|---|---|
validate |
Check input assets — BEDs, anchors, GC factors — before a run |
describe-output |
What is in each output file: shape, columns, ranges |
report |
Single-sample HTML report — verdict, charts, interpretation |
validate-output |
Check results against the downstream output contract |
validate-cohort |
Cross-sample degeneracy checks over fingerprints |
validate-pon |
Check a PON before anything is scored against it |
stamp-pon |
Record the release a built PON ships with |
krewlyzer validate -G hg19 # assets are intact
krewlyzer validate-pon model.pon.parquet # the reference is sound
krewlyzer validate-output results/ # results satisfy the contract
krewlyzer describe-output results/{sample_id}/ # what is in each file
# HTML output needs the rendering extras; without them describe-output writes
# the Markdown source into the page and says so.
pip install 'krewlyzer[all]' # or [report] for just these
krewlyzer describe-output results/{sample_id}/ -o page.html
krewlyzer report results/{sample_id}/ -o report.html
Extras. [all] is every optional capability of the tool — today [report]
(HTML rendering and charts) plus psutil for sharper memory detection. It
deliberately excludes [docs], [test] and [dev], which are contributor
tooling: installing the tool should not deliver a linter.
[!NOTE] A
reportcontains one sample's actual measurements — generate it on demand for internal use, and usedescribe-outputfor anything structural that needs to leave the machine. See the CLI reference for exit codes and options.
Upgrading to 0.9.0 — your own PON will be refused
The bundled PONs were rebuilt for 0.9.0, not just re-stamped. A PON you built yourself with an earlier version is refused rather than scored against:
my.pon.parquet was built for krewlyzer 0.8.3, older than the 0.9.0 floor.
Version 0.9.0 changed what the features mean, so its baselines measure
something else -- a fabricated wps_background, floored sigmas, and a
region-MDS fitted over a different fragment range. Rebuild it with
build-pon. To score against it anyway, set KREWLYZER_ALLOW_OLD_PON=1.
Every pre-0.9.0 model divided some z-scores by a σ of ~10⁻¹⁷ — floating-point residue left where a position had no real spread, not a measurement. Rebuild instead of overriding:
# Minutes, not hours: re-aggregates existing run-all outputs, no BAM re-read
krewlyzer build-pon --from-outputs /path/to/runall_dirs \
--assay xs1 --genome hg19 -o new.pon.parquet
krewlyzer validate-pon new.pon.parquet
[!WARNING]
KREWLYZER_ALLOW_OLD_PON=1exists for reproducing an old analysis, not for getting past the error. Z-scores from an old model may be divided by residue, which produces values in the 10¹⁸ range that still look like numbers.
Panel Mode (--target-regions)
For targeted sequencing panels (MSK-ACCESS):
krewlyzer run-all -i sample.bam -r hg19.fa -o results/ \
--target-regions panel_targets.bed
- GC model: Trained on off-target fragments (unbiased)
- Outputs: Split into
.tsv(off-target) and.ontarget.tsv - Auto-PON: Use
-A xs2to auto-load bundled PON for z-scores - ML negatives: Use
-A xs2 --skip-ponto output raw features (no z-scores)
Documentation
- Getting Started - 5-minute quickstart
- Installation - Docker, pip, development
- CLI Reference - Every command and option
- Feature Details - Per-feature documentation
- Nextflow Pipeline - Batch processing
Citation
If you use Krewlyzer, please cite:
- DELFI (FSR): Cristiano S, et al. Nature 2019
- WPS: Snyder MW, et al. Cell 2016
- OCF: Sun K, et al. Genome Res 2019
- UXM: Loyfer N, et al. Nature 2022
See Citation & Scientific Background for full references.
License
GNU Affero General Public License v3.0 (AGPL-3.0). See LICENSE.
Developed by Ronak Shah (@rhshah) at Memorial Sloan Kettering Cancer Center.
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 krewlyzer-0.9.2.tar.gz.
File metadata
- Download URL: krewlyzer-0.9.2.tar.gz
- Upload date:
- Size: 450.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c85c583ffc0c8b754966c62b9edf35bf9cb454276d82c538a9347470594e7bd
|
|
| MD5 |
f27c566ba84c84cbdfc22420716e6923
|
|
| BLAKE2b-256 |
7f005f24d059045e6be342405564a83f9a0acb46f6c2e520d4717226a0994cdd
|
Provenance
The following attestation bundles were made for krewlyzer-0.9.2.tar.gz:
Publisher:
release.yml on msk-access/krewlyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krewlyzer-0.9.2.tar.gz -
Subject digest:
0c85c583ffc0c8b754966c62b9edf35bf9cb454276d82c538a9347470594e7bd - Sigstore transparency entry: 2587735160
- Sigstore integration time:
-
Permalink:
msk-access/krewlyzer@504815b656669391ce6296e72e5d62d4e0160773 -
Branch / Tag:
refs/tags/0.9.2 - Owner: https://github.com/msk-access
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@504815b656669391ce6296e72e5d62d4e0160773 -
Trigger Event:
push
-
Statement type:
File details
Details for the file krewlyzer-0.9.2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: krewlyzer-0.9.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85b610b27286cbac958c6f709aa59d301a2cf8feb66b0b38438934ba6b968f76
|
|
| MD5 |
8358c567bd8c3c122457cdf6e708ddec
|
|
| BLAKE2b-256 |
b1a6aaca6d54c39fff8d905a44db8ae49dc33118cb1cbbe8f9736627f67ab2dc
|
Provenance
The following attestation bundles were made for krewlyzer-0.9.2-cp312-cp312-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on msk-access/krewlyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krewlyzer-0.9.2-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
85b610b27286cbac958c6f709aa59d301a2cf8feb66b0b38438934ba6b968f76 - Sigstore transparency entry: 2587735971
- Sigstore integration time:
-
Permalink:
msk-access/krewlyzer@504815b656669391ce6296e72e5d62d4e0160773 -
Branch / Tag:
refs/tags/0.9.2 - Owner: https://github.com/msk-access
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@504815b656669391ce6296e72e5d62d4e0160773 -
Trigger Event:
push
-
Statement type:
File details
Details for the file krewlyzer-0.9.2-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: krewlyzer-0.9.2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2457bd778af9028b23c81130c4e43cb42b71faf5dc16780960c2ab694f367bd
|
|
| MD5 |
8011cf622f61fa7e004bcad35f13e76b
|
|
| BLAKE2b-256 |
38278b7b4b72eeb72ea3e523b5a9575ac0b5c0791475cff3fa2248a9e120994d
|
Provenance
The following attestation bundles were made for krewlyzer-0.9.2-cp311-cp311-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on msk-access/krewlyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krewlyzer-0.9.2-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
c2457bd778af9028b23c81130c4e43cb42b71faf5dc16780960c2ab694f367bd - Sigstore transparency entry: 2587735512
- Sigstore integration time:
-
Permalink:
msk-access/krewlyzer@504815b656669391ce6296e72e5d62d4e0160773 -
Branch / Tag:
refs/tags/0.9.2 - Owner: https://github.com/msk-access
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@504815b656669391ce6296e72e5d62d4e0160773 -
Trigger Event:
push
-
Statement type:
File details
Details for the file krewlyzer-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: krewlyzer-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c13b9808473e86655ca424e6a66918135074f385c4967d7e50feaa6720fd6939
|
|
| MD5 |
5d223066ceeaa29d7f30b2a54c04e87b
|
|
| BLAKE2b-256 |
dd94070ddcdcfe43d2bca08b7b23c482d078ca5e702a518774768f438052cbf2
|
Provenance
The following attestation bundles were made for krewlyzer-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on msk-access/krewlyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krewlyzer-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl -
Subject digest:
c13b9808473e86655ca424e6a66918135074f385c4967d7e50feaa6720fd6939 - Sigstore transparency entry: 2587736542
- Sigstore integration time:
-
Permalink:
msk-access/krewlyzer@504815b656669391ce6296e72e5d62d4e0160773 -
Branch / Tag:
refs/tags/0.9.2 - Owner: https://github.com/msk-access
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@504815b656669391ce6296e72e5d62d4e0160773 -
Trigger Event:
push
-
Statement type: