Skip to content

mlbelab/delnx

Repository files navigation

delnx

PyPI version Tests Codecov pre-commit.ci status Documentation Status

🌸 delnx

delnx ("de-lo-nix" | /dɪˈlɒnɪks/) is a python package for differential expression analysis of (single-cell) genomics data. It enables scalable analyses of atlas-level datasets through GPU-accelerated regression models and statistical tests implemented in JAX.

🚀 Installation

PyPI

pip install delnx

Development version

pip install git+https://github.com/joschif/delnx.git@main

⚡ Quickstart

Negative binomial DE (count data)

import delnx as dx

# Fit negative binomial GLMs with quasi-likelihood dispersion shrinkage
fit = dx.tl.nb_fit(adata, condition_key="treatment", reference="control")

# Test for differential expression
results = dx.tl.nb_test(adata, fit, contrast="treatment[T.drugA]")

General-purpose DE (log-normalized / binary data)

# Logistic regression with likelihood ratio test
results = dx.tl.de(
    adata,
    condition_key="treatment",
    reference="control",
    contrast="treatment[T.drugA]",
)

# Formula-based design with covariates
results = dx.tl.de(
    adata,
    formula="~ treatment + batch",
    contrast="treatment[T.drugA]",
    method="anova",
)

Per-group DE with grouped wrapper

results = dx.tl.grouped(
    dx.tl.de, adata,
    group_key="cell_type",
    condition_key="treatment",
    reference="control",
    contrast="treatment[T.drugA]",
)

Fast rank-based markers

results = dx.tl.rank_de(adata, condition_key="cell_type")

💎 Features

  • Negative binomial GLMs: GPU-accelerated glmGamPoi-style fitting with quasi-likelihood dispersion shrinkage for count data.
  • General-purpose DE: Logistic regression, ANOVA, and binomial GLM for log-normalized, scaled, or binary data.
  • Formula interface: R-style formulas (~ treatment + batch) parsed by patsy, with treatment coding and reference levels.
  • Rank-based markers: Fast AUROC-based one-vs-all marker detection with Numba-optimized ranking.
  • Pseudobulking: Perform DE on large multi-sample datasets by using pseudobulk aggregation.
  • Effect sizes: Log2 fold change and AUROC computation for pairwise condition comparisons.
  • GPU acceleration: Core methods are implemented in JAX, enabling GPU acceleration for scalable DE analysis on large datasets.

📖 Documentation

For more information, check out the documentation and the API reference.

About

Single-cell differential expression

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages