Metadata-Version: 2.4
Name: pyslingshot-bio
Version: 0.1.0
Summary: Pure-Python port of slingshot — cell-lineage and pseudotime inference (Street et al. BMC Genomics 2018).
Author-email: Zehua Zeng <starlitnightly@163.com>
License: MIT License
        
        Copyright (c) 2026 omicverse contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/omicverse/py-Slingshot
Project-URL: Repository, https://github.com/omicverse/py-Slingshot
Project-URL: Upstream R package, https://github.com/kstreet13/slingshot
Keywords: single-cell,scRNA-seq,pseudotime,lineage,trajectory,slingshot
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.10
Requires-Dist: pandas>=1.5
Requires-Dist: statsmodels>=0.14
Requires-Dist: scikit-learn>=1.2
Provides-Extra: plot
Requires-Dist: ggplot2-python>=4.0; extra == "plot"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Dynamic: license-file

# py-Slingshot

A **Python port of [slingshot](https://github.com/kstreet13/slingshot)** (Street et al. *BMC Genomics* 2018) — branching cell-lineage and pseudotime inference for single-cell RNA-seq.

- Pure NumPy / SciPy / statsmodels implementation
- MST over cluster centroids → DFS lineage enumeration → per-lineage principal curve fitting
- Parity vs R Slingshot on a Y-shaped fixture: **pseudotime Spearman 0.99+** along matched lineages

## Install

```bash
pip install pyslingshot-bio
```
(module name is `pyslingshot`; the PyPI distribution name is `pyslingshot-bio`.)

## Quick-start

```python
import pyslingshot
sr = pyslingshot.slingshot(reduced_dim, cluster_labels, start_cluster="root_cluster_id")
# Per-lineage pseudotime
pt = sr.pseudotime              # (n_cells × n_lineages)
# Visualisation
from ggplot2_py import ggsave
ggsave("out.png", plot=pyslingshot.plot_slingshot(sr), width=6, height=4, dpi=120)
```

## Function map

| Python | R | Status |
|---|---|---|
| `getLineages` | `getLineages` | ✅ |
| `getCurves` | `getCurves` | ✅ (independent per-lineage; no shared-start fitting yet) |
| `slingshot` | `slingshot` | ✅ |
| `plot_slingshot` | `plot(sds)` / vignette | ✅ |
| `plot_pseudotime` | (custom) | ✅ |
| `embedCurves` | `embedCurves` | ⏳ v0.2 |
| `predict` | `predict` | ⏳ v0.2 |
| `branchID` | `branchID` | ⏳ v0.2 |

## Known limitations (v0.1)

1. **Simultaneous principal-curve fitting deferred** — v0.1 fits each lineage independently. R Slingshot shares the early stem across lineages during fitting, which produces cleaner branching. v0.2 will add this.
2. **MST distance metric** uses plain Euclidean on centroids; R uses Mahalanobis-style scaling by within-cluster dispersion when `dist.method = "slingshot"` (default).
3. **`embedCurves`, `predict`, `branchID`** deferred to v0.2.
4. **Lineage count** can differ from R because of root-selection and lineage-merging differences; the matched lineages have Spearman ≥ 0.99 pseudotime parity.

## Citation

> Street, K. et al. *Slingshot: cell lineage and pseudotime inference for single-cell transcriptomics.* BMC Genomics 19, 477 (2018).

## License

MIT.
