gedi2py
Gene Expression Decomposition for Integration
A scverse-compliant Python package for single-cell RNA-seq batch correction and dimensionality reduction using the GEDI algorithm.
Overview
gedi2py implements a latent variable model for integrating single-cell RNA sequencing data across multiple samples and batches. It learns shared gene expression patterns while correcting for technical batch effects, producing batch-corrected cell embeddings suitable for downstream analysis.
Installation
pip (recommended)
pip install gedi2py
From source
git clone https://github.com/csglab/gedi2py.git
cd gedi2py
pip install -e .
Requirements
- Python >= 3.10
- C++14 compiler
- Eigen3 >= 3.3.0
- CMake >= 3.15
See the Installation Guide for detailed instructions.
Quick Start
import gedi2py as gd
import scanpy as sc
# Load data
adata = sc.read_h5ad("data.h5ad")
# Preprocess
sc.pp.normalize_total(adata)
sc.pp.log1p(adata)
# Run GEDI batch correction
gd.tl.gedi(adata, batch_key="sample", n_latent=10)
# Visualize
gd.tl.umap(adata)
gd.pl.embedding(adata, color=["sample", "cell_type"])
Features
- Memory-efficient: C++ backend keeps large matrices in native memory
- Fast: OpenMP parallelization for multi-threaded optimization
- scverse-compliant: Works seamlessly with AnnData and scanpy
- Flexible: Supports counts, log-transformed data, paired data (e.g., CITE-seq), and binary indicators
- Comprehensive: Includes projections, embeddings, imputation, and differential analysis
Paired Data Mode (M_paired)
gedi2py supports paired count data stored in two AnnData layers, useful for:
- CITE-seq (ADT vs RNA)
- Dual-modality assays
- Ratio-based analyses
# Two layers: 'm1' (numerator counts) and 'm2' (denominator counts)
# GEDI models: Yi = log((M1+1)/(M2+1))
gd.tl.gedi(
adata,
batch_key="sample",
layer="m1", # First count matrix
layer2="m2", # Second count matrix
n_latent=10
)
Documentation
Full documentation is available at csglab.github.io/gedi2py:
API Overview
gedi2py follows the scanpy convention with submodules:
| Module | Description |
|---|---|
gd.tl |
Tools: model training, projections, embeddings, imputation, differential |
gd.pl |
Plotting: embeddings, convergence, features |
gd.io |
I/O: H5AD, 10X formats, model persistence |
import gedi2py as gd
# Tools
gd.tl.gedi(adata, batch_key="sample")
gd.tl.umap(adata)
# Plotting
gd.pl.embedding(adata, color="cell_type")
gd.pl.convergence(adata)
# I/O
adata = gd.read_h5ad("data.h5ad")
gd.io.save_model(adata, "model.h5")
Citation
If you use gedi2py in your research, please cite:
Mikaeili Namini, A., & Najafabadi, H.S. (2024). GEDI: Gene Expression Decomposition for Integration of single-cell RNA-seq data.
License
MIT License - see LICENSE for details.
Links
Metadata
Release files for gedi2py 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gedi2py-0.2.0.tar.gz | 106.4 kB | With provenance | Details for gedi2py-0.2.0.tar.gz |
Release files / gedi2py-0.2.0.tar.gz
| Download URL | gedi2py-0.2.0.tar.gz |
|---|---|
| Size | 106.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3594a1e4f88596a843436f9b9d418ec3c5d43793ba2d644b193ef9985e49e0ef
|
|
BLAKE2b-256 checksum How to use checksums |
248ef78aae3637ab15c3761696cce6438f4222f664fc8e7664fe89c5cf4345a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.
Transparency logSecurity for gedi2py 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
1 file in this release has been uploaded with provenance metadata.
Attestation for gedi2py-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.