Skip to main content

Pure-Python port of dyneval — trajectory inference benchmark metrics (Saelens et al. Nat Biotechnol 2019).

Project description

py-dyneval

A Python port of dynverse/dyneval (Saelens et al. Nat Biotechnol 2019) — the metric library used by the dynbenchmark trajectory inference benchmark.

  • Pure NumPy / SciPy / NetworkX / scikit-learn — no R
  • Depends on pydynwrap for trajectory wrappers + geodesic distances
  • 8/14 dyneval metric IDs ported in v0.1

Install

pip install pydyneval-bio   # pulls in pydynwrap-bio

Quick-start

import pydyneval as de
import pydynwrap as dw
import numpy as np

gold = dw.wrap_data([f"c{i}" for i in range(30)])
gold = dw.add_branch_trajectory(gold,
    pseudotime=np.tile(np.linspace(0,1,10), 3),
    branch=np.repeat(["A","B","C"], 10))

pred = dw.wrap_data([f"c{i}" for i in range(30)])
pred = dw.add_branch_trajectory(pred,
    pseudotime=np.tile(np.linspace(0,1,10), 3),
    branch=np.repeat(["A","B","C"], 10))

scores = de.calculate_metrics(gold, pred)
print(scores)
#    correlation  him  edge_flip  isomorphic  F1_branches  F1_milestones ...
# 0          1.0  1.0        1.0         1.0          1.0           1.0

Function map

Python R dyneval:: Status
calculate_metrics(dataset, model, metrics=...) same
calculate_him(net1, net2) same ✅ (Lorentzian inline)
calculate_edge_flip(net1, net2) same ✅ (Jaccard surrogate)
calculate_isomorphic(net1, net2) (implicit)
calculate_mapping_branches(dataset, prediction) same
calculate_mapping_milestones(dataset, prediction) same
calculate_featureimp_cor(dataset, model) same
calculate_featureimp_enrichment (ks / wilcox) ⏳ v0.2
calculate_position_predict (rf_mse / rf_rsq / lm_*) ⏳ v0.2
evaluate_ti_method ⛔ v0.3+ (depends on TI runners)

R parity on canonical fixture (3-branch, 30 cells × 50 genes)

| Metric | R | Py | |Δ| | |---|---|---|---| | correlation | 0.9812 | 0.9813 | 0.0001 | | him | 1.0 | 1.0 | 0.0 | | edge_flip | 1.0 | 1.0 | 0.0 | | isomorphic | 1.0 | 1.0 | 0.0 | | F1_branches | 1.0 | 1.0 | 0.0 | | F1_milestones | 0.6667 | 0.6667 | 0.0 | | featureimp_cor | 0.9622 | 0.9005 | 0.0617 | | featureimp_wcor | 0.9664 | 0.9548 | 0.0115 |

featureimp_* differs slightly because of Random Forest non-determinism between R randomForest and sklearn RandomForestRegressor — both implement Breiman 2001 with the same hyperparameters; tree-splitting RNG differs.

Citation

Saelens, W. et al. A comparison of single-cell trajectory inference methods. Nat Biotechnol 37, 547–554 (2019).

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

pydyneval_bio-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

pydyneval_bio-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydyneval_bio-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydyneval_bio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 513e4598982cf650744288ef843411cb7f00f73c6a0eea06d9a8e1ff2bc1ebe1
MD5 2cf939563da1d03add3ebd9ad49497ea
BLAKE2b-256 1009c4da20c672662f18774259ef6252c3cc38b03dfc335913aff8a2e4f3bf20

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydyneval_bio-0.1.0.tar.gz:

Publisher: publish.yml on omicverse/py-dyneval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pydyneval_bio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydyneval_bio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b1a61f43cf2a7c253f776c0c0e42d1dfb89bf5b56571d62ce7fe03347089a5a
MD5 924fc2a5f0cf625e14f88f73c400623e
BLAKE2b-256 a6b6053b3cae2cbb3cabd698f02d10f052a69bbb8846f8aed3c01dc076083aee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydyneval_bio-0.1.0-py3-none-any.whl:

Publisher: publish.yml on omicverse/py-dyneval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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