Skip to main content

py-tradeSeq

A Python port of tradeSeq (Van den Berge et al., Nature Communications 2020) — trajectory-based differential expression analysis for single-cell RNA-seq.

  • AnnData-compatible
  • Fits NB GAM per gene per lineage via statsmodels.gam.GLMGam
  • Inference-class parity: Spearman = 0.84 on -log10 p, top-50 Jaccard = 0.67 vs R associationTest
  • 5× faster than R fitGAM on canonical fixture

Install

pip install pytradeseq

Quick-start

import numpy as np
from pytradeseq import fitGAM, associationTest, startVsEndTest

# pseudotime: cells × lineages; cellWeights: cells × lineages
gams = fitGAM(counts, pseudotime=pt, cellWeights=cw, nknots=6)

# Which genes vary along pseudotime?
at = associationTest(gams)
print(at.sort_values('pvalue').head(20))

# Which genes differ between trajectory endpoints?
svet = startVsEndTest(gams)

Function map

Python R counterpart Purpose
fitGAM fitGAM fit NB-GAM per gene per lineage
associationTest associationTest Wald test against null (pseudotime-independent) — parity-validated
startVsEndTest startVsEndTest endpoint comparison — approximate
diffEndTest diffEndTest between-lineage endpoint comparison
patternTest patternTest between-lineage curve-shape comparison
earlyDETest earlyDETest restricted patternTest on early pt
nknots nknots return knot count of a fit
evaluateK evaluateK AIC scan over candidate knots

Parity status

Test Metric Threshold Measured Pass
associationTest p-value Spearman on -log10 p ≥ 0.70 0.84 ✅
associationTest top-50 Jaccard ≥ 0.60 0.67 ✅
startVsEndTest Spearman — 0.45 (approximate) 🟡

The startVsEndTest lower number reflects a known divergence from R's joint id=1 tied-smoothness fitting. v0.2 will switch to a joint-GLM formulation.

Known limitations (v0.1)

  1. statsmodels.gam ≠ mgcv: different penalty + smoothness-selection algorithms. Inference rankings agree (Spearman > 0.7 on associationTest) but individual p-values are NOT bit-equivalent.
  2. startVsEndTest / diffEndTest: per-lineage independent smoother fitting differs from R's joint-fit-with-tied-smoothness. v0.2.
  3. 9/18 functions deferred to v0.2+: conditionTest, clusterExpressionPatterns, cascade, predictSmooth, predictCells, all plotting.
  4. No AnnData class API yet — functional API only. v0.2.

Citation

Van den Berge, K. et al. Trajectory-based differential expression analysis for single-cell sequencing data. Nature Communications 11, 1201 (2020).

License

MIT.

Metadata

Release files for pytradeseq 0.1.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 pytradeseq 0.1.0
File Size Uploaded Provenance
pytradeseq-0.1.0.tar.gz 16.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 31.6 kB

Release files / pytradeseq-0.1.0.tar.gz

Download URL pytradeseq-0.1.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7c7e0751d27faaa1794b1d4653a24632b1edcf2647e311633ae8ca2602b97a51
BLAKE2b-256 checksum
How to use checksums
5dfa6640e9f205b35227484beccaed7da3a7cfde9c18cd77e23db9469a656f3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release files / pytradeseq-0.1.0-py3-none-any.whl

Download URL pytradeseq-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e7571a11e345b3c7e1b0722edae4236de8a01afcc71141ad074dcf269eb76fd
BLAKE2b-256 checksum
How to use checksums
d0619b8b49dc067d85c61c0877486755ae586fa9a046a302ea1379d202802803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Security for pytradeseq 0.1.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.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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