DOI PyPI Tests Coverage Documentation Status

Kompot Logo

Kompot

Kompot is a Python package for differential abundance and gene expression analysis using Gaussian Process models with JAX backend.

Overview

Kompot implements methodologies from the Mellon package for computing differential abundance and gene expression, with a focus on using Mahalanobis distance as a measure of differential expression significance. It leverages JAX for efficient computations and provides a scikit-learn like API with .fit() and .predict() methods.

Key features:

  • Computation of differential abundance between conditions

  • Gene expression smoothing and uncertainty estimation

  • Mahalanobis distance calculation for differential expression significance

  • Weighted log fold change analysis with density difference weighting

  • Support for covariance matrices and optional landmarks

  • JAX-accelerated computations

  • Empirical variance estimation

  • Resource estimation and dry run for planning large analyses

  • Disk-backed covariance storage for sample variance estimation

  • Visualization tools (volcano plots, heatmaps, expression plots)

  • Full scverse compatibility with direct AnnData integration

  • Command-line interface for pipeline integration and batch processing

Use Cases

Kompot is particularly useful for:

  • Comparing cell type abundances across different samples

  • Identifying differentially expressed genes between conditions

  • Integrating multi-sample or multi-batch variability

  • Handling large covariance tensors during sample variance estimation via disk-backed storage

  • Creating visualizations of differential analysis results

Installation

Install from PyPI:

pip install kompot

Or via conda/mamba:

conda install -c bioconda kompot

For optional dependencies and JAX GPU support, see the installation guide.

Quick Start

import kompot

# Minimal call — uses sensible defaults
kompot.de(adata, "condition", "Young", "Old")

# Differential abundance
kompot.da(adata, "condition", "Young", "Old")

# Customize GP and FDR settings
kompot.de(
    adata, "condition", "Young", "Old",
    sample_col="donor_id",
    gp=kompot.GPSettings(sigma=0.5, use_empirical_variance=True),
    fdr=kompot.FDRSettings(threshold=0.01),
)

See AnnData Interface for the full API and all available settings.

New to Kompot? Start with the Getting Started tutorial for a comprehensive introduction to differential abundance and expression analysis.

Ready for more? Explore advanced topics:

  • Advanced Differential Expression - Parameter customization, multiple comparisons, and visualization options

  • Sample Variance Analysis - Accounting for biological replicates in multi-sample studies

  • Gene Expression Smoothing - GP smoothing, uncertainty decomposition, and CITE-seq validation

Command-Line Interface

For pipeline integration and batch processing, use the Command-Line Interface:

# Compute diffusion maps (preprocessing)
kompot dm input.h5ad -o input_dm.h5ad --pca-key X_pca

# Run differential expression
kompot de input_dm.h5ad -o results.h5ad \
  --groupby condition --condition1 control --condition2 treatment \
  --obsm-key DM_EigenVectors

See the CLI documentation for complete usage and examples.

Citation

If you use Kompot in your research, please cite:

Otto, D. J., Arriaga-Gomez, E., Thieme, E., Yang, R., Lee, S. C., & Setty, M. (2025). Comparing phenotypic manifolds with Kompot: Detecting differential abundance and gene expression at single-cell resolution. bioRxiv. https://doi.org/10.1101/2025.06.03.657769

BibTeX:

@article{Otto2025.06.03.657769,
    author = {Otto, Dominik J. and Arriaga-Gomez, Erica and Thieme, Elana and Yang, Ruijin and Lee, Stanley C. and Setty, Manu},
    title = {Comparing phenotypic manifolds with Kompot: Detecting differential abundance and gene expression at single-cell resolution},
    year = {2025},
    doi = {10.1101/2025.06.03.657769},
    publisher = {Cold Spring Harbor Laboratory},
    journal = {bioRxiv},
    URL = {https://www.biorxiv.org/content/10.1101/2025.06.03.657769}
}

Index