Skip to main content

Pure-Python port of tradeSeq — trajectory-based differential expression analysis for scRNA-seq (Van den Berge et al. 2020).

Project description

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.gammgcv: 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytradeseq-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytradeseq-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file pytradeseq-0.1.0.tar.gz.

File metadata

  • Download URL: pytradeseq-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for pytradeseq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c7e0751d27faaa1794b1d4653a24632b1edcf2647e311633ae8ca2602b97a51
MD5 0e3f5e7b28e7b299de75c6c58b3213a5
BLAKE2b-256 5dfa6640e9f205b35227484beccaed7da3a7cfde9c18cd77e23db9469a656f3b

See more details on using hashes here.

File details

Details for the file pytradeseq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytradeseq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for pytradeseq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e7571a11e345b3c7e1b0722edae4236de8a01afcc71141ad074dcf269eb76fd
MD5 bb343629589181c4453060417789b2cc
BLAKE2b-256 d0619b8b49dc067d85c61c0877486755ae586fa9a046a302ea1379d202802803

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page