Skip to main content

pyedger

A pure-Python port of Bioconductor edgeR (Robinson, McCarthy & Smyth, Bioinformatics 2010) — negative-binomial models for differential expression of count data.

  • No rpy2, no R install — the edgeR negative-binomial GLM workflow reimplemented in NumPy / SciPy, vectorised over genes
  • Matches Bioconductor edgeR 4.10 numerically (see Numerical parity)
  • The canonical pipelines: DGEList → calcNormFactors → estimateDisp → glmQLFit → glmQLFTest and the classic exactTest
  • TMM normalization, common / trended / tagwise dispersion, GLM and quasi-likelihood F-tests, filterByExpr, cpm / aveLogCPM
  • Both Python-style (glm_fit, estimate_disp, top_tags) and R-style (glmFit, estimateDisp, topTags) names exported

This is a standalone mirror of the implementation developed in omicverse, where it powers the edgeR differential-expression backend of ov.bulk / pyDEG.

Install

pip install pyedger

Quick start

import numpy as np
import pyedger

# counts: genes x samples raw count matrix; group: per-sample condition labels
dge = pyedger.DGEList(counts=counts, group=group)
dge = pyedger.calcNormFactors(dge)                       # TMM normalization
keep = pyedger.filterByExpr(dge, group=group)
dge = dge[keep]

# Quasi-likelihood F-test workflow (the recommended edgeR pipeline)
dge = pyedger.estimateDisp(dge, design)
fit = pyedger.glmQLFit(dge, design)
qlf = pyedger.glmQLFTest(fit, coef=1)
res = pyedger.topTags(qlf, n=np.inf)
res.head()

Classic exact test

dge = pyedger.estimateDisp(dge, design)
et = pyedger.exactTest(dge, pair=("control", "treated"))
pyedger.topTags(et)

API

Python R counterpart
DGEList DGEList
calc_norm_factors / calcNormFactors calcNormFactors (TMM)
filter_by_expr / filterByExpr filterByExpr
estimate_disp / estimateDisp estimateDisp
glm_fit / glmFit, glm_lrt / glmLRT glmFit, glmLRT
glm_ql_fit / glmQLFit, glm_qlf_test / glmQLFTest glmQLFit, glmQLFTest
exact_test / exactTest exactTest
glm_treat / glmTreat glmTreat
cpm, ave_log_cpm / aveLogCPM cpm, aveLogCPM
top_tags / topTags topTags
decide_tests_dge / decideTests decideTestsDGE
DGEGLM, DGELRT, DGEExact, TestResults the corresponding S4 classes

Numerical parity with edgeR

tests/test_r_parity.py checks pyedger against edgeR 4.10.5 (R 4.5.3, limma 3.68.5, locfit 1.5-9.12) on a paired design with zero-count library pairs, a Milo-style design and limma hyperparameter cases; the reference values are regenerated by tests/data/make_reference.R. The GLM kernels follow edgeR's compiled code step by step and run vectorised over all genes:

Step Ported from Agreement with R
glmFit (Levenberg, one-way shortcut, start values) glm.c ~1e-9
estimateDisp with a design (Cox-Reid APL, zero-fit groups) and classic mode compute_apl.c, q2qnbinom ~1e-10
Trend: locfitByCol locfit tree evaluation + interpolation bit-identical
squeezeVar (fitFDist, fitFDistUnequalDF1, fitFDistRobustly) limma 3.68 ~1e-11
glmQLFit(legacy=False) (new QL) given a dispersion ql_glm.c ~1e-9
glmQLFit(legacy=True), exactTest, glmTreat ~1e-10

glmQLFit(legacy=False) without a dispersion and estimateGLMCommonDisp estimate the NB dispersion with edgeR's optimize(tol=1e-5) over dispersion^(1/4); R's own value is only defined to ~4e-5 relative, and agreement there is at that level (p-values ~1e-4 relative on the test data). On real data the agreement is usually much closer: on four GSE274113 pseudobulk ATAC comparisons (~170k peaks x 26 samples, ~ library + condition, default new QL) p-values agreed to < 1e-7 relative with identical FDR < 0.1 calls.

Defaults follow edgeR 4.10: glmQLFit(legacy=False, abundance_trend=True), estimateDisp(prior_df=None) with the chooseLowessSpan span.

Citation

Robinson, M.D., McCarthy, D.J., Smyth, G.K. edgeR: a Bioconductor package for differential expression analysis of digital gene expression data. Bioinformatics 26(1), 139–140 (2010).

…and acknowledge omicverse / this repo for the Python port.

License

LGPL-3.0-or-later — matches the upstream Bioconductor package.

Metadata

Release files for pyedger 0.2.0

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

Source distribution (sdist)

Source distribution for pyedger 0.2.0
File Size Uploaded Provenance
pyedger-0.2.0.tar.gz 86.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyedger 0.2.0
File Interpreter ABI Platform
pyedger-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 169.1 kB

Release files / pyedger-0.2.0.tar.gz

Download URL pyedger-0.2.0.tar.gz
Size 86.7 kB
Tags Source
SHA-256 checksum
How to use checksums
34b0c8f2a47def167ada2cf1c6fad25aa85c8d13792db82048b3ec680c230a6c
BLAKE2b-256 checksum
How to use checksums
02e6431a4166ebce4488727df8fd81972905bab836210767f207eb7bb986e744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 11, 2026.

Transparency log

Release files / pyedger-0.2.0-py3-none-any.whl

Download URL pyedger-0.2.0-py3-none-any.whl
Size 82.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c397d6985de1753f04da322de1b8513c8719085ce3e23607112f57e1f04b8d68
BLAKE2b-256 checksum
How to use checksums
0faef921a2101055e60d083e539e013170385692d9d1348614e2db38b4f24b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 11, 2026.

Transparency log

Security for pyedger 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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyedger-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 Oct 11, 2026.

Transparency log

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.

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