Skip to main content

Evaluate cfDNA fragmentomics features for ctDNA detection

Project description

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 Dynamic Data Lake: In-memory read_parquet bindings with chunked I/O and exponential backoff retry. Builds a merged SQL-queryable kreview_lake.duckdb on demand.
  • 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.
  • 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["Eval CPU"]
    C --> E["Eval GPU"]
    C --> F[Fuse]
    D --> G["Eval Multimodal"]
    E --> G
    F --> G
    G --> H[Report]

The pipeline supports two modes:

Mode Command Use Case
Monolithic kreview run Single-machine, sequential execution
Multistage nextflow run ... -profile iris HPC parallelism, per-evaluator scatter

⚙️ Quick Start

Installation

[!IMPORTANT] Quarto is strictly required for programmatic dashboard generation. Because quarto-cli wrapper packages are unreliable across Python environments, kreview assumes the Quarto executable is installed dynamically on your OS or container.

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

The easiest way to run kreview without managing external dependencies is to use our pre-built Docker container (hosted on GHCR). It natively ships with Python 3.12, all ML libraries, and the underlying quarto linux binaries configured flawlessly:

docker pull ghcr.io/msk-access/kreview:latest
docker run -v /your/data:/data ghcr.io/msk-access/kreview:latest \
  kreview run --cancer-samplesheet /data/cancer.csv ...

Option 2: Local Install (Pip)

If you install via pip, you must separately install Quarto via your OS manager:

  1. Install Quarto: Follow the official Quarto Installation Guide (e.g. brew install quarto on macOS).
  2. Install kreview:
git clone https://github.com/msk-access/kreview.git
cd kreview
pip install -e .          # CPU models only
pip install -e ".[gpu]"   # + TabPFN, TabICL (requires CUDA)

Running the Pipeline

Local (Single Machine)

kreview run \
  --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" \
  --output output/ \
  --strategy mrmr \
  --top-percentile 10 \
  --compute-univariate-auc \
  --ch-hotspot-maf "/path/to/ch_hotspots.maf" \
  --export-duckdb

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/ \
  --pipeline_mode multistage \
  --run_gpu_eval true \
  --gpu_models "tabpfn,tabicl" \
  --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
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

📚 Resources

Project details


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.13.tar.gz (153.5 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.13-py3-none-any.whl (155.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kreview-0.0.13.tar.gz
Algorithm Hash digest
SHA256 df5f5087683e7d63b55ca7d395dbe0597e5d5ee18afbeb38a2d8b95118216121
MD5 484617932ab9774448552a9c5f8d7275
BLAKE2b-256 92b669a750324f1421a6a802f471b61b1dfc3ebb7815a3b84e7293ca8220fc4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kreview-0.0.13.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.13-py3-none-any.whl.

File metadata

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

File hashes

Hashes for kreview-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 6f3232c7a3a0e0946c9709845650a9db6d19797b5814f3023e6b155a3a3ed72b
MD5 59ddf8a4e43db00979998119acdcee64
BLAKE2b-256 a384960e86a1a531a0940be337e1913abc7c77328669d147cde7eccae8ea9494

See more details on using hashes here.

Provenance

The following attestation bundles were made for kreview-0.0.13-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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page