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.0 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.0.16 (R 4.3.3, limma 3.58.1, locfit 1.5-9) on a paired design with zero-count library pairs; the reference values are regenerated by tests/data/make_reference.R. Since 0.1.1 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_levenberg.cpp, glm_one_group.cpp ~1e-9
estimateDisp with a design (Cox-Reid APL, zero-fit groups) and classic mode R_compute_apl.cpp, adj_coxreid.cpp, q2qnbinom ~1e-10
Trend: locfitByCol locfit tree evaluation + interpolation bit-identical
maximizeInterpolant, aveLogCPM interpolator.cpp, R_ave_log_cpm.cpp ~1e-13
squeezeVar / fitFDist with a covariate limma (natural-spline trend) ~1e-14
glmQLFit(legacy=False) bias-adjusted deviance/df ql_glm.c, ql_weights.c, .computePriorS2 ~1e-10

glmQLFit(legacy=False) and estimateGLMCommonDisp depend on edgeR's optimize(tol=1e-5) over dispersion^(1/4), so R's own value is only defined to ~4e-5 relative; agreement there is at that level.

Defaults follow edgeR 4.0: glmQLFit(legacy=True, abundance_trend=True) and estimateDisp(prior_df=None) (prior df estimated).

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

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.1.2
File Size Uploaded Provenance
pyedger-0.1.2.tar.gz 79.8 kB With provenance Details

Built distribution (wheel)

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

Total release size: 156.6 kB

Release files / pyedger-0.1.2.tar.gz

Download URL pyedger-0.1.2.tar.gz
Size 79.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dda087665133471383908d2f76b0c62cca446e1464e7e4334e9a3b5c1db3206f
BLAKE2b-256 checksum
How to use checksums
241a8988dc4ad42f8659e7852d4fbee8e35aca54532017a296052281fac3127f
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.1.2-py3-none-any.whl

Download URL pyedger-0.1.2-py3-none-any.whl
Size 76.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4bb1aeb1c8f02883085078f360449aad35a18561245df557ec0ee5d88a3a97d
BLAKE2b-256 checksum
How to use checksums
6ca4b75bff83f97bdbcc6c8671ff80a1c8a97e887e185afed10e79e940d09a42
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.1.2

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