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_dimensionality→infer_trajectory→extract_modules→gene_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.
Metadata
Release files for pyscorpius 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyscorpius-0.1.0.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyscorpius-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.9 kB
Release files / pyscorpius-0.1.0.tar.gz
| Download URL | pyscorpius-0.1.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df067d9fa0063704470a92f45e79b4e52b6dc0e395efaf65deca89ccbfd80c8c
|
|
BLAKE2b-256 checksum How to use checksums |
0bad6218eef3cc818260f49749b1657175df020cc4a9580927310c9dd4fdffb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / pyscorpius-0.1.0-py3-none-any.whl
| Download URL | pyscorpius-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bcafe7b73f3111d365cb5b3a5ec1b0e578c5d2e4f897a3c07f3fa971933126c
|
|
BLAKE2b-256 checksum How to use checksums |
942ea7350564fad15c94c60c2ee8a20949d375a2ab0a3b4bf4266531b53f5a41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|