Skip to main content
Release Badge nbdev Badge DuckDB Badge Quarto Badge Ask DeepWiki

kreview

Advanced cfDNA Fragmentomics Core Evaluation Engine


🧬 Overview

kreview is a production-grade, notebook-first (nbdev) evaluation engine designed for high-throughput cancer liquid biopsy fragmentomics feature analysis. Developed at Memorial Sloan Kettering (MSKCC), it processes cohorts containing tens of thousands of samples using an embedded DuckDB query engine with chunked I/O and automatic retry logic.

📖 Full Documentation

🚀 Features

  • 5-Tier ctDNA Taxonomy: MSK-IMPACT paired-inference to label True ctDNA+, Possible ctDNA+, Possible ctDNA−, Healthy Normal, and Insufficient Data. Optional CH hotspot demotion via --ch-hotspot-maf.
  • DuckDB Query Engine: In-memory read_parquet bindings with chunked I/O and exponential backoff retry for cohort-scale feature loading.
  • Multi-Model Evaluation: Logistic Regression, Random Forest, and XGBoost (CPU) plus TabPFN and TabICL (GPU) with Stratified K-Fold CV, SHAP explainability, and subgroup analysis.
  • Nested CV Feature Ablation: Automated feature group subset selection via inner-loop cross-validation, eliminating non-informative feature groups before final evaluation. Uses sensitivity_at_100spec_healthy as the optimization metric.
  • Feature Selection: mRMR (Minimum Redundancy Maximum Relevance) as default strategy — iteratively selects features maximizing target relevance while minimizing inter-feature redundancy. Legacy hybrid_union (AUC ∪ MI) also available.
  • Multimodal Stacking: Cross-evaluator fusion via super-matrix with Mutual Information or Boruta-SHAP selection, followed by stacking ensemble + ablation analysis.
  • Interactive Dashboards: Plotly-native HTML reports with ROC curves, violin plots, SHAP beeswarm/waterfall, mRMR scatter plots, per-cancer-type sensitivity tables, and Decision Curve Analysis.
  • Nextflow HPC Integration: Decomposed multistage DAG for SLURM-based HPC execution with per-evaluator parallelism, GPU scheduling, and automatic retry logic.
  • 26 Built-In Evaluators: Modular extractors covering fragment sizes (FSC, FSD, FSR), nucleosome protection (WPS, TFBS), cleavage motifs (EndMotif, BreakPointMotif), chromatin accessibility (ATAC), motif divergence (MDS), and orientation (OCF).

🏗️ Pipeline Architecture

graph LR
    A[Label] --> B["Extract ×N"]
    B --> C[Select]
    C --> D["Ablate (opt)"]
    D --> E["Eval CPU"]
    D --> F["Eval GPU"]
    C --> E
    C --> F
    C --> G[Fuse]
    E --> H[Scoreboard]
    F --> H
    E --> I["Eval Multimodal"]
    F --> I
    G --> I
    H --> J[Report]
    I --> K["Report Multimodal"]

The pipeline runs as a Nextflow multistage DAG — one implementation, scattered per-evaluator. Use -profile docker locally and -profile iris/slurm on HPC. Supported Nextflow: v25–v26.

⚙️ Quick Start

Installation

[!IMPORTANT] Quarto is required for programmatic dashboard generation. kreview declares quarto-cli as a core dependency, so pip install kreview provides the Quarto executable automatically (and the Docker images ship it). If the pip-provided binary misbehaves in your environment, install Quarto from your OS package manager as a fallback (see the Quarto guide).

Option 1: Docker (Recommended "Batteries-Included" Method)

The easiest way to run kreview without managing external dependencies is to use our pre-built Docker containers (hosted on GHCR). They ship with Python 3.12, all ML libraries, and quarto:

# CPU image (~1.5 GB) — for all standard pipeline processes
docker pull ghcr.io/msk-access/kreview:latest

# GPU image (~8-10 GB) — adds PyTorch, TabPFN, TabICL (requires NVIDIA drivers)
docker pull ghcr.io/msk-access/kreview:latest-gpu

# The images are driven by Nextflow, one container per pipeline stage:
nextflow run /path/to/kreview/nextflow/main.nf -profile docker --outdir results/ ...

# Individual stages can also be invoked directly for debugging:
docker run -v /your/data:/data ghcr.io/msk-access/kreview:latest \
  label --cancer-samplesheet /data/cancer.csv ...

Option 2: Local Install (Pip)

quarto-cli is a declared dependency, so a plain pip install provides Quarto. Only if the pip-provided binary misbehaves, install Quarto from your OS manager (e.g. brew install quarto) as a fallback.

git clone https://github.com/msk-access/kreview.git
cd kreview
pip install -e .            # CPU models only
pip install -e ".[all]"     # + arfs feature selection, docs, dev, test (CPU)
pip install -e ".[gpu]"     # + TabPFN, TabICL (requires CUDA)

Running the Pipeline

Local (single machine, Docker)

nextflow run /path/to/kreview/nextflow/main.nf \
  --cancer_samplesheet "/path/to/cancer/samplesheet.csv" \
  --healthy_xs1_samplesheet "/path/to/healthy/xs1/samplesheet.csv" \
  --healthy_xs2_samplesheet "/path/to/healthy/xs2/samplesheet.csv" \
  --cbioportal_dir "/path/to/cBioPortal_MAF_CNA_SV/" \
  --krewlyzer_dir "/path/to/unified_krewlyzer_results" \
  --outdir output/ \
  --strategy mrmr \
  --top_percentile 10 \
  --ch_hotspot_maf "/path/to/ch_hotspots.maf" \
  -profile docker

Individual stages are also available as subcommands (kreview label, extract, select, eval cpu|gpu, fuse, report) for debugging a single step outside the DAG.

HPC (Nextflow + SLURM)

nextflow run /path/to/kreview/nextflow/main.nf \
  --cancer_samplesheet /path/to/cancer.csv \
  --healthy_xs1_samplesheet /path/to/healthy_xs1.csv \
  --healthy_xs2_samplesheet /path/to/healthy_xs2.csv \
  --cbioportal_dir /path/to/cbioportal/ \
  --krewlyzer_dir /path/to/manifest.txt \
  --outdir /path/to/output/ \
  --run_gpu_eval true \
  --gpu_models "tabpfn,tabicl" \
  --run_ablation true \
  --run_multimodal_eval true \
  -profile iris

Dashboard Access

Once finished, open the generated HTML reports:

open output/reports/ATAC_dashboard.html

🧪 Feature Selection

Strategy Scope Method Default
mrmr Single-evaluator F-statistic relevance + Pearson redundancy penalty
hybrid_union Single-evaluator Top-X% AUC ∪ Top-X% MI Legacy
Nested CV ablation Single-evaluator Inner CV on feature group subsets → best subset per model Optional (--run-ablation)
mi Multimodal Mutual Information top-K ranking
boruta_shap Multimodal SHAP importance vs shadow variables (50 trials) Optional

See Statistical Evaluation for full documentation.

📓 nbdev Architecture

This project operates as an nbdev repo. Do not edit .py scripts manually in kreview/. Build natively inside Jupyter notebooks within nbs/ and trigger:

nbdev-export && black kreview/   # note: `python3 -m nbdev.export` is a silent no-op

📚 Resources

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kreview-0.0.29.tar.gz (220.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kreview-0.0.29-py3-none-any.whl (197.7 kB view details)

Uploaded Python 3

File details

Details for the file kreview-0.0.29.tar.gz.

File metadata

  • Download URL: kreview-0.0.29.tar.gz
  • Upload date:
  • Size: 220.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for kreview-0.0.29.tar.gz
Algorithm Hash digest
SHA256 c44ef5c68d9f31b2c478389ab1d39ce9bbcb818efeadd118fa94d31c38138a11
MD5 c6ba641cedd95b68b06ec450c14df0c1
BLAKE2b-256 0596a411e409a3cba5f36735dcdead682d52762117b0a3e4a27de402fb7fa43e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kreview-0.0.29.tar.gz:

Publisher: release.yml on msk-access/kreview

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kreview-0.0.29-py3-none-any.whl.

File metadata

  • Download URL: kreview-0.0.29-py3-none-any.whl
  • Upload date:
  • Size: 197.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for kreview-0.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 684e39552cdfe406ca36edc91ac15403daa9ba446fb5ba1a0c9a5468919d9b5b
MD5 ae95fc5e203fab5b105d5421d696f7c5
BLAKE2b-256 8eb0d7294cbc8d5b2b98b176f436c668f015c5af893bae09f064e7f95dcd26ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for kreview-0.0.29-py3-none-any.whl:

Publisher: release.yml on msk-access/kreview

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.33

2 files

0.0.32

2 files

0.0.31

2 files

0.0.30

2 files

This release

0.0.29 This release

2 files

0.0.28

2 files

0.0.27

2 files

0.0.26

2 files

0.0.25

2 files

0.0.24

2 files

0.0.23

2 files

0.0.22

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.3

2 files

0.0.1

2 files

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