Pure-Python port of URD — branching pseudotime / tree inference (Farrell et al. Science 2018).
Project description
py-URD
A Python port of URD (Farrell et al., Science 2018) — branching trajectory inference for single-cell RNA-seq via flood-based pseudotime + biased random walks.
- Pure NumPy / SciPy implementation
- v0.1 ships the core algorithmic pipeline:
floodPseudotime— probabilistic BFS over the diffusion-map transition graphfloodPseudotimeProcess— aggregate runs into a per-cell pseudotimesimulateRandomWalksFromTips— biased random walks for lineage attributionprocessRandomWalks— collapse walks into per-cell visit frequencies
- Pseudotime parity vs R URD on Guo qPCR data (428 cells): Spearman 0.985, Pearson 0.992 (threshold 0.80).
Install
pip install pyurd-bio
(module name is pyurd; the PyPI distribution name pyurd was taken, so this package ships as pyurd-bio.)
Quick-start
import pydestiny, pyurd
# 1. Diffusion map for the transition matrix
dm = pydestiny.DiffusionMap.fit(expression, sigma="local", n_eigs=10)
# 2. URD object wrapping cells + transition matrix
urd = pyurd.URD(cell_names=cell_ids, transitions=dm.transitions,
dm_eigenvectors=dm.eigenvectors, dm_eigenvalues=dm.eigenvalues)
# 3. Flood pseudotime from a cluster of root cells
floods = pyurd.floodPseudotime(urd, root_cells=root_ids, n=50,
minimum_cells_flooded=1, seed=42)
pt = pyurd.floodPseudotimeProcess(floods, max_frac_NA=0.9)["pseudotime"]
# 4. Biased random walks from tips
walks = pyurd.simulateRandomWalksFromTips(
urd, pseudotime=pt,
tip_cells={"lineage_A": [cell_a1, cell_a2], "lineage_B": [cell_b1]},
n_per_tip=1000, seed=42)
visit_freq = pyurd.processRandomWalks(walks)
Function map
| Python | R | Status |
|---|---|---|
floodBuildTM |
floodBuildTM |
✅ |
floodPseudotimeCalc |
floodPseudotimeCalc |
✅ |
floodPseudotime |
floodPseudotime |
✅ |
floodPseudotimeProcess |
floodPseudotimeProcess |
✅ |
simulateRandomWalksFromTips |
simulateRandomWalksFromTips |
✅ (simplified) |
processRandomWalks |
processRandomWalks |
✅ |
URD / createURD |
URD class (S4) / createURD |
✅ (minimal) |
buildTree |
buildTree |
⏳ v0.2 |
loadTipCells |
loadTipCells |
⏳ v0.2 |
tipPotential |
tipPotential |
⏳ v0.2 |
treeForceDirectedLayout |
treeForceDirectedLayout |
⏳ v0.2 |
| ~110 plotting / S4-method / dropseq-import / NMF-doublets functions | (various) | ⛔ v0.3+ |
Known limitations (v0.1)
- Tree-building deferred (
buildTree,assignCellsToSegments, divergence statistics) → v0.2. - Tip selection algorithms (
tipPotential,clusterTipPotential) deferred → v0.2. - Force-directed tree layout deferred → v0.2.
- Random walks in v0.1 use only the forward/back biasing by pseudotime; R's URD also supports a step-size weighting and a more nuanced cell-distance threshold that we will add in v0.2.
- dropseq DGE preprocessing, NMF doublets, batch correction, gene cascades, impulse models — all deferred to v0.3+ (these are large standalone modules in URD that we won't reproduce in Python).
Citation
Farrell, J. A. et al. Single-cell reconstruction of developmental trajectories during zebrafish embryogenesis. Science 360, eaar3131 (2018).
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyurd_bio-0.2.0.tar.gz.
File metadata
- Download URL: pyurd_bio-0.2.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
409aafb43225a45c5b0900fb37a5176f4af9c90a26a1122bfea50f12f48ca793
|
|
| MD5 |
b1601dee87e222f7ffb0d70a34913488
|
|
| BLAKE2b-256 |
5c7d6be775347abd123cfb3d00a9f88073224b17508cee00ab2fdf11b9842344
|
Provenance
The following attestation bundles were made for pyurd_bio-0.2.0.tar.gz:
Publisher:
publish.yml on omicverse/py-URD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyurd_bio-0.2.0.tar.gz -
Subject digest:
409aafb43225a45c5b0900fb37a5176f4af9c90a26a1122bfea50f12f48ca793 - Sigstore transparency entry: 1628913918
- Sigstore integration time:
-
Permalink:
omicverse/py-URD@8caf5c57a623a374224ef8e9baf9191b448bf243 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/omicverse
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8caf5c57a623a374224ef8e9baf9191b448bf243 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyurd_bio-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyurd_bio-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dc667dcd1dcc7c3baa298348b3032b011662a227f662569c6388fe89cbedf5c
|
|
| MD5 |
87a0bdd88028498482c4468ee525f5eb
|
|
| BLAKE2b-256 |
9c46db3095f514bc008d4953722f67c6eec33c40c0b4e5067b6f3f7b722598b1
|
Provenance
The following attestation bundles were made for pyurd_bio-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on omicverse/py-URD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyurd_bio-0.2.0-py3-none-any.whl -
Subject digest:
1dc667dcd1dcc7c3baa298348b3032b011662a227f662569c6388fe89cbedf5c - Sigstore transparency entry: 1628913930
- Sigstore integration time:
-
Permalink:
omicverse/py-URD@8caf5c57a623a374224ef8e9baf9191b448bf243 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/omicverse
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8caf5c57a623a374224ef8e9baf9191b448bf243 -
Trigger Event:
workflow_dispatch
-
Statement type: