Skip to main content

Pure-Python port of SCORPIUS — linear-trajectory inference for single-cell RNA-seq via MDS + principal curves.

Project description

py-SCORPIUS

A pure-Python port of SCORPIUS (Cannoodt et al., bioRxiv 2016) for linear-trajectory inference in single-cell RNA-seq.

  • AnnData-compatible (cells × genes)
  • No rpy2 — pure NumPy / SciPy / scikit-learn
  • Same function surface as the R workflow (reduce_dimensionalityinfer_trajectoryextract_modulesgene_importances)
  • Pseudotime Pearson = 0.989 vs R SCORPIUS on canonical fixture
  • Low-dim space Procrustes = 0.999 vs R

Install

pip install pyscorpius
# Optional — for extract_modules:
pip install pyscorpius[modules]

Quick-start

import numpy as np
from pyscorpius import reduce_dimensionality, infer_trajectory

# expression: (n_cells × n_genes) — or pass an AnnData and use .X.toarray()
space = reduce_dimensionality(expression, dist="spearman", ndim=3)
traj  = infer_trajectory(space, k=4)
pseudotime = traj["time"]    # in [0, 1] per cell
curve      = traj["path"]    # smooth curve through `space`

Function map

Python R counterpart Purpose
reduce_dimensionality reduce_dimensionality distance + MDS to low-dim space
infer_trajectory infer_trajectory kmeans + TSP + Hastie-Stuetzle principal curve
principal_curve princurve::principal_curve exposed for direct use
extract_modules extract_modules gene-module clustering via Mclust (needs pyscorpius[modules])
gene_importances gene_importances random-forest feature importance against pseudotime

Reproducing R results

# Run R reference under your R conda env
Rscript tests/r_reference_driver.R data/fixture_simdata.rds data/reference_output.json

# Run Python candidate
python tests/_run_candidate.py data/fixture_simdata.rds data/candidate_output.json

# Compare (see compare_R_vs_Python.ipynb)
pytest tests/test_exact_match.py -v

Achieved on the SCORPIUS-bundled simulated dataset (400 cells × 200 genes):

  • Pseudotime Pearson: 0.989 (threshold 0.95)
  • Low-dim space Procrustes: 0.999 (threshold 0.85)

Relationship to omicverse

Developed under the omicverse-rebuildr protocol. Reuses py-mclustR for the extract_modules Mclust step.

Citation

Cannoodt, R. et al. SCORPIUS improves trajectory inference and identifies novel modules in dendritic cell development. bioRxiv 079509 (2016).

License

MIT — matches upstream SCORPIUS.

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

pyscorpius-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

pyscorpius-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyscorpius-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df067d9fa0063704470a92f45e79b4e52b6dc0e395efaf65deca89ccbfd80c8c
MD5 7322874d98ef133f6777ee5801f9d622
BLAKE2b-256 0bad6218eef3cc818260f49749b1657175df020cc4a9580927310c9dd4fdffb2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyscorpius-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bcafe7b73f3111d365cb5b3a5ec1b0e578c5d2e4f897a3c07f3fa971933126c
MD5 3ff71b5a28e08280dbc1d0d46c34e128
BLAKE2b-256 942ea7350564fad15c94c60c2ee8a20949d375a2ab0a3b4bf4266531b53f5a41

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