Skip to main content

RegDiffusion logo

Downloads Downloads PyPI - Version

RegDiffusion is an open-source Python package for gene regulatory network (GRN) inference from single-cell RNA-seq data using probabilistic diffusion models. It learns candidate regulatory relationships from gene expression data without requiring a ground-truth network for training, and includes tools to evaluate, export, and visualize inferred networks.

Documentation · Quick start · FAQ · PyPI · Paper

What can RegDiffusion do?

  • Infer GRNs from a cells-by-genes expression matrix with GPU acceleration or on CPU.
  • Accept log-transformed NumPy arrays or SciPy sparse matrices through the Python API. The CLI accepts raw counts in CSV or H5AD files and performs the log transformation.
  • Work with large gene sets using memory-efficient training.
  • Export inferred edges for downstream pySCENIC analysis.

The project reports inference on a 15,000-gene network in under five minutes on an NVIDIA A100 GPU. Runtime and memory use depend on dataset size, hardware, and training settings; see the large-network guide for memory benchmarks. Inferred edges are hypotheses for follow-up analysis, not experimental proof of regulation.

Zhu H, Slonim D. From Noise to Knowledge: Diffusion Probabilistic Model-Based Neural Inference of Gene Regulatory Networks. J Comput Biol. 2024 Nov;31(11):1087-1103. doi: 10.1089/cmb.2024.0607. Epub 2024 Oct 10. PMID: 39387266; PMCID: PMC11698671.

Installation

RegDiffusion is on pypi.

pip install regdiffusion

Check out this tutorial for a quick tour of how to use RegDiffusion! If you would like to integrate results from RegDiffusion into the SCENIC pipeline, checkout this tutorial.

New in v0.2

  • Memory-efficient mode: Set memory_efficient=True in RegDiffusionTrainer to reduce peak GPU memory by ~45%, making it easier to work with large gene sets on consumer GPUs (You can now fit 20k genes on a 16GB GPU).
  • Sparse matrix support: RegDiffusionTrainer now accepts scipy sparse matrices directly (e.g., adata.X), enabling training on datasets with 1M+ cells without excessive memory usage.

Inferred Networks from RegDiffusion

Here are two examples of inferred networks from regdiffusion. The networks are coherent with existing literature and across datasets.

Inferred gene regulatory networks around APOE

Inference Speed

The project reports inference on a 15,000-gene network in under five minutes on an NVIDIA A100 GPU, or roughly three hours on a 12-core CPU. These timings depend on the dataset and training settings. See the paper for the method's evaluation and the large-network guide for memory benchmarks.

CLI tool

regdiffusion has a CLI tool now! It takes a count matrix as the input (different from the main API, which needs the data to be log transformed) and returns a table of inferred edges.

usage: regdiffusion [-h] [--output OUTPUT] [--top_gene_percentile TOP_GENE_PERCENTILE] [--k K] [--workers WORKERS] input

Infer a gene regulatory network (GRN) from a single-cell count dataset.

positional arguments:
  input                 Input single-cell count dataset file (CSV or H5AD format).

options:
  -h, --help            show this help message and exit
  --output OUTPUT       Output file path for the edgelist (CSV). Default: rd_grn.csv
  --top_gene_percentile TOP_GENE_PERCENTILE
                        Percentile cutoff to filter weak edges (e.g., 50 for the top 50%). Default: 50
  --k K                 Number of edges per gene to extract (-1 for all edges). Default: -1
  --workers WORKERS     Number of workers to use for edgelist extraction. Default: 4

Citation

If you find our package useful, consider citing our paper! =)

@article{zhu2024noise,
  title={From Noise to Knowledge: Diffusion Probabilistic Model-Based Neural Inference of Gene Regulatory Networks},
  author={Zhu, Hao and Slonim, Donna},
  journal={Journal of Computational Biology},
  volume={31},
  number={11},
  pages={1087--1103},
  year={2024},
  doi={10.1089/cmb.2024.0607},
  url={https://doi.org/10.1089/cmb.2024.0607}
}

Metadata

Release files for regdiffusion 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for regdiffusion 0.2.5
File Interpreter ABI Platform Actions
regdiffusion-0.2.5-py2.py3-none-any.whl Python 2, Python 3 none any Details for regdiffusion-0.2.5-py2.py3-none-any.whl

Release files / regdiffusion-0.2.5-py2.py3-none-any.whl

Download URL regdiffusion-0.2.5-py2.py3-none-any.whl
Size 43.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
622b3ecfd154e11328cfb3c7975e79d737f3545f314875b0333ebb8cb6a03e64
BLAKE2b-256 checksum
How to use checksums
2318d552ce4735c3b40525fef046a5ce8aa16589a4229c3d810b5304ca3fbced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Security for regdiffusion 0.2.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

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